diff --git a/charts/apps/k8s-ycl/Chart.yaml b/charts/apps/k8s-ycl/Chart.yaml index 380ca0de..90fb6930 100644 --- a/charts/apps/k8s-ycl/Chart.yaml +++ b/charts/apps/k8s-ycl/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: Kubernetes admission controller to remove CPU limits from Pods. name: k8s-ycl -version: 0.1.0 +version: 0.2.0 appVersion: v0.1.0 kubeVersion: ">=1.22.0-0" sources: @@ -22,9 +22,12 @@ dependencies: version: 1.5.1 annotations: artifacthub.io/changes: |- - - kind: changed + - kind: added description: | - Initial version + Make ignored namespaces configurable + - kind: added + description: | + Added metrics port to Service artifacthub.io/links: | - name: "source" url: "https://github.com/bjw-s/k8s-ycl" diff --git a/charts/apps/k8s-ycl/templates/_helpers.tpl b/charts/apps/k8s-ycl/templates/_helpers.tpl index aec821a4..9e1af1a5 100644 --- a/charts/apps/k8s-ycl/templates/_helpers.tpl +++ b/charts/apps/k8s-ycl/templates/_helpers.tpl @@ -6,6 +6,20 @@ /mutate--v1-pod {{- end -}} +{{- define "k8s-ycl.ignoredNamespaces" -}} + {{- $ownNamespace := $.Release.Namespace -}} + {{- $ignoredNamespaces := list -}} + {{- if $.Values.webhook.ignoreOwnNamespace -}} + {{- $ignoredNamespaces = append $ignoredNamespaces $ownNamespace -}} + {{- end -}} + {{- with $.Values.webhook.ignoredNamespaces -}} + {{- range . -}} + {{- $ignoredNamespaces = append $ignoredNamespaces . -}} + {{- end -}} + {{- end -}} + {{- $ignoredNamespaces | uniq | toYaml -}} +{{- end -}} + {{- define "k8s-ycl.selfSignedIssuer" -}} {{ printf "%s-webhook-selfsign" (include "bjw-s.common.lib.chart.names.fullname" .) }} {{- end -}} diff --git a/charts/apps/k8s-ycl/templates/admissionregistration.yaml b/charts/apps/k8s-ycl/templates/admissionregistration.yaml index b22819d1..6b18b355 100644 --- a/charts/apps/k8s-ycl/templates/admissionregistration.yaml +++ b/charts/apps/k8s-ycl/templates/admissionregistration.yaml @@ -15,9 +15,7 @@ webhooks: matchExpressions: - key: kubernetes.io/metadata.name operator: NotIn - values: - - kube-system - - {{ .Release.Namespace | quote }} + values: {{ include "k8s-ycl.ignoredNamespaces" . | nindent 10 }} clientConfig: service: namespace: {{ .Release.Namespace | quote }} diff --git a/charts/apps/k8s-ycl/templates/common.yaml b/charts/apps/k8s-ycl/templates/common.yaml index bbcc37c6..931d9849 100644 --- a/charts/apps/k8s-ycl/templates/common.yaml +++ b/charts/apps/k8s-ycl/templates/common.yaml @@ -12,6 +12,9 @@ service: http: enabled: true port: 9443 + metrics: + enabled: true + port: 8080 probe: enabled: true port: 8081 diff --git a/charts/apps/k8s-ycl/values.yaml b/charts/apps/k8s-ycl/values.yaml index fbd7b3ed..d8f9a8ab 100644 --- a/charts/apps/k8s-ycl/values.yaml +++ b/charts/apps/k8s-ycl/values.yaml @@ -8,3 +8,7 @@ image: webhook: path: /mutate--v1-pod + + ignoreOwnNamespace: true + ignoredNamespaces: + - kube-system