1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-30 19:35:06 +00:00
kyverno/charts/kyverno/templates/cleanup-controller/secret.yaml
Charles-Edouard Brétéché 86fc537ce0
feat: add cleanup controller to helm chart (#5329)
* feat: add cleanup controller to helm chart

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* add webhook config

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* rbac

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fixes

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* secret

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>

* certs

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix labels

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* add server

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* rbac

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* handler

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix linter

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-14 18:30:12 +01:00

62 lines
1.9 KiB
YAML

{{- if .Values.cleanupController.enabled -}}
{{- $ca := genCA (printf "*.%s.svc" (include "kyverno.namespace" .)) 1024 -}}
{{- $svcName := (printf "%s.%s.svc" (include "kyverno.cleanup-controller.deploymentName" .) (include "kyverno.namespace" .)) -}}
{{- $cert := genSignedCert $svcName nil (list $svcName) 1024 $ca -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "kyverno.cleanup-controller.deploymentName" . }}-ca
labels:
{{- include "kyverno.cleanup-controller.labels" . | nindent 4 }}
namespace: {{ template "kyverno.namespace" . }}
type: kubernetes.io/tls
data:
tls.key: {{ $ca.Key | b64enc }}
tls.crt: {{ $ca.Cert | b64enc }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ template "kyverno.cleanup-controller.deploymentName" . }}-tls
labels:
{{- include "kyverno.cleanup-controller.labels" . | nindent 4 }}
namespace: {{ template "kyverno.namespace" . }}
type: kubernetes.io/tls
data:
tls.key: {{ $cert.Key | b64enc }}
tls.crt: {{ $cert.Cert | b64enc }}
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: {{ template "kyverno.cleanup-controller.deploymentName" . }}
labels:
{{- include "kyverno.cleanup-controller.labels" . | nindent 4 }}
webhooks:
- admissionReviewVersions:
- v1beta1
clientConfig:
caBundle: {{ $ca.Cert | b64enc }}
service:
name: {{ template "kyverno.cleanup-controller.deploymentName" . }}
namespace: {{ template "kyverno.namespace" . }}
path: /todo
port: 443
failurePolicy: Fail
matchPolicy: Equivalent
name: {{ printf "%s.%s.svc" (include "kyverno.cleanup-controller.deploymentName" .) (include "kyverno.namespace" .) }}
rules:
- apiGroups:
- kyverno.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- clustercleanuppolicies/*
- cleanuppolicies/*
scope: '*'
sideEffects: None
timeoutSeconds: 10
{{- end -}}