@@ -50,6 +50,16 @@ If release name contains chart name it will be used as a full name.
5050{ {- end } }
5151{ {- end } }
5252
53+ { {- define " wiz-admission-controller-uninstall.name" -} }
54+ { {- if .Values.wizUninstallJob.nameOverride } }
55+ { {- .Values.wizUninstallJob.nameOverride | trunc 63 | trimSuffix " -" } }
56+ { {- else } }
57+ { {- $suffix := " -uninstall" -} }
58+ { {- $maxLength := int (sub 63 (len $suffix )) -} }
59+ { {- printf " %s%s" (include " wiz-admission-controller.fullname" . | trunc $maxLength | trimSuffix " -" ) $suffix -} }
60+ { {- end } }
61+ { {- end } }
62+
5363{ {- define " wiz-admission-controller.wiz-hpa-enforcer.name" -} }
5464{ {- $suffix := " -hpa" -} }
5565{ {- $maxLength := int (sub 63 (len $suffix )) -} }
@@ -120,6 +130,14 @@ Wiz manager selector labels
120130app.kubernetes.io/name: { { include " wiz-admission-controller-manager.name" . } }
121131{ {- end } }
122132
133+ { {/*
134+ Wiz uninstall selector labels
135+ */} }
136+ { {- define " wiz-admission-controller-uninstall.selectorLabels" -} }
137+ app.kubernetes.io/name: { { include " wiz-admission-controller-uninstall.name" . } }
138+ { {- end } }
139+
140+
123141{ {- define " wiz-admission-controller-enforcement.labels" -} }
124142{ { include " wiz-admission-controller.labels" . } }
125143{ { include " wiz-admission-controller-enforcement.selectorLabels" . } }
@@ -135,6 +153,11 @@ app.kubernetes.io/name: {{ include "wiz-admission-controller-manager.name" . }}
135153{ { include " wiz-admission-controller-manager.selectorLabels" . } }
136154{ {- end } }
137155
156+ { {- define " wiz-admission-controller-uninstall.labels" -} }
157+ { { include " wiz-admission-controller.labels" . } }
158+ { { include " wiz-admission-controller-uninstall.selectorLabels" . } }
159+ { {- end } }
160+
138161{ {/*
139162Wiz Horizontal Pod Autoscaler labels
140163*/} }
@@ -319,15 +342,24 @@ Clean the list of deployments for the auto-update flag, removing quotes and brac
319342{ {- end -} }
320343
321344{ {- define " wiz-admission-controller.isWizApiTokenSecretEnabled" -} }
322- { {- if and (.Values.wizApiToken.secret.create) (eq (include " wiz-common.isWizApiClientVolumeMountEnabled" (list .Values.wizApiToken.usePodCustomEnvironmentVariablesFile .Values.wizApiToken.wizApiTokensVolumeMount) | trim | lower) " true" ) } }
345+ { {- if and (.Values.wizApiToken.secret.create) (eq (include " wiz-common.isWizApiClientVolumeMountEnabled" (list .Values.wizApiToken.usePodCustomEnvironmentVariablesFile .Values.wizApiToken.wizApiTokensVolumeMount .Values.global.wizApiToken.wizApiTokensVolumeMount ) | trim | lower) " true" ) } }
323346 true
324347 { {- else } }
325348 false
326349 { {- end } }
327350{ {- end } }
328351
352+ { {- define " wiz-admission-controller.isWizApiClientVolumeMountEnabled" -} }
353+ { {- if eq (include " wiz-common.isWizApiClientVolumeMountEnabled" (list .Values.wizApiToken.usePodCustomEnvironmentVariablesFile .Values.wizApiToken.wizApiTokensVolumeMount .Values.global.wizApiToken.wizApiTokensVolumeMount) | trim | lower) " true" -} }
354+ true
355+ { {- else -} }
356+ false
357+ { {- end } }
358+ { {- end } }
359+
360+
329361{ {- define " wiz-admission-controller.spec.common.volumeMounts" -} }
330- { {- if eq (include " wiz-common .isWizApiClientVolumeMountEnabled" (list .Values.wizApiToken.usePodCustomEnvironmentVariablesFile .Values.wizApiToken.wizApiTokensVolumeMount) | trim | lower) " true" - } }
362+ { {- if eq (include " wiz-admission-controller .isWizApiClientVolumeMountEnabled" . | trim | lower) " true" } }
331363- name: { { include " wiz-common.volumes.apiClientName" . } }
332364 mountPath: /var/{ { include " wiz-common.volumes.apiClientName" . } }
333365 readOnly: true
@@ -338,7 +370,7 @@ Clean the list of deployments for the auto-update flag, removing quotes and brac
338370{ {- end -} }
339371
340372{ {- define " wiz-admission-controller.spec.common.volumes" -} }
341- { {- if eq (include " wiz-common .isWizApiClientVolumeMountEnabled" (list .Values.wizApiToken.usePodCustomEnvironmentVariablesFile .Values.wizApiToken.wizApiTokensVolumeMount) | trim | lower) " true" - } }
373+ { {- if eq (include " wiz-admission-controller .isWizApiClientVolumeMountEnabled" . | trim | lower) " true" } }
342374- name: { { include " wiz-common.volumes.apiClientName" . | trim } }
343375 secret:
344376 secretName: { { include " wiz-admission-controller.secretApiTokenName" . | trim } }
@@ -353,15 +385,19 @@ Clean the list of deployments for the auto-update flag, removing quotes and brac
353385{ {- if not .Values.wizApiToken.usePodCustomEnvironmentVariablesFile } }
354386- name: CLI_FILES_AS_ARGS
355387{ {- $wizApiTokensPath := " " -} }
356- { {- if .Values.wizApiToken.wizApiTokensVolumeMount } }
357- { {- $wizApiTokensPath = .Values.wizApiToken.wizApiTokensVolumeMount -} }
388+ { {- if coalesce .Values.wizApiToken.wizApiTokensVolumeMount .Values.global .wizApiToken.wizApiTokensVolumeMount } }
389+ { {- $wizApiTokensPath = coalesce .Values.wizApiToken.wizApiTokensVolumeMount .Values.global .wizApiToken.wizApiTokensVolumeMount -} }
358390{ {- else } }
359391 { {- $wizApiTokensPath = printf " /var/%s" (include " wiz-common.volumes.apiClientName" .) -} }
360392{ {- end } }
361393 value: "{ { $wizApiTokensPath } }/clientToken,{ { $wizApiTokensPath } }/clientId"
362394{ {- end } }
363395{ {- if or .Values.global.httpProxyConfiguration.enabled .Values.httpProxyConfiguration.enabled } }
364396{ { include " wiz-common.proxy.env" . | trim } }
397+ { {- if or .Values.global.httpProxyConfiguration.clientCertificate .Values.httpProxyConfiguration.clientCertificate } }
398+ - name: WIZ_HTTP_PROXY_CLIENT_CERT_PATH
399+ value: "{ { include " wiz-common.proxy.dir" . } }/clientCertificate"
400+ { {- end } }
365401{ {- end } }
366402- name: WIZ_ENV
367403 value: { { coalesce .Values.global.wizApiToken.clientEndpoint .Values.wizApiToken.clientEndpoint | quote } }
@@ -411,21 +447,6 @@ Clean the list of deployments for the auto-update flag, removing quotes and brac
411447- name: WIZ_MISCONFIGURATION_CUSTOM_ERROR_MESSAGE
412448 value: "{ { coalesce .Values.opaWebhook.customErrorMessage .Values.customErrorMessage } }"
413449{ {- end -} }
414- { {- if .Values.opaWebhook.enabled } }
415- - name: WIZ_MISCONFIGURATION_WEBHOOK_CONFIG
416- value: |
417- { { .Values.opaWebhook | toJson | nindent 4 } }
418- { {- end -} }
419- { {- if .Values.imageIntegrityWebhook.enabled } }
420- - name: WIZ_IMAGE_INTEGRITY_WEBHOOK_CONFIG
421- value: |
422- { { .Values.imageIntegrityWebhook | toJson | nindent 4 } }
423- { {- end -} }
424- { {- if .Values.kubernetesAuditLogsWebhook.enabled } }
425- - name: WIZ_KUBERNETES_AUDIT_LOG_WEBHOOK_CONFIG
426- value: |
427- { { .Values.kubernetesAuditLogsWebhook | toJson | nindent 4 } }
428- { {- end -} }
429450{ {- if coalesce .Values.global.clusterDisplayName .Values.clusterDisplayName } }
430451- name: WIZ_CLUSTER_NAME
431452 value: { { coalesce .Values.global.clusterDisplayName .Values.clusterDisplayName | quote } }
0 commit comments