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>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{- define "kyverno.admission-controller.name" -}}
|
||||
{{ template "kyverno.name" . }}-admission-controller
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.admission-controller.labels" -}}
|
||||
{{- template "kyverno.labels.merge" (list
|
||||
(include "kyverno.labels.name" (include "kyverno.admission-controller.name" .))
|
||||
(include "kyverno.labels.common" .)
|
||||
(include "kyverno.admission-controller.matchLabels" .)
|
||||
) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.admission-controller.matchLabels" -}}
|
||||
{{- template "kyverno.labels.merge" (list
|
||||
(include "kyverno.matchLabels.common" .)
|
||||
(include "kyverno.labels.component" "admission-controller")
|
||||
) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.admission-controller.roleName" -}}
|
||||
{{ include "kyverno.fullname" . }}:admission-controller
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.admission-controller.serviceAccountName" -}}
|
||||
{{- if .Values.admissionController.rbac.create -}}
|
||||
{{ default (include "kyverno.admission-controller.name" .) .Values.admissionController.rbac.serviceAccount.name }}
|
||||
{{- else -}}
|
||||
{{ required "A service account name is required when `rbac.create` is set to `false`" .Values.admissionController.rbac.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.admission-controller.serviceName" -}}
|
||||
{{- printf "%s-svc" (include "kyverno.fullname" .) | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "kyverno.admission-controller.caCertificatesConfigMapName" -}}
|
||||
{{ printf "%s-ca-certificates" (include "kyverno.admission-controller.name" .) }}
|
||||
{{- end -}}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
{{- if and .Values.admissionController.certManager.enabled (not .Values.admissionController.createSelfSignedCert) -}}
|
||||
{{- $ns := include "kyverno.namespace" . -}}
|
||||
{{- $svcName := include "kyverno.admission-controller.serviceName" . -}}
|
||||
{{- $fullSvcName := printf "%s.%s.svc" $svcName $ns -}}
|
||||
{{- $algorithm := .Values.admissionController.certManager.algorithm | default "RSA" -}}
|
||||
{{- $size := .Values.admissionController.certManager.size | default 2048 -}}
|
||||
{{- $caIssuerName := printf "%s-ca-issuer" (include "kyverno.fullname" .) -}}
|
||||
{{- $selfSignedIssuerName := printf "%s-selfsigned-issuer" (include "kyverno.fullname" .) -}}
|
||||
---
|
||||
# Self-signed ClusterIssuer for generating the CA certificate
|
||||
{{- if .Values.admissionController.certManager.createSelfSignedIssuer }}
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: ClusterIssuer
|
||||
metadata:
|
||||
name: {{ $selfSignedIssuerName }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selfSigned: {}
|
||||
---
|
||||
{{- end }}
|
||||
# CA Certificate for signing Kyverno admission controller TLS certificates
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ include "kyverno.fullname" . }}-admission-controller-ca
|
||||
namespace: {{ $ns }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
isCA: true
|
||||
commonName: {{ include "kyverno.fullname" . }}-admission-controller-ca
|
||||
# Use the exact secret name Kyverno expects for admission controller CA
|
||||
secretName: {{ $fullSvcName }}.kyverno-tls-ca
|
||||
duration: {{ .Values.admissionController.certManager.ca.duration | default "87600h" }}
|
||||
renewBefore: {{ .Values.admissionController.certManager.ca.renewBefore | default "720h" }}
|
||||
privateKey:
|
||||
algorithm: {{ $algorithm }}
|
||||
{{- if ne $algorithm "Ed25519" }}
|
||||
size: {{ $size }}
|
||||
{{- end }}
|
||||
issuerRef:
|
||||
{{- if .Values.admissionController.certManager.issuerRef.name }}
|
||||
name: {{ .Values.admissionController.certManager.issuerRef.name }}
|
||||
kind: {{ .Values.admissionController.certManager.issuerRef.kind | default "ClusterIssuer" }}
|
||||
group: {{ .Values.admissionController.certManager.issuerRef.group | default "cert-manager.io" }}
|
||||
{{- else if .Values.admissionController.certManager.createSelfSignedIssuer }}
|
||||
name: {{ $selfSignedIssuerName }}
|
||||
kind: ClusterIssuer
|
||||
group: cert-manager.io
|
||||
{{- else }}
|
||||
{{- fail "Either certManager.issuerRef.name must be specified or certManager.createSelfSignedIssuer must be true" }}
|
||||
{{- end }}
|
||||
---
|
||||
# CA Issuer using the CA certificate for signing TLS certificates
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Issuer
|
||||
metadata:
|
||||
name: {{ $caIssuerName }}
|
||||
namespace: {{ $ns }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
ca:
|
||||
# Reference the CA secret created by the CA certificate
|
||||
secretName: {{ $fullSvcName }}.kyverno-tls-ca
|
||||
---
|
||||
# TLS Certificate for Kyverno Admission Controller
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: {{ include "kyverno.fullname" . }}-admission-controller-tls
|
||||
namespace: {{ $ns }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
# Use the exact secret name Kyverno expects for admission controller TLS
|
||||
secretName: {{ $fullSvcName }}.kyverno-tls-pair
|
||||
duration: {{ .Values.admissionController.certManager.tls.duration | default "8760h" }}
|
||||
renewBefore: {{ .Values.admissionController.certManager.tls.renewBefore | default "720h" }}
|
||||
privateKey:
|
||||
algorithm: {{ $algorithm }}
|
||||
{{- if ne $algorithm "Ed25519" }}
|
||||
size: {{ $size }}
|
||||
{{- end }}
|
||||
usages:
|
||||
- server auth
|
||||
- digital signature
|
||||
- key encipherment
|
||||
dnsNames:
|
||||
- {{ $svcName }}
|
||||
- {{ $svcName }}.{{ $ns }}
|
||||
- {{ $svcName }}.{{ $ns }}.svc
|
||||
- {{ $svcName }}.{{ $ns }}.svc.cluster.local
|
||||
issuerRef:
|
||||
name: {{ $caIssuerName }}
|
||||
kind: Issuer
|
||||
group: cert-manager.io
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,212 @@
|
||||
{{- if .Values.admissionController.rbac.create }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
aggregationRule:
|
||||
clusterRoleSelectors:
|
||||
- matchLabels:
|
||||
rbac.kyverno.io/aggregate-to-admission-controller: "true"
|
||||
- matchLabels:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 8 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}:core
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- get
|
||||
{{- if .Values.admissionController.crdWatcher | default .Values.global.crdWatcher }}
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
- apiGroups:
|
||||
- admissionregistration.k8s.io
|
||||
resources:
|
||||
- mutatingwebhookconfigurations
|
||||
- validatingwebhookconfigurations
|
||||
# Always grant permissions for admission policies to support per-policy generation overrides
|
||||
# even when global generateValidatingAdmissionPolicy/generateMutatingAdmissionPolicy flags are disabled.
|
||||
- validatingadmissionpolicies
|
||||
- validatingadmissionpolicybindings
|
||||
- mutatingadmissionpolicies
|
||||
- mutatingadmissionpolicybindings
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- roles
|
||||
- clusterroles
|
||||
- rolebindings
|
||||
- clusterrolebindings
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- kyverno.io
|
||||
resources:
|
||||
- policies
|
||||
- policies/status
|
||||
- clusterpolicies
|
||||
- clusterpolicies/status
|
||||
- updaterequests
|
||||
- updaterequests/status
|
||||
- globalcontextentries
|
||||
- globalcontextentries/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- kyverno.io
|
||||
resources:
|
||||
- policyexceptions
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- policies.kyverno.io
|
||||
resources:
|
||||
- validatingpolicies
|
||||
- validatingpolicies/status
|
||||
- namespacedvalidatingpolicies
|
||||
- namespacedvalidatingpolicies/status
|
||||
- imagevalidatingpolicies
|
||||
- imagevalidatingpolicies/status
|
||||
- namespacedimagevalidatingpolicies
|
||||
- namespacedimagevalidatingpolicies/status
|
||||
- generatingpolicies
|
||||
- generatingpolicies/status
|
||||
- namespacedgeneratingpolicies
|
||||
- namespacedgeneratingpolicies/status
|
||||
- mutatingpolicies
|
||||
- mutatingpolicies/status
|
||||
- namespacedmutatingpolicies
|
||||
- namespacedmutatingpolicies/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- policies.kyverno.io
|
||||
resources:
|
||||
- policyexceptions
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- reports.kyverno.io
|
||||
resources:
|
||||
- ephemeralreports
|
||||
- clusterephemeralreports
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- wgpolicyk8s.io
|
||||
resources:
|
||||
- policyreports
|
||||
- policyreports/status
|
||||
- clusterpolicyreports
|
||||
- clusterpolicyreports/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- ''
|
||||
- events.k8s.io
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- update
|
||||
- patch
|
||||
- apiGroups:
|
||||
- authorization.k8s.io
|
||||
resources:
|
||||
- subjectaccessreviews
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- configmaps
|
||||
- namespaces
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- update
|
||||
- patch
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- with .Values.admissionController.rbac.coreClusterRole.extraResources }}
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.rbac.clusterRole.extraResources }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" $ }}:additional
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" $ | nindent 4 }}
|
||||
rules:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,33 @@
|
||||
{{- if .Values.admissionController.rbac.create -}}
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
{{- if .Values.admissionController.rbac.createViewRoleBinding }}
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}:view
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ .Values.admissionController.rbac.viewRoleName }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- if or .Values.admissionController.caCertificates.data .Values.global.caCertificates.data }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "kyverno.admission-controller.caCertificatesConfigMapName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
data:
|
||||
ca-certificates: |
|
||||
{{ .Values.admissionController.caCertificates.data | default .Values.global.caCertificates.data | indent 4 | trim }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,367 @@
|
||||
{{- if not .Values.global.templating.debug -}}
|
||||
{{- $automountSAToken := .Values.admissionController.rbac.serviceAccount.automountServiceAccountToken }}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
{{- with .Values.admissionController.labels }}
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.annotations }}
|
||||
annotations:
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if not .Values.admissionController.autoscaling.enabled }}
|
||||
replicas: {{ template "kyverno.deployment.replicas" .Values.admissionController.replicas }}
|
||||
{{- end }}
|
||||
revisionHistoryLimit: {{ .Values.admissionController.revisionHistoryLimit }}
|
||||
{{- 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 }}
|
||||
{{- with .Values.admissionController.podLabels }}
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.podAnnotations }}
|
||||
annotations: {{ tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.admissionController.imagePullSecrets | default .Values.global.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- tpl (include "kyverno.sortedImagePullSecrets" .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.nodeSelector | default .Values.global.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.tolerations | default .Values.global.tolerations}}
|
||||
tolerations:
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.priorityClassName | default .Values.global.priorityClassName }}
|
||||
priorityClassName: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.hostNetwork }}
|
||||
hostNetwork: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.dnsPolicy }}
|
||||
dnsPolicy: {{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.dnsConfig }}
|
||||
dnsConfig:
|
||||
{{- tpl (toYaml .) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.admissionController.antiAffinity.enabled .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" . }}
|
||||
automountServiceAccountToken: {{ $automountSAToken }}
|
||||
initContainers:
|
||||
{{- with .Values.admissionController.extraInitContainers }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if and .Values.reportsServer.enabled .Values.reportsServer.waitForReady }}
|
||||
{{- include "kyverno.reportsServer.initContainer" . | nindent 8 }}
|
||||
{{- end }}
|
||||
- name: kyverno-pre
|
||||
image: {{ include "kyverno.image" (dict "globalRegistry" .Values.global.image.registry "image" .Values.admissionController.initContainer.image "defaultTag" (default .Chart.AppVersion .Values.admissionController.initContainer.image.tag)) | quote }}
|
||||
imagePullPolicy: {{ default .Values.admissionController.container.image.pullPolicy .Values.admissionController.initContainer.image.pullPolicy }}
|
||||
args:
|
||||
{{- include "kyverno.features.flags" (pick (mergeOverwrite (deepCopy .Values.features) .Values.admissionController.featuresOverride)
|
||||
"logging"
|
||||
) | nindent 12 }}
|
||||
- --openreportsEnabled={{ .Values.openreports.enabled }}
|
||||
{{- range $key, $value := .Values.admissionController.initContainer.extraArgs }}
|
||||
{{- if $value }}
|
||||
- --{{ $key }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.initContainer.resources }}
|
||||
resources:
|
||||
{{- tpl (toYaml .) $ | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.initContainer.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: KYVERNO_SERVICEACCOUNT_NAME
|
||||
value: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
||||
- name: KYVERNO_ROLE_NAME
|
||||
value: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
- 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_DEPLOYMENT
|
||||
value: {{ template "kyverno.admission-controller.name" . }}
|
||||
- name: KYVERNO_SVC
|
||||
value: {{ template "kyverno.admission-controller.serviceName" . }}
|
||||
{{- with (concat .Values.global.extraEnvVars .Values.admissionController.initContainer.extraEnvVars) }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if not $automountSAToken }}
|
||||
volumeMounts:
|
||||
- name: serviceaccount-token
|
||||
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
containers:
|
||||
{{- with .Values.admissionController.extraContainers }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
- name: kyverno
|
||||
image: {{ include "kyverno.image" (dict "globalRegistry" .Values.global.image.registry "image" .Values.admissionController.container.image "defaultTag" .Chart.AppVersion) | quote }}
|
||||
imagePullPolicy: {{ .Values.admissionController.container.image.pullPolicy }}
|
||||
args:
|
||||
- --caSecretName={{ template "kyverno.admission-controller.serviceName" . }}.{{ template "kyverno.namespace" . }}.svc.kyverno-tls-ca
|
||||
- --tlsSecretName={{ template "kyverno.admission-controller.serviceName" . }}.{{ template "kyverno.namespace" . }}.svc.kyverno-tls-pair
|
||||
- --tlsKeyAlgorithm={{ .Values.admissionController.tlsKeyAlgorithm | default "RSA" }}
|
||||
{{- if .Values.admissionController.certManager.enabled }}
|
||||
- --disableCertManagerController=true
|
||||
{{- end }}
|
||||
{{- if .Values.backgroundController.enabled }}
|
||||
- --backgroundServiceAccountName=system:serviceaccount:{{ include "kyverno.namespace" . }}:{{ include "kyverno.background-controller.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.reportsController.enabled }}
|
||||
- --reportsServiceAccountName=system:serviceaccount:{{ include "kyverno.namespace" . }}:{{ include "kyverno.reports-controller.serviceAccountName" . }}
|
||||
{{- end }}
|
||||
- --servicePort={{ .Values.admissionController.service.port }}
|
||||
- --webhookServerPort={{ .Values.admissionController.webhookServer.port }}
|
||||
- --resyncPeriod={{ .Values.admissionController.resyncPeriod | default .Values.global.resyncPeriod }}
|
||||
- --crdWatcher={{ .Values.admissionController.crdWatcher | default .Values.global.crdWatcher }}
|
||||
{{- if .Values.admissionController.tracing.enabled }}
|
||||
- --enableTracing
|
||||
- --tracingAddress={{ .Values.admissionController.tracing.address }}
|
||||
- --tracingPort={{ .Values.admissionController.tracing.port }}
|
||||
{{- with .Values.admissionController.tracing.creds }}
|
||||
- --tracingCreds={{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- --disableMetrics={{ .Values.admissionController.metering.disabled }}
|
||||
{{- if not .Values.admissionController.metering.disabled }}
|
||||
- --otelConfig={{ .Values.admissionController.metering.config }}
|
||||
- --metricsPort={{ .Values.admissionController.metering.port }}
|
||||
{{- if .Values.admissionController.metering.secure }}
|
||||
- --metricsCASecretName={{ template "kyverno.admission-controller.name" . }}.{{ template "kyverno.namespace" . }}.metering.kyverno-tls-ca
|
||||
- --metricsTLSSecretName={{ template "kyverno.admission-controller.name" . }}.{{ template "kyverno.namespace" . }}.metering.kyverno-tls-pair
|
||||
- --metricsKeyAlgorithm={{ .Values.admissionController.metering.tlsKeyAlgorithm | default "RSA" }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.metering.collector }}
|
||||
- --otelCollector={{ . }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.metering.creds }}
|
||||
- --transportCreds={{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or .Values.imagePullSecrets .Values.existingImagePullSecrets }}
|
||||
- --imagePullSecrets={{- $secretNames := concat (keys .Values.imagePullSecrets | sortAlpha) (.Values.existingImagePullSecrets | sortAlpha) -}}
|
||||
{{- join "," $secretNames -}}
|
||||
{{- end }}
|
||||
{{- include "kyverno.features.flags" (pick (mergeOverwrite (deepCopy .Values.features) .Values.admissionController.featuresOverride)
|
||||
"admissionReports"
|
||||
"autoUpdateWebhooks"
|
||||
"configMapCaching"
|
||||
"controllerRuntimeMetrics"
|
||||
"deferredLoading"
|
||||
"dumpPayload"
|
||||
"excludeBootstrapResources"
|
||||
"forceFailurePolicyIgnore"
|
||||
"generateValidatingAdmissionPolicy"
|
||||
"generateMutatingAdmissionPolicy"
|
||||
"dumpPatches"
|
||||
"globalContext"
|
||||
"logging"
|
||||
"omitEvents"
|
||||
"policyExceptions"
|
||||
"protectManagedResources"
|
||||
"registryClient"
|
||||
"reporting"
|
||||
"tuf"
|
||||
) | nindent 12 }}
|
||||
{{- range $key, $value := .Values.admissionController.container.extraArgs }}
|
||||
{{- if $value }}
|
||||
- --{{ $key }}={{ $value }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{ if .Values.admissionController.profiling.enabled }}
|
||||
- --profile=true
|
||||
- --profilePort={{ .Values.admissionController.profiling.port }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.container.resources }}
|
||||
resources:
|
||||
{{- tpl (toYaml .) $ | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.container.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.admissionController.webhookServer.port }}
|
||||
name: https
|
||||
protocol: TCP
|
||||
- containerPort: {{ .Values.admissionController.metering.port }}
|
||||
name: metrics-port
|
||||
protocol: TCP
|
||||
{{ if .Values.admissionController.profiling.enabled }}
|
||||
- containerPort: {{ .Values.admissionController.profiling.port }}
|
||||
name: profiling-port
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
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_ROLE_NAME
|
||||
value: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
- name: KYVERNO_SVC
|
||||
value: {{ template "kyverno.admission-controller.serviceName" . }}
|
||||
- name: TUF_ROOT
|
||||
value: {{ .Values.admissionController.tufRootMountPath }}
|
||||
{{- with (concat .Values.global.extraEnvVars .Values.admissionController.container.extraEnvVars) }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
- name: KYVERNO_DEPLOYMENT
|
||||
value: {{ template "kyverno.admission-controller.name" . }}
|
||||
{{- 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 }}
|
||||
{{- with .Values.admissionController.container.lifecycle }}
|
||||
lifecycle:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: {{ .Values.admissionController.tufRootMountPath }}
|
||||
name: sigstore
|
||||
{{- if or .Values.admissionController.caCertificates.data .Values.global.caCertificates.data .Values.admissionController.caCertificates.volume .Values.global.caCertificates.volume }}
|
||||
- name: ca-certificates
|
||||
mountPath: /etc/ssl/certs/ca-certificates.crt
|
||||
{{- if or .Values.admissionController.caCertificates.data .Values.global.caCertificates.data }}
|
||||
subPath: ca-certificates.crt
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: apicall-token
|
||||
mountPath: /var/run/secrets/kyverno/apicall
|
||||
readOnly: true
|
||||
{{- if not $automountSAToken }}
|
||||
- name: serviceaccount-token
|
||||
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.extraVolumeMounts }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: sigstore
|
||||
{{- toYaml (required "A valid .Values.admissionController.sigstoreVolume entry is required" .Values.admissionController.sigstoreVolume) | nindent 8 }}
|
||||
{{- if or .Values.admissionController.caCertificates.data .Values.global.caCertificates.data }}
|
||||
- name: ca-certificates
|
||||
configMap:
|
||||
name: {{ include "kyverno.admission-controller.caCertificatesConfigMapName" . }}
|
||||
items:
|
||||
- key: ca-certificates
|
||||
path: ca-certificates.crt
|
||||
{{- else if or .Values.admissionController.caCertificates.volume .Values.global.caCertificates.volume }}
|
||||
{{- with (.Values.admissionController.caCertificates.volume | default .Values.global.caCertificates.volume) }}
|
||||
- name: ca-certificates
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- name: apicall-token
|
||||
projected:
|
||||
defaultMode: 0444
|
||||
sources:
|
||||
- serviceAccountToken:
|
||||
path: token
|
||||
expirationSeconds: {{ .Values.apiCallToken.expirationSeconds | default 3600 }}
|
||||
{{- with .Values.apiCallToken.audience }}
|
||||
audience: {{ . }}
|
||||
{{- end }}
|
||||
{{- if not $automountSAToken }}
|
||||
- name: serviceaccount-token
|
||||
projected:
|
||||
defaultMode: 0444
|
||||
sources:
|
||||
- serviceAccountToken:
|
||||
expirationSeconds: {{ .Values.admissionController.rbac.serviceAccount.projectedServiceAccountToken.expirationSeconds | default 3600 }}
|
||||
path: token
|
||||
{{- with .Values.admissionController.rbac.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 }}
|
||||
{{- with .Values.admissionController.extraVolumes }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,228 @@
|
||||
{{- if .Values.admissionController.apiPriorityAndFairness }}
|
||||
apiVersion: {{ template "kyverno.flowcontrol.apiVersion" . }}
|
||||
kind: FlowSchema
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
priorityLevelConfiguration:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
rules:
|
||||
- resourceRules:
|
||||
- apiGroups:
|
||||
- admissionregistration.k8s.io
|
||||
clusterScope: true
|
||||
namespaces: []
|
||||
resources:
|
||||
- mutatingwebhookconfigurations
|
||||
- validatingwebhookconfigurations
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
clusterScope: true
|
||||
namespaces: []
|
||||
resources:
|
||||
- clusterroles
|
||||
- clusterrolebindings
|
||||
verbs:
|
||||
- watch
|
||||
- list
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
namespaces:
|
||||
- '*'
|
||||
resources:
|
||||
- roles
|
||||
- rolebindings
|
||||
verbs:
|
||||
- watch
|
||||
- list
|
||||
- apiGroups:
|
||||
- kyverno.io
|
||||
clusterScope: true
|
||||
namespaces: []
|
||||
resources:
|
||||
- clusterpolicies
|
||||
- clusterpolicies/status
|
||||
- globalcontextentries
|
||||
- globalcontextentries/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- kyverno.io
|
||||
namespaces:
|
||||
- '*'
|
||||
resources:
|
||||
- policies
|
||||
- policies/status
|
||||
- updaterequests
|
||||
- updaterequests/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- reports.kyverno.io
|
||||
clusterScope: true
|
||||
namespaces: []
|
||||
resources:
|
||||
- clusterephemeralreports
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- reports.kyverno.io
|
||||
namespaces:
|
||||
- '*'
|
||||
resources:
|
||||
- ephemeralreports
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- wgpolicyk8s.io
|
||||
clusterScope: true
|
||||
namespaces: []
|
||||
resources:
|
||||
- clusterpolicyreports
|
||||
- clusterpolicyreports/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- wgpolicyk8s.io
|
||||
namespaces:
|
||||
- '*'
|
||||
resources:
|
||||
- policyreports
|
||||
- policyreports/status
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- ""
|
||||
- events.k8s.io
|
||||
namespaces:
|
||||
- '*'
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- update
|
||||
- patch
|
||||
- apiGroups:
|
||||
- authorization.k8s.io
|
||||
clusterScope: true
|
||||
namespaces: []
|
||||
resources:
|
||||
- subjectaccessreviews
|
||||
verbs:
|
||||
- create
|
||||
- apiGroups:
|
||||
- '*'
|
||||
namespaces:
|
||||
- '*'
|
||||
resources:
|
||||
- '*'
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ''
|
||||
namespaces:
|
||||
- {{ template "kyverno.namespace" . }}
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- apiGroups:
|
||||
- ''
|
||||
namespaces:
|
||||
- {{ template "kyverno.namespace" . }}
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
namespaces:
|
||||
- {{ template "kyverno.namespace" . }}
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- apps
|
||||
namespaces:
|
||||
- {{ template "kyverno.namespace" . }}
|
||||
resources:
|
||||
- deployments
|
||||
- deployments/scale
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- patch
|
||||
- update
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
serviceAccount:
|
||||
name: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
{{- end }}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
{{- if .Values.admissionController.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
minReplicas: {{ .Values.admissionController.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.admissionController.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.admissionController.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- resource:
|
||||
name: cpu
|
||||
target:
|
||||
averageUtilization: {{ .Values.admissionController.autoscaling.targetCPUUtilizationPercentage }}
|
||||
type: Utilization
|
||||
type: Resource
|
||||
{{- end }}
|
||||
{{- if .Values.admissionController.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- resource:
|
||||
name: memory
|
||||
target:
|
||||
averageUtilization: {{ .Values.admissionController.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
type: Utilization
|
||||
type: Resource
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.autoscaling.behavior }}
|
||||
behavior:
|
||||
{{- tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,31 @@
|
||||
{{- if .Values.admissionController.networkPolicy.enabled -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 6 }}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
{{- if .Values.admissionController.networkPolicy.ingressFrom }}
|
||||
ingress:
|
||||
- from:
|
||||
{{- toYaml .Values.admissionController.networkPolicy.ingressFrom | nindent 8 }}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9443 # webhook access
|
||||
# Allow prometheus scrapes for metrics
|
||||
{{- if .Values.admissionController.metricsService.create }}
|
||||
- protocol: TCP
|
||||
port: {{ .Values.admissionController.metricsService.port }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
ingress:
|
||||
- {}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if or .Values.admissionController.podDisruptionBudget.enabled (gt (int .Values.admissionController.replicas) 1) -}}
|
||||
apiVersion: {{ template "kyverno.pdb.apiVersion" . }}
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- include "kyverno.pdb.spec" .Values.admissionController.podDisruptionBudget | nindent 2 }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 6 }}
|
||||
{{- end -}}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.admissionController.apiPriorityAndFairness }}
|
||||
apiVersion: {{ template "kyverno.flowcontrol.apiVersion" . }}
|
||||
kind: PriorityLevelConfiguration
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
{{- with .Values.admissionController.priorityLevelConfigurationSpec }}
|
||||
spec:
|
||||
{{- tpl (toYaml .) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,64 @@
|
||||
{{- if .Values.admissionController.rbac.create -}}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- secrets
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- patch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
resourceNames:
|
||||
- {{ include "kyverno.config.configMapName" . }}
|
||||
- {{ include "kyverno.config.metricsConfigMapName" . }}
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
# Allow update of Kyverno deployment annotations
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
{{- if .Values.webhooksCleanup.enabled }}
|
||||
{{- if not .Values.global.templating.enabled }}
|
||||
- deployments/scale
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- if .Values.webhooksCleanup.enabled }}
|
||||
{{- if not .Values.global.templating.enabled }}
|
||||
- patch
|
||||
- update
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.admissionController.rbac.create -}}
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kyverno.admission-controller.roleName" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if .Values.admissionController.createSelfSignedCert -}}
|
||||
{{- $ca := genCA (printf "*.%s.svc" (include "kyverno.namespace" .)) 1024 -}}
|
||||
{{- $svcName := (printf "%s.%s.svc" (include "kyverno.admission-controller.serviceName" .) (include "kyverno.namespace" .)) -}}
|
||||
{{- $cert := genSignedCert $svcName nil (list $svcName) 1024 $ca -}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.serviceName" . }}.{{ template "kyverno.namespace" . }}.svc.kyverno-tls-ca
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.key: {{ $ca.Key | b64enc }}
|
||||
tls.crt: {{ $ca.Cert | b64enc }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.serviceName" . }}.{{ template "kyverno.namespace" . }}.svc.kyverno-tls-pair
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
self-signed-cert: "true"
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.key: {{ $cert.Key | b64enc }}
|
||||
tls.crt: {{ $cert.Cert | b64enc }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,77 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.serviceName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
{{- with .Values.admissionController.service.annotations }}
|
||||
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .Values.admissionController.service.port }}
|
||||
targetPort: https
|
||||
protocol: TCP
|
||||
name: https
|
||||
appProtocol: https
|
||||
{{- if and (eq .Values.admissionController.service.type "NodePort") (not (empty .Values.admissionController.service.nodePort)) }}
|
||||
nodePort: {{ .Values.admissionController.service.nodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 4 }}
|
||||
type: {{ .Values.admissionController.service.type }}
|
||||
{{- if .Values.admissionController.service.trafficDistribution }}
|
||||
trafficDistribution: {{ .Values.admissionController.service.trafficDistribution }}
|
||||
{{- end }}
|
||||
{{- if .Values.admissionController.metricsService.create }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.serviceName" . }}-metrics
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
{{- with .Values.admissionController.metricsService.annotations }}
|
||||
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .Values.admissionController.metricsService.port }}
|
||||
targetPort: {{ .Values.admissionController.metering.port }}
|
||||
protocol: TCP
|
||||
name: metrics-port
|
||||
{{- if and (eq .Values.admissionController.metricsService.type "NodePort") (not (empty .Values.admissionController.metricsService.nodePort)) }}
|
||||
nodePort: {{ .Values.admissionController.metricsService.nodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 4 }}
|
||||
type: {{ .Values.admissionController.metricsService.type }}
|
||||
{{- if .Values.admissionController.metricsService.trafficDistribution }}
|
||||
trafficDistribution: {{ .Values.admissionController.metricsService.trafficDistribution }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
{{- if .Values.admissionController.profiling.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.serviceName" . }}-profiling
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .Values.admissionController.profiling.port }}
|
||||
targetPort: {{ .Values.admissionController.profiling.port }}
|
||||
protocol: TCP
|
||||
name: profiling-port
|
||||
{{- if and (eq .Values.admissionController.profiling.serviceType "NodePort") (not (empty .Values.admissionController.profiling.nodePort)) }}
|
||||
nodePort: {{ .Values.admissionController.profiling.nodePort }}
|
||||
{{- end }}
|
||||
selector:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 4 }}
|
||||
type: {{ .Values.admissionController.profiling.serviceType }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.admissionController.rbac.create }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.serviceAccountName" . }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
{{- with .Values.admissionController.rbac.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: false
|
||||
{{- end }}
|
||||
@@ -0,0 +1,44 @@
|
||||
{{- if .Values.admissionController.serviceMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: {{ template "kyverno.admission-controller.name" . }}
|
||||
{{- if .Values.admissionController.serviceMonitor.namespace }}
|
||||
namespace: {{ .Values.admissionController.serviceMonitor.namespace }}
|
||||
{{- else }}
|
||||
namespace: {{ template "kyverno.namespace" . }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.serviceMonitor.additionalAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "kyverno.admission-controller.labels" . | nindent 4 }}
|
||||
{{- with .Values.admissionController.serviceMonitor.additionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "kyverno.admission-controller.matchLabels" . | nindent 6 }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ template "kyverno.namespace" . }}
|
||||
endpoints:
|
||||
- port: metrics-port
|
||||
interval: {{ .Values.admissionController.serviceMonitor.interval }}
|
||||
scrapeTimeout: {{ .Values.admissionController.serviceMonitor.scrapeTimeout }}
|
||||
{{- if .Values.admissionController.serviceMonitor.secure }}
|
||||
scheme: https
|
||||
tlsConfig:
|
||||
{{- toYaml .Values.admissionController.serviceMonitor.tlsConfig | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.serviceMonitor.relabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.admissionController.serviceMonitor.metricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user