-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzadig服务配置模板
180 lines (180 loc) · 4.71 KB
/
zadig服务配置模板
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
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
app: $EnvName$-pos-amazoncenter
name: $EnvName$-pos-amazoncenter
spec:
progressDeadlineSeconds: 600
replicas: {{.REPLICE_NUM}}
revisionHistoryLimit: 10
selector:
matchLabels:
app: $EnvName$-pos-amazoncenter
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: $EnvName$-pos-amazoncenter
{{ if .ARMS_ENABLE }}
armsPilotAutoEnable: "on"
armsPilotCreateAppName: $EnvName$-pos-amazoncenter
armsSecAutoEnable: "on"
{{ end }}
spec:
{{ if .MATCHEXPRESSIONS_KEY }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: {{.MATCHEXPRESSIONS_KEY}}
operator: In
values:
- {{.MATCHEXPRESSIONS_VALUES}}
{{ end }}
containers:
- env:
- name: LANG
value: zh_CN.UTF-8
- name: JAVA_HOME
value: /usr/lib/jvm/java-1.8.0-amazon-corretto
- name: CATALINA_HOME
value: /usr/local/tomcat
- name: TZ
value: Asia/Shanghai
- name: JAVA_OPTS
value: {{.JAVA_OPTION}}
- name: APOLLO_ACCESS_KEY_SECRET
value: {{.APOLLO_ACCESS_KEY_SECRET}}
- name: apollo.bootstrap.namespaces
value: application-pos,application,amazonCenter-public,earth-public
envFrom:
- configMapRef:
name: {{.APOLLO_FILE}}
image: acr.nhsoftcloud.com/cn-nhsoft/amazon-center:v0
imagePullPolicy: IfNotPresent
startupProbe:
failureThreshold: 12
httpGet:
path: /amazonCenter/echo
port: 8080
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
livenessProbe:
failureThreshold: 5
httpGet:
path: /amazonCenter/echo
port: 8080
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: amazon-center
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /amazonCenter/echo
port: 8080
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
{{ if .CPU_LIMIT }}
cpu: {{.CPU_LIMIT}}
{{ end }}
memory: {{.MEM_USAGE}}Mi
requests:
{{ if .CPU_REQUEST }}
cpu: {{.CPU_REQUEST}}
{{ end }}
memory: {{.MEM_USAGE}}Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
---
{{ if .ECI_ENABLE }}
apiVersion: scheduling.alibabacloud.com/v1alpha1
kind: ResourcePolicy
metadata:
name: rp-$EnvName$-pos-amazoncenter
spec:
ignorePreviousPod: false
ignoreTerminatingPod: true
matchLabelKeys:
- pod-template-hash
preemptPolicy: AfterAllUnits
selector:
app: $EnvName$-pos-amazoncenter
strategy: prefer
units:
- max: {{.REPLICE_NUM}}
resource: ecs
- resource: eci
whenExceedMax: NeverEvict
---
{{ end }}
{{ if ne .HPA_MAX_REPLICA 0 }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: hpa-$EnvName$-pos-amazoncenter
spec:
maxReplicas: {{.HPA_MAX_REPLICA}}
minReplicas: {{.REPLICE_NUM}}
metrics:
- resource:
name: cpu
target:
averageUtilization: 80
type: Utilization
type: Resource
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: $EnvName$-pos-amazoncenter
---
{{ end }}
{{ if and (ne .HPA_MAX_REPLICA 0) ( .CRON_HPA_UP ) ( .CRON_HPA_DOWN ) }}
apiVersion: autoscaling.alibabacloud.com/v1beta1
kind: CronHorizontalPodAutoscaler
metadata:
labels:
controller-tools.k8s.io: "1.0"
name: cronhpa-$EnvName$-pos-amazoncenter
spec:
scaleTargetRef:
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
name: hpa-$EnvName$-pos-amazoncenter
jobs:
{{ range .CRON_HPA_UP }}
- name: scale-up-{{ .name }}
schedule: {{ .cron }}
targetSize: {{ $.HPA_MAX_REPLICA }}
runOnce: false
{{ end }}
{{ range .CRON_HPA_DOWN }}
- name: scale-down-{{ .name }}
schedule: {{ .cron }}
targetSize: {{ $.REPLICE_NUM }}
runOnce: false
{{ end }}
{{ end }}