/
mancenter-statefulset.yaml
252 lines (252 loc) · 10.7 KB
/
mancenter-statefulset.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
{{- if .Values.mancenter.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "mancenter.fullname" . }}
labels:
app.kubernetes.io/name: {{ template "mancenter.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
{{- range $key, $value := (merge nil .Values.mancenter.labels .Values.commonLabels) }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- with .Values.commonAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
serviceName: {{ template "mancenter.fullname" . }}
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ template "mancenter.name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
role: mancenter
template:
metadata:
labels:
app.kubernetes.io/name: {{ template "mancenter.name" . }}
helm.sh/chart: {{ template "hazelcast.chart" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
role: mancenter
{{- range $key, $val := (merge nil .Values.mancenter.podLabels .Values.commonLabels) }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- if or .Values.mancenter.annotations .Values.commonAnnotations }}
annotations:
{{- merge nil .Values.mancenter.annotations .Values.commonAnnotations | toYaml | nindent 8 }}
{{- end }}
spec:
{{- if .Values.mancenter.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.mancenter.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- if .Values.mancenter.nodeSelector }}
nodeSelector:
{{ toYaml .Values.mancenter.nodeSelector | indent 8 }}
{{- end }}
hostNetwork: false
hostPID: false
hostIPC: false
{{- if .Values.securityContext.enabled }}
securityContext:
runAsNonRoot: {{ if eq (int .Values.securityContext.runAsUser) 0 }}false{{ else }}true{{ end }}
runAsUser: {{ .Values.securityContext.runAsUser }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
fsGroup: {{ .Values.securityContext.fsGroup }}
{{- end }}
{{- if .Values.mancenter.affinity }}
affinity:
{{ toYaml .Values.mancenter.affinity | indent 8 }}
{{- end }}
{{- if .Values.mancenter.tolerations }}
tolerations:
{{ toYaml .Values.mancenter.tolerations | indent 8 }}
{{- end }}
{{- if .Values.mancenter.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml .Values.mancenter.topologySpreadConstraints | indent 8 }}
{{- end }}
containers:
- name: {{ template "mancenter.fullname" . }}
{{- if empty .Values.mancenter.image.tag }}
image: "{{ .Values.mancenter.image.repository }}@{{ .Values.mancenter.image.digest }}"
{{- else }}
image: "{{ .Values.mancenter.image.repository }}:{{ .Values.mancenter.image.tag }}"
{{- end }}
imagePullPolicy: {{ .Values.mancenter.image.pullPolicy | quote }}
resources:
{{ toYaml .Values.mancenter.resources | indent 10 }}
ports:
- name: mancenter
containerPort: {{ if .Values.mancenter.ssl }}8443{{ else }}8080{{ end }}
{{- if .Values.mancenter.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ if .Values.mancenter.contextPath }}{{ .Values.mancenter.contextPath }}{{ end }}/health
port: 8081
scheme: HTTP
initialDelaySeconds: {{ .Values.mancenter.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.mancenter.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.mancenter.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.mancenter.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.mancenter.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.mancenter.readinessProbe.enabled }}
readinessProbe:
tcpSocket:
port: {{ if .Values.mancenter.ssl }}8443{{ else }}8080{{ end }}
initialDelaySeconds: {{ .Values.mancenter.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.mancenter.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.mancenter.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.mancenter.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.mancenter.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
- name: config
mountPath: /config
- name: mancenter-storage
mountPath: /data
{{- if .Values.mancenter.persistence.subPath }}
subPath: {{ .Values.mancenter.persistence.subPath }}
{{- else if .Values.mancenter.persistence.subPathExpr }}
subPathExpr: {{ .Values.mancenter.persistence.subPathExpr }}
{{- end }}
{{- if .Values.mancenter.secretsMountName }}
- name: mancenter-secrets
mountPath: /secrets
{{- end }}
{{- if .Values.mancenter.customVolume }}
- name: mancenter-custom
mountPath: /data/custom
{{- end }}
env:
{{- if .Values.mancenter.loggingLevel }}
- name: LOGGING_LEVEL
value: {{ .Values.mancenter.loggingLevel }}
{{- end }}
{{- if .Values.mancenter.adminCredentialsSecretName }}
- name: MC_ADMIN_USER
valueFrom:
secretKeyRef:
name: {{ .Values.mancenter.adminCredentialsSecretName }}
key: username
- name: MC_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.mancenter.adminCredentialsSecretName }}
key: password
{{- end }}
{{- if .Values.mancenter.contextPath }}
- name: MC_CONTEXT_PATH
value: {{ .Values.mancenter.contextPath }}
{{- end }}
{{- if .Values.mancenter.customVolume }}
- name: MC_CLASSPATH
value: "/data/custom:/data/custom/*"
{{- end }}
{{- if .Values.mancenter.licenseKeySecretName }}
- name: MC_LICENSE_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.mancenter.licenseKeySecretName }}
key: key
{{- else if .Values.mancenter.licenseKey }}
- name: MC_LICENSE_KEY
value: {{ .Values.mancenter.licenseKey }}
{{- else if .Values.hazelcast.licenseKeySecretName }}
- name: MC_LICENSE_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.hazelcast.licenseKeySecretName }}
key: key
{{- else if .Values.hazelcast.licenseKey}}
- name: MC_LICENSE_KEY
value: {{ .Values.hazelcast.licenseKey }}
{{- end }}
{{- $clusterConfigCommand := "" }}
{{- if .Values.mancenter.clusterConfig.create }}
{{- $clusterConfigCommand = "./bin/mc-conf.sh cluster add --lenient=true -H /data -cc /config/hazelcast-client.yaml; " }}
{{- end }}
{{- if .Values.mancenter.devMode.enabled }}
- name: MC_INIT_CMD
value: "{{ $clusterConfigCommand }}./bin/mc-conf.sh dev-mode configure"
{{- else if .Values.mancenter.clusterConfig.create }}
- name: MC_INIT_CMD
value: "{{ $clusterConfigCommand }}"
{{- end }}
- name: JAVA_OPTS
value: "{{ if or .Values.mancenter.licenseKey .Values.mancenter.licenseKeySecretName .Values.hazelcast.licenseKey .Values.hazelcast.licenseKeySecretName }}-Dhazelcast.mc.license=$(MC_LICENSE_KEY){{ end }} {{ if or .Values.mancenter.readinessProbe.enabled .Values.mancenter.livenessProbe.enabled }}-Dhazelcast.mc.healthCheck.enable=true{{ end }} -DserviceName={{ template "hazelcast.serviceName" . }} -Dnamespace={{ .Release.Namespace }} -Dhazelcast.mc.tls.enabled={{ .Values.mancenter.ssl }} -Dmancenter.ssl={{ .Values.mancenter.ssl }} {{ .Values.mancenter.javaOpts }}"
{{- with .Values.mancenter.env }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
runAsNonRoot: {{ if eq (int .Values.securityContext.runAsUser) 0 }}false{{ else }}true{{ end }}
runAsUser: {{ .Values.securityContext.runAsUser }}
runAsGroup: {{ .Values.securityContext.runAsGroup }}
privileged: false
readOnlyRootFilesystem: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
{{- end }}
{{- if .Values.mancenter.priorityClassName }}
priorityClassName: "{{ .Values.mancenter.priorityClassName }}"
{{- end }}
serviceAccountName: {{ template "hazelcast.serviceAccountName" . }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
volumes:
- name: config
configMap:
{{- if .Values.mancenter.existingConfigMap }}
name: {{ .Values.mancenter.existingConfigMap }}
{{- else }}
name: {{ template "mancenter.fullname" . }}-configuration
{{- end }}
{{- if .Values.mancenter.secretsMountName }}
- name: mancenter-secrets
secret:
secretName: {{ .Values.mancenter.secretsMountName }}
{{- end }}
- name: mancenter-storage
{{- if and (eq .Values.mancenter.persistence.enabled true) .Values.mancenter.persistence.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.mancenter.persistence.existingClaim }}
{{- else if (eq .Values.mancenter.persistence.enabled false) }}
emptyDir: {}
{{- end }}
{{- if .Values.mancenter.customVolume }}
- name: mancenter-custom
{{ toYaml .Values.mancenter.customVolume | indent 10 }}
{{- end }}
{{ if and (eq .Values.mancenter.persistence.enabled true) (empty .Values.mancenter.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: mancenter-storage
labels:
app.kubernetes.io/name: {{ template "mancenter.name" . }}
app.kubernetes.io/instance: "{{ .Release.Name }}"
app.kubernetes.io/managed-by: "{{ .Release.Service }}"
spec:
accessModes:
{{- range .Values.mancenter.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
{{- if .Values.mancenter.persistence.storageClass }}
{{- if (eq "-" .Values.mancenter.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.mancenter.persistence.storageClass }}"
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.mancenter.persistence.size | quote }}
{{- end }}
{{- end -}}