mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
* refactor: helm admission controller config Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * tuf stuff Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * refactor: helm admission controller config Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * fix Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
193 lines
7.5 KiB
YAML
193 lines
7.5 KiB
YAML
{{- if not .Values.templating.debug -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "kyverno.fullname" . }}
|
|
namespace: {{ template "kyverno.namespace" . }}
|
|
labels:
|
|
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
|
spec:
|
|
replicas: {{ template "kyverno.deployment.replicas" .Values.admissionController.replicas }}
|
|
{{- with .Values.admissionController.updateStrategy }}
|
|
strategy:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "kyverno.admission-controller.matchLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "kyverno.admission-controller.labels" . | nindent 8 }}
|
|
{{- range $key, $value := .Values.podLabels }}
|
|
{{ $key }}: {{ $value }}
|
|
{{- end }}
|
|
{{- with .Values.podAnnotations }}
|
|
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- with .Values.image.pullSecrets }}
|
|
imagePullSecrets:
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.podSecurityContext }}
|
|
securityContext:
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.nodeSelector }}
|
|
nodeSelector:
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.tolerations }}
|
|
tolerations:
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.topologySpreadConstraints }}
|
|
topologySpreadConstraints:
|
|
{{- tpl (toYaml .) $ | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.priorityClassName }}
|
|
priorityClassName: {{ . | quote }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.hostNetwork }}
|
|
hostNetwork: {{ . }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.dnsPolicy }}
|
|
dnsPolicy: {{ . }}
|
|
{{- end }}
|
|
{{- if or .Values.admissionController.antiAffinity.enable .Values.admissionController.podAffinity .Values.admissionController.nodeAffinity }}
|
|
affinity:
|
|
{{- if .Values.admissionController.antiAffinity.enabled }}
|
|
{{- with .Values.admissionController.podAntiAffinity }}
|
|
podAntiAffinity:
|
|
{{- tpl (toYaml .) $ | nindent 10 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.podAffinity }}
|
|
podAffinity:
|
|
{{- tpl (toYaml .) $ | nindent 10 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.nodeAffinity }}
|
|
nodeAffinity:
|
|
{{- tpl (toYaml .) $ | nindent 10 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
serviceAccountName: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
|
initContainers:
|
|
{{- if .Values.extraInitContainers }}
|
|
{{- toYaml .Values.extraInitContainers | nindent 8 }}
|
|
{{- end }}
|
|
- name: kyverno-pre
|
|
image: {{ include "kyverno.image" (dict "image" .Values.admissionController.initContainer.image "defaultTag" (default .Chart.AppVersion .Values.image.tag)) | quote }}
|
|
imagePullPolicy: {{ default .Values.image.pullPolicy .Values.admissionController.initContainer.image.pullPolicy }}
|
|
{{- if .Values.initContainer.extraArgs }}
|
|
args:
|
|
{{- tpl (toYaml .Values.initContainer.extraArgs) . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.initContainer.resources }}
|
|
resources:
|
|
{{- tpl (toYaml .) $ | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.securityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
env:
|
|
- name: METRICS_CONFIG
|
|
value: {{ template "kyverno.config.metricsConfigMapName" . }}
|
|
- name: KYVERNO_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: KYVERNO_POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: KYVERNO_DEPLOYMENT
|
|
value: {{ template "kyverno.fullname" . }}
|
|
{{- with .Values.envVarsInit }}
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
containers:
|
|
{{- if .Values.extraContainers }}
|
|
{{- toYaml .Values.extraContainers | nindent 8 }}
|
|
{{- end }}
|
|
- name: kyverno
|
|
image: {{ include "kyverno.image" (dict "image" .Values.image "defaultTag" .Chart.AppVersion) | quote }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
{{- if or .Values.extraArgs .Values.imagePullSecrets }}
|
|
args:
|
|
- --servicePort={{ .Values.service.port }}
|
|
{{- if .Values.extraArgs -}}
|
|
{{ tpl (toYaml .Values.extraArgs) . | nindent 12 }}
|
|
{{- end }}
|
|
{{- if or .Values.imagePullSecrets .Values.existingImagePullSecrets }}
|
|
- --imagePullSecrets={{- join "," (concat (keys .Values.imagePullSecrets) .Values.existingImagePullSecrets) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.resources }}
|
|
resources: {{ tpl (toYaml .) $ | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.securityContext }}
|
|
securityContext:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- containerPort: 9443
|
|
name: https
|
|
protocol: TCP
|
|
- containerPort: 8000
|
|
name: metrics-port
|
|
protocol: TCP
|
|
env:
|
|
- name: INIT_CONFIG
|
|
value: {{ template "kyverno.config.configMapName" . }}
|
|
- name: METRICS_CONFIG
|
|
value: {{ template "kyverno.config.metricsConfigMapName" . }}
|
|
- name: KYVERNO_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: KYVERNO_POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: KYVERNO_SERVICEACCOUNT_NAME
|
|
value: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
|
- name: KYVERNO_SVC
|
|
value: {{ template "kyverno.admission-controller.serviceName" . }}
|
|
- name: TUF_ROOT
|
|
value: {{ .Values.admissionController.tufRootMountPath }}
|
|
{{- with .Values.envVars }}
|
|
{{- toYaml . | nindent 10 }}
|
|
{{- end }}
|
|
- name: KYVERNO_DEPLOYMENT
|
|
value: {{ template "kyverno.fullname" . }}
|
|
{{- with .Values.admissionController.startupProbe }}
|
|
startupProbe:
|
|
{{- tpl (toYaml .) $ | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.livenessProbe }}
|
|
livenessProbe:
|
|
{{- tpl (toYaml .) $ | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.admissionController.readinessProbe }}
|
|
readinessProbe:
|
|
{{- tpl (toYaml .) $ | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- mountPath: {{ .Values.admissionController.tufRootMountPath }}
|
|
name: sigstore
|
|
- mountPath: /var/run/secrets/tokens
|
|
name: api-token
|
|
volumes:
|
|
- name: sigstore
|
|
{{- toYaml (required "A valid .Values.admissionController.sigstoreVolume entry is required" .Values.admissionController.sigstoreVolume) | nindent 8 }}
|
|
- name: api-token
|
|
projected:
|
|
sources:
|
|
- serviceAccountToken:
|
|
path: api-token
|
|
expirationSeconds: 600
|
|
audience: kyverno-extension
|
|
{{- end -}}
|