Skip to content

Commit

Permalink
refactor: Unify cert-manager annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Dmytro Kovalenko <zerodayyy@zerodayyy.xyz>
  • Loading branch information
Dmytro Kovalenko committed Jan 24, 2024
1 parent ec01f01 commit 8acf125
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
8 changes: 3 additions & 5 deletions keda/templates/metrics-server/apiservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ metadata:
{{- if or .Values.certificates.certManager.enabled .Values.additionalAnnotations }}
annotations:
{{- if .Values.certificates.certManager.enabled }}
{{- if .Values.certificates.certManager.generateCA }}
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.operator.name }}-ca
{{- else if not .Values.certificates.certManager.issuer.generate }}
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.operator.name }}-tls-certificates
{{- else }}
{{- if and (not .Values.certificates.certManager.generateCA) .Values.certificates.certManager.issuer.generate }}
cert-manager.io/inject-ca-from-secret: {{ .Release.Namespace }}/{{ .Values.certificates.certManager.caSecretName }}
{{- else }}
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.operator.name }}-tls-certificates
{{- end }}
{{- end }}
{{- if .Values.additionalAnnotations }}
Expand Down
8 changes: 3 additions & 5 deletions keda/templates/webhooks/validatingconfiguration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ metadata:
{{- if or .Values.certificates.certManager.enabled .Values.additionalAnnotations }}
annotations:
{{- if .Values.certificates.certManager.enabled }}
{{- if .Values.certificates.certManager.generateCA }}
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.operator.name }}-ca
{{- else if not .Values.certificates.certManager.issuer.generate }}
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.operator.name }}-tls-certificates
{{- else }}
{{- if and (not .Values.certificates.certManager.generateCA) .Values.certificates.certManager.issuer.generate }}
cert-manager.io/inject-ca-from-secret: {{ .Release.Namespace }}/{{ .Values.certificates.certManager.caSecretName }}
{{- else }}
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.operator.name }}-tls-certificates
{{- end }}
{{- end }}
{{- if .Values.additionalAnnotations }}
Expand Down
20 changes: 10 additions & 10 deletions keda/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -736,16 +736,6 @@ certificates:
# If generateCA is false, the secret with the CA
# has to be annotated with `cert-manager.io/allow-direct-injection: "true"`
generateCA: true
# -- Reference to custom Issuer.
issuer:
# -- Generates an Issuer resource with Cert-manager
generate: true
# -- Custom Issuer name. Required when generate: false
name: foo-org-ca
# -- Custom Issuer kind. Required when generate: false
kind: ClusterIssuer
# -- Custom Issuer group. Required when generate: false
group: cert-manager.io
# -- Secret name where the CA is stored (generatedby cert-manager or user given)
caSecretName: "kedaorg-ca"
# -- Add labels/annotations to secrets created by Certificate resources
Expand All @@ -756,6 +746,16 @@ certificates:
# my-secret-annotation-2: "bar"
# labels:
# my-secret-label: foo
# -- Reference to custom Issuer.
issuer:
# -- Generates an Issuer resource with Cert-manager
generate: true
# -- Custom Issuer name. Required when generate: false
name: foo-org-ca
# -- Custom Issuer kind. Required when generate: false
kind: ClusterIssuer
# -- Custom Issuer group. Required when generate: false
group: cert-manager.io

permissions:
metricServer:
Expand Down

0 comments on commit 8acf125

Please sign in to comment.