-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeployment.yaml
More file actions
238 lines (238 loc) · 9.15 KB
/
Copy pathdeployment.yaml
File metadata and controls
238 lines (238 loc) · 9.15 KB
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
{{- if and .Values.adminApi.enabled (not .Values.adminApi.token) }}
{{- fail "Set adminApi.token when adminApi.enabled is true" }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "nanomask.fullname" . }}
labels:
{{- include "nanomask.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "nanomask.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "nanomask.selectorLabels" . | nindent 8 }}
annotations:
# Force a rollout when the entity ConfigMap changes.
{{- if .Values.entities.data }}
checksum/entities: {{ .Values.entities.data | sha256sum }}
{{- end }}
{{- if .Values.schema.data }}
checksum/schema: {{ printf "%s:%s" .Values.schema.fileName .Values.schema.data | sha256sum }}
{{- end }}
{{- if or .Values.hashing.key .Values.hashing.fileData }}
checksum/hashing: {{ printf "%s:%s:%s" .Values.hashing.fileName .Values.hashing.key .Values.hashing.fileData | sha256sum }}
{{- end }}
spec:
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: nanomask
image: {{ include "nanomask.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.proxy.listenPort }}
protocol: TCP
env:
- name: NANOMASK_LISTEN_HOST
value: {{ .Values.proxy.listenHost | quote }}
- name: NANOMASK_LISTEN_PORT
value: {{ .Values.proxy.listenPort | quote }}
- name: NANOMASK_TARGET_HOST
value: {{ .Values.proxy.targetHost | quote }}
- name: NANOMASK_TARGET_PORT
value: {{ .Values.proxy.targetPort | quote }}
- name: NANOMASK_FUZZY_THRESHOLD
value: {{ .Values.proxy.fuzzyThreshold | quote }}
- name: NANOMASK_MAX_CONNECTIONS
value: {{ .Values.proxy.maxConnections | quote }}
- name: NANOMASK_LOG_LEVEL
value: {{ .Values.proxy.logLevel | quote }}
- name: NANOMASK_MAX_BODY_SIZE
value: {{ .Values.proxy.maxBodySize | quote }}
- name: NANOMASK_UNSUPPORTED_REQUEST_BODY_BEHAVIOR
value: {{ .Values.proxy.unsupportedRequestBodyBehavior | quote }}
- name: NANOMASK_UNSUPPORTED_RESPONSE_BODY_BEHAVIOR
value: {{ .Values.proxy.unsupportedResponseBodyBehavior | quote }}
- name: NANOMASK_UPSTREAM_CONNECT_TIMEOUT_MS
value: {{ .Values.proxy.upstreamConnectTimeoutMs | quote }}
- name: NANOMASK_UPSTREAM_READ_TIMEOUT_MS
value: {{ .Values.proxy.upstreamReadTimeoutMs | quote }}
- name: NANOMASK_UPSTREAM_REQUEST_TIMEOUT_MS
value: {{ .Values.proxy.upstreamRequestTimeoutMs | quote }}
- name: NANOMASK_SHUTDOWN_DRAIN_TIMEOUT_MS
value: {{ .Values.proxy.shutdownDrainTimeoutMs | quote }}
- name: NANOMASK_ENABLE_EMAIL
value: {{ .Values.features.email | quote }}
- name: NANOMASK_ENABLE_PHONE
value: {{ .Values.features.phone | quote }}
- name: NANOMASK_ENABLE_CREDIT_CARD
value: {{ .Values.features.creditCard | quote }}
- name: NANOMASK_ENABLE_IP
value: {{ .Values.features.ipAddress | quote }}
- name: NANOMASK_ENABLE_HEALTHCARE
value: {{ .Values.features.healthcarePatterns | quote }}
{{- if .Values.features.reportOnly }}
- name: NANOMASK_REPORT_ONLY
value: "true"
{{- end }}
{{- if .Values.proxy.targetTls }}
- name: NANOMASK_TARGET_TLS
value: "true"
{{- end }}
{{- if .Values.proxy.tlsNoSystemCa }}
- name: NANOMASK_TLS_NO_SYSTEM_CA
value: "true"
{{- end }}
{{- if .Values.proxy.auditLog }}
- name: NANOMASK_AUDIT_LOG
value: "true"
{{- end }}
{{- if .Values.adminApi.enabled }}
- name: NANOMASK_ADMIN_API
value: "true"
- name: NANOMASK_ADMIN_MUTATION_RATE_LIMIT
value: {{ .Values.adminApi.mutationRateLimitPerMinute | quote }}
{{- end }}
{{- if .Values.adminApi.token }}
- name: NANOMASK_ADMIN_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "nanomask.fullname" . }}-admin
key: token
{{- end }}
{{- if .Values.adminApi.listenAddress }}
- name: NANOMASK_ADMIN_LISTEN_ADDRESS
value: {{ .Values.adminApi.listenAddress | quote }}
{{- end }}
{{- if .Values.adminApi.allowlist }}
- name: NANOMASK_ADMIN_ALLOWLIST
value: {{ .Values.adminApi.allowlist | quote }}
{{- end }}
{{- if .Values.adminApi.readOnly }}
- name: NANOMASK_ADMIN_READ_ONLY
value: "true"
{{- end }}
{{- if .Values.entities.data }}
- name: NANOMASK_ENTITY_FILE
value: /etc/nanomask/entities/entities.txt
- name: NANOMASK_WATCH_INTERVAL
value: {{ .Values.entities.watchIntervalMs | quote }}
{{- end }}
{{- if .Values.schema.data }}
- name: NANOMASK_SCHEMA_FILE
value: /etc/nanomask/schema/{{ .Values.schema.fileName }}
- name: NANOMASK_SCHEMA_DEFAULT
value: {{ .Values.schema.defaultAction | quote }}
{{- end }}
{{- if .Values.hashing.key }}
- name: NANOMASK_HASH_KEY
valueFrom:
secretKeyRef:
name: {{ include "nanomask.fullname" . }}-hashing
key: hash-key
{{- end }}
{{- if .Values.hashing.fileData }}
- name: NANOMASK_HASH_KEY_FILE
value: /etc/nanomask/hash/{{ .Values.hashing.fileName }}
{{- end }}
{{- if .Values.tls.enabled }}
- name: NANOMASK_TLS_CERT
value: /etc/nanomask/tls/tls.crt
- name: NANOMASK_TLS_KEY
value: /etc/nanomask/tls/tls.key
{{- end }}
{{- if .Values.tls.caData }}
- name: NANOMASK_CA_FILE
value: /etc/nanomask/tls/ca.crt
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: http
{{- if .Values.tls.enabled }}
scheme: HTTPS
{{- end }}
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /readyz
port: http
{{- if .Values.tls.enabled }}
scheme: HTTPS
{{- end }}
initialDelaySeconds: 2
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 2
resources:
{{- toYaml .Values.resources | nindent 12 }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
{{- if .Values.entities.data }}
- name: entities
mountPath: /etc/nanomask/entities
readOnly: true
{{- end }}
{{- if .Values.schema.data }}
- name: schema
mountPath: /etc/nanomask/schema
readOnly: true
{{- end }}
{{- if .Values.hashing.fileData }}
- name: hash
mountPath: /etc/nanomask/hash
readOnly: true
{{- end }}
{{- if .Values.tls.enabled }}
- name: tls-certs
mountPath: /etc/nanomask/tls
readOnly: true
{{- end }}
volumes:
{{- if .Values.entities.data }}
- name: entities
configMap:
name: {{ include "nanomask.fullname" . }}-entities
{{- end }}
{{- if .Values.schema.data }}
- name: schema
configMap:
name: {{ include "nanomask.fullname" . }}-schema
{{- end }}
{{- if .Values.hashing.fileData }}
- name: hash
secret:
secretName: {{ include "nanomask.fullname" . }}-hashing
{{- end }}
{{- if .Values.tls.enabled }}
- name: tls-certs
secret:
secretName: {{ include "nanomask.fullname" . }}-tls
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}