From 783843c7bf53b7dee1ae0778ad61f29e2b95e39b Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Mon, 27 Nov 2023 21:07:38 +0100 Subject: [PATCH] add custom labels Signed-off-by: Hector Fernandez --- charts/policy-controller/Chart.yaml | 2 +- charts/policy-controller/README.md | 1 + .../policy-controller/templates/_helpers.tpl | 5 +++++ .../templates/webhook/deployment_webhook.yaml | 1 + charts/policy-controller/values.schema.json | 20 ++++++++++++++++--- charts/policy-controller/values.yaml | 1 + 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/charts/policy-controller/Chart.yaml b/charts/policy-controller/Chart.yaml index f5b863fa..1728ec75 100644 --- a/charts/policy-controller/Chart.yaml +++ b/charts/policy-controller/Chart.yaml @@ -8,7 +8,7 @@ sources: type: application name: policy-controller -version: 0.6.5 +version: 0.6.6 appVersion: 0.8.2 maintainers: diff --git a/charts/policy-controller/README.md b/charts/policy-controller/README.md index e85a8355..c32d88f1 100644 --- a/charts/policy-controller/README.md +++ b/charts/policy-controller/README.md @@ -66,6 +66,7 @@ The Helm chart for Policy Controller | webhook.serviceAccount.name | string | `""` | | | webhook.volumeMounts | list | `[]` | | | webhook.volumes | list | `[]` | | +| webhook.customLabels | list | `[]` | | | leasescleanup.image.pullPolicy | string | `"IfNotPresent"` | | | leasescleanup.image.repository | string | `"cgr.dev/chainguard/kubectl"` | | | leasescleanup.image.version | string | `"latest-dev"` | `"NOTE: use latest-dev tag because leases cleanup job needs /bin/sh, not present in latest tag"` | diff --git a/charts/policy-controller/templates/_helpers.tpl b/charts/policy-controller/templates/_helpers.tpl index 6ea51793..0e18ec47 100644 --- a/charts/policy-controller/templates/_helpers.tpl +++ b/charts/policy-controller/templates/_helpers.tpl @@ -40,6 +40,11 @@ helm.sh/chart: {{ include "policy-controller.chart" . }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.webhook.customLabels -}} +{{- range $key, $val := .Values.webhook.customLabels }} +{{ $key }}: {{ $val | quote }} +{{- end}} +{{- end }} {{- end }} {{/* diff --git a/charts/policy-controller/templates/webhook/deployment_webhook.yaml b/charts/policy-controller/templates/webhook/deployment_webhook.yaml index 5efbd851..4bf21eeb 100644 --- a/charts/policy-controller/templates/webhook/deployment_webhook.yaml +++ b/charts/policy-controller/templates/webhook/deployment_webhook.yaml @@ -17,6 +17,7 @@ spec: labels: {{- include "policy-controller.selectorLabels" . | nindent 8 }} control-plane: {{ template "policy-controller.fullname" . }}-webhook + {{- include "policy-controller.labels" . | nindent 8 }} spec: nodeSelector: {{- toYaml .Values.commonNodeSelector | nindent 8 }} diff --git a/charts/policy-controller/values.schema.json b/charts/policy-controller/values.schema.json index 3d2c336a..20f859ab 100644 --- a/charts/policy-controller/values.schema.json +++ b/charts/policy-controller/values.schema.json @@ -2,15 +2,15 @@ "$schema": "http://json-schema.org/schema#", "type": "object", "properties": { + "commonAnnotations": { + "type": "object" + }, "commonNodeSelector": { "type": "object" }, "commonTolerations": { "type": "array" }, - "commonAnnotations": { - "type": "object" - }, "cosign": { "type": "object", "properties": { @@ -61,6 +61,9 @@ "configData": { "type": "object" }, + "customLabels": { + "type": "array" + }, "env": { "type": "object" }, @@ -112,6 +115,17 @@ } } }, + "podDisruptionBudget": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "minAvailable": { + "type": "integer" + } + } + }, "podSecurityContext": { "type": "object", "properties": { diff --git a/charts/policy-controller/values.yaml b/charts/policy-controller/values.yaml index b9e8af96..0c8cb554 100644 --- a/charts/policy-controller/values.yaml +++ b/charts/policy-controller/values.yaml @@ -8,6 +8,7 @@ installCRDs: true imagePullSecrets: [] webhook: + customLabels: [] configData: {} replicaCount: 1 name: webhook