forked from HXSecurity/DongTai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade-legacy.yaml
298 lines (285 loc) · 7.31 KB
/
upgrade-legacy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
---
# 创建配置文件
apiVersion: v1
data:
config.ini: |-
[mysql]
host = {{dongtai-mysql}}
port = {{3306}}
name = {{dongtai_webapi}}
user = {{root}}
password = {{dongtai-iast}}
[redis]
host = {{dongtai-redis}}
port = {{6379}}
password = {{123456}}
db = 0
[engine]
url = http://dongtai-engine-svc:80
[apiserver]
url = http://dongtai-server-svc:80
[security]
csrf_trust_origins = .example.com
secret_key = vbjlvbxfvazjfprywuxgyclmvhtmselddsefxxlcixovmqfpgy
[smtp]
server = smtp_server
user = smtp_user
password = smtp_password
from_addr = from_addr
ssl = False
cc_addr = cc_addr
port = 25
[sca]
base_url = https://iast.huoxian.cn/openapi/sca/v1
kind: ConfigMap
metadata:
name: dongtai-iast-config.ini
namespace: {{CHANGE_THIS_NAMESPACE}}
---
# dongtai-server服务
apiVersion: apps/v1
kind: Deployment
metadata:
name: dongtai-server
namespace: {{CHANGE_THIS_NAMESPACE}}
annotations:
kubesphere.io/description: dongtai-server
labels:
app: dongtai-server
spec:
replicas: 1
selector:
matchLabels:
app: dongtai-server
template:
metadata:
labels:
app: dongtai-server
spec:
containers:
- name: dongtai-server-container
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-server:{{CHANGE_THIS_VERSION}}
imagePullPolicy: Always
volumeMounts:
- name: configfile
mountPath: /opt/dongtai/webapi/conf/config.ini
subPath: config.ini
resources:
limits:
cpu: "500m"
memory: 1000Mi
requests:
cpu: "500m"
memory: 1000Mi
volumes:
- name: configfile
configMap:
name: dongtai-iast-config.ini
---
# dongtai-web服务
apiVersion: v1
kind: Service
metadata:
name: dongtai-server-svc
namespace: {{CHANGE_THIS_NAMESPACE}}
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8000
selector:
app: dongtai-server
type: ClusterIP
---
# 创建nginx.conf配置
apiVersion: v1
data:
nginx.conf: |-
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
gzip on;
gzip_min_length 5k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 3;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
server {
listen 80;
server_name 127.0.0.1;
client_max_body_size 100M;
location / {
root /usr/share/nginx/html; #站点目录
index index.html index.htm; #添加属性。
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_read_timeout 60;
proxy_pass http://dongtai-server-svc:80/api/;
}
location /upload/ {
proxy_pass http://dongtai-server-svc:80/upload/;
}
location /openapi/ {
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Host $http_x_forwarded_host;
proxy_read_timeout 60;
proxy_pass http://dongtai-server-svc:80/;
}
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
kind: ConfigMap
metadata:
name: dongtai-web-nginx-conf
namespace: {{CHANGE_THIS_NAMESPACE}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dongtai-web
namespace: {{CHANGE_THIS_NAMESPACE}}
annotations:
kubesphere.io/description: dongtai前端项目
labels:
app: dongtai-web
spec:
replicas: 1
selector:
matchLabels:
app: dongtai-web
template:
metadata:
labels:
app: dongtai-web
spec:
containers:
- name: dongtai-web-container
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-web:{{CHANGE_THIS_VERSION}}
imagePullPolicy: Always
volumeMounts:
- name: configfile
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
resources:
limits:
cpu: "500m"
memory: 1000Mi
requests:
cpu: "500m"
memory: 1000Mi
volumes:
- name: configfile
configMap:
name: dongtai-web-nginx-conf
---
# dongtai-engine服务
apiVersion: apps/v1
kind: Deployment
metadata:
name: dongtai-engine
namespace: {{CHANGE_THIS_NAMESPACE}}
annotations:
kubesphere.io/description: dongtai-engine
labels:
app: dongtai-engine
spec:
replicas: 1
selector:
matchLabels:
app: dongtai-engine
template:
metadata:
labels:
app: dongtai-engine
spec:
containers:
- name: dongtai-engine-container
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-server:{{CHANGE_THIS_VERSION}}
command: ["/bin/sh", "/opt/dongtai/webapi/docker/entrypoint.sh"]
args: ["worker"]
imagePullPolicy: Always
volumeMounts:
- name: configfile
mountPath: /opt/dongtai/webapi/conf/config.ini
subPath: config.ini
resources:
limits:
cpu: "500m"
memory: 1000Mi
requests:
cpu: "500m"
memory: 1000Mi
volumes:
- name: configfile
configMap:
name: dongtai-iast-config.ini
---
apiVersion: v1
kind: Service
metadata:
name: dongtai-engine-svc
namespace: {{CHANGE_THIS_NAMESPACE}}
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8000
selector:
app: dongtai-engine
type: ClusterIP
---
#dongtai-engine-task服务
apiVersion: apps/v1
kind: Deployment
metadata:
name: dongtai-engine-task
namespace: {{CHANGE_THIS_NAMESPACE}}
annotations:
kubesphere.io/description: dongtai-engine-task
labels:
app: dongtai-engine-task
spec:
replicas: 1
selector:
matchLabels:
app: dongtai-engine-task
template:
metadata:
labels:
app: dongtai-engine-task
spec:
containers:
- name: dongtai-engine-task-container
image: registry.cn-beijing.aliyuncs.com/huoxian_pub/dongtai-server:{{CHANGE_THIS_VERSION}}
command: ["/bin/bash", "/opt/dongtai/webapi/docker/entrypoint.sh"]
args: ["beat"]
imagePullPolicy: Always
volumeMounts:
- name: configfile
mountPath: /opt/dongtai/webapi/conf/config.ini
subPath: config.ini
resources:
limits:
cpu: "500m"
memory: 1000Mi
requests:
cpu: "500m"
memory: 1000Mi
volumes:
- name: configfile
configMap:
name: dongtai-iast-config.ini