Files
service-catalog/manifests/helm/kyverno/3.9.0/templates/hooks/pre-delete-scale-to-zero.yaml
T
wbsong111 a79e959c60 kyverno 3.9.0 추가 — 자체 빌드 이미지 사용, 3.4.1 정리 (#57)
* kyverno 3.9.0(appVersion v1.19.0) 차트 추가 — 자체 빌드 이미지 사용

업스트림 이미지가 CVE 스캔 불가능한 베이스를 써서 자체 빌드로 대체한다(빌드 정의·근거는
hardened-containers). custom-values.yaml이 docker.io/paasup/* 7개 이미지를 가리키도록
고정했다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* kyverno 3.4.1 삭제
3.9.0 추가 후 정리

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-27 14:46:42 +09:00

111 lines
4.3 KiB
YAML

{{- if .Values.webhooksCleanup.enabled -}}
{{- if not .Values.global.templating.enabled -}}
{{- $automountSAToken := .Values.webhooksCleanup.serviceAccount.automountServiceAccountToken }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "kyverno.fullname" . }}-scale-to-zero
namespace: {{ template "kyverno.namespace" . }}
labels:
{{- include "kyverno.hooks.labels" . | nindent 4 }}
annotations:
helm.sh/hook: pre-delete
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded,hook-failed
{{/* Make sure this runs before other pre-delete jobs that removes webhooksconfiguration*/}}
helm.sh/hook-weight: "90"
spec:
backoffLimit: 2
template:
{{- if or .Values.webhooksCleanup.podAnnotations .Values.webhooksCleanup.podLabels }}
metadata:
{{- with .Values.webhooksCleanup.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.webhooksCleanup.podLabels }}
labels:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ template "kyverno.admission-controller.serviceAccountName" . }}
automountServiceAccountToken: {{ $automountSAToken }}
{{- with .Values.webhooksCleanup.podSecurityContext }}
securityContext:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
restartPolicy: Never
{{- with .Values.webhooksCleanup.imagePullSecrets | default .Values.global.imagePullSecrets }}
imagePullSecrets:
{{- tpl (include "kyverno.sortedImagePullSecrets" .) $ | nindent 8 }}
{{- end }}
containers:
- name: kubectl
image: {{ (include "kyverno.image" (dict "globalRegistry" .Values.global.image.registry "image" .Values.webhooksCleanup.image "defaultTag" (default .Chart.AppVersion .Values.webhooksCleanup.image.tag))) | quote }}
imagePullPolicy: {{ .Values.webhooksCleanup.image.pullPolicy }}
args:
- scale-deploy
{{- with .Values.webhooksCleanup.resources }}
resources:
{{- tpl (toYaml .) $ | nindent 12 }}
{{- end }}
{{- with .Values.webhooksCleanup.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if not $automountSAToken }}
volumeMounts:
- name: serviceaccount-token
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
readOnly: true
{{- end }}
{{- with .Values.webhooksCleanup.tolerations | default .Values.global.tolerations}}
tolerations:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with .Values.webhooksCleanup.nodeSelector | default .Values.global.nodeSelector }}
nodeSelector:
{{- tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if or .Values.webhooksCleanup.podAntiAffinity .Values.webhooksCleanup.podAffinity .Values.webhooksCleanup.nodeAffinity }}
affinity:
{{- with .Values.webhooksCleanup.podAntiAffinity }}
podAntiAffinity:
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- with .Values.webhooksCleanup.podAffinity }}
podAffinity:
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- with .Values.webhooksCleanup.nodeAffinity }}
nodeAffinity:
{{- tpl (toYaml .) $ | nindent 10 }}
{{- end }}
{{- end }}
{{- if not $automountSAToken }}
volumes:
- name: serviceaccount-token
projected:
defaultMode: 0444
sources:
- serviceAccountToken:
expirationSeconds: {{ .Values.webhooksCleanup.serviceAccount.projectedServiceAccountToken.expirationSeconds | default 3600 }}
path: token
{{- with .Values.webhooksCleanup.serviceAccount.projectedServiceAccountToken.audience }}
audience: {{ . }}
{{- end }}
- configMap:
name: kube-root-ca.crt
items:
- key: ca.crt
path: ca.crt
- downwardAPI:
items:
- path: namespace
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
{{- end }}
{{- end -}}
{{- end -}}