Skip to content

Commit

Permalink
[kube-prometheus-stack] allow setting annotations for admission webho…
Browse files Browse the repository at this point in the history
…oks (#4748)

Co-authored-by: Jan-Otto Kröpke <github@jkroepke.de>
  • Loading branch information
DrFaust92 and jkroepke authored Jul 28, 2024
1 parent 0194431 commit 815d9f7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 61.4.0
version: 61.5.0
appVersion: v0.75.2
kubeVersion: ">=1.19.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
prometheusOperator:
admissionWebhooks:
validatingWebhookConfiguration:
annotations:
test: test1
test2: test3
deployment:
enabled: true
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
app.kubernetes.io/name: {{ template "kube-prometheus-stack.name" . }}-prometheus-operator
app.kubernetes.io/component: prometheus-operator-webhook
{{- end }}

{{- define "kube-prometheus-stack.prometheus-operator-webhook.annotations" }}
{{- if .Values.prometheusOperator.admissionWebhooks.certManager.enabled }}
certmanager.k8s.io/inject-ca-from: {{ printf "%s/%s-admission" (include "kube-prometheus-stack.namespace" .) (include "kube-prometheus-stack.fullname" .) | quote }}
cert-manager.io/inject-ca-from: {{ printf "%s/%s-admission" (include "kube-prometheus-stack.namespace" .) (include "kube-prometheus-stack.fullname" .) | quote }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: {{ template "kube-prometheus-stack.fullname" . }}-admission
{{- if .Values.prometheusOperator.admissionWebhooks.certManager.enabled }}
annotations:
certmanager.k8s.io/inject-ca-from: {{ printf "%s/%s-admission" (include "kube-prometheus-stack.namespace" .) (include "kube-prometheus-stack.fullname" .) | quote }}
cert-manager.io/inject-ca-from: {{ printf "%s/%s-admission" (include "kube-prometheus-stack.namespace" .) (include "kube-prometheus-stack.fullname" .) | quote }}
{{- end }}
{{- include "kube-prometheus-stack.prometheus-operator-webhook.annotations" $ | trim |nindent 4 }}
{{- with .Values.prometheusOperator.admissionWebhooks.mutatingWebhookConfiguration.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
labels:
app: {{ template "kube-prometheus-stack.name" $ }}-admission
{{- include "kube-prometheus-stack.prometheus-operator-webhook.labels" $ | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: {{ template "kube-prometheus-stack.fullname" . }}-admission
{{- if .Values.prometheusOperator.admissionWebhooks.certManager.enabled }}
annotations:
certmanager.k8s.io/inject-ca-from: {{ printf "%s/%s-admission" (include "kube-prometheus-stack.namespace" .) (include "kube-prometheus-stack.fullname" .) | quote }}
cert-manager.io/inject-ca-from: {{ printf "%s/%s-admission" (include "kube-prometheus-stack.namespace" .) (include "kube-prometheus-stack.fullname" .) | quote }}
{{- end }}
{{- include "kube-prometheus-stack.prometheus-operator-webhook.annotations" $ | trim | nindent 4 }}
{{- with .Values.prometheusOperator.admissionWebhooks.validatingWebhookConfiguration.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
labels:
app: {{ template "kube-prometheus-stack.name" $ }}-admission
{{- include "kube-prometheus-stack.prometheus-operator-webhook.labels" $ | nindent 4 }}
Expand Down
7 changes: 7 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,13 @@ prometheusOperator:
namespaceSelector: {}
objectSelector: {}

mutatingWebhookConfiguration:
annotations: {}
# argocd.argoproj.io/hook: PreSync

validatingWebhookConfiguration:
annotations: {}
# argocd.argoproj.io/hook: PreSync

deployment:
enabled: false
Expand Down

0 comments on commit 815d9f7

Please sign in to comment.