Skip to content

Commit

Permalink
Merge pull request #123 from aiyengar2/fix_certificates_secret_name
Browse files Browse the repository at this point in the history
Infer caBundle from .Values.certificates.secretName
  • Loading branch information
jsturtevant authored Oct 17, 2023
2 parents d35d560 + 3cce8ea commit 545c6e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion charts/gmsa/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ apiVersion: cert-manager.io/v1
{{- end }}

{{- define "certificates.cabundle"}}
{{- if gt (len (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "")) 0 -}}
{{- if .Values.certificates.caBundle }}
{{- .Values.certificates.caBundle }}
{{- else if gt (len (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "")) 0 -}}
{{- $secret := (lookup "v1" "Secret" .Release.Namespace .Values.certificates.secretName) -}}
{{- if lt (len $secret) 1 -}}
{{- required (printf "CA Bundle secret '%s' in namespace '%s' must exist" .Values.certificates.secretName .Release.Namespace) "" -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/gmsa/templates/mutatingwebhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ webhooks:
namespace: {{.Release.Namespace}}
path: "/mutate"
{{- if not (.Values.certificates.certManager.enabled) }}
caBundle: {{ .Values.certificates.caBundle }}
caBundle: {{ template "certificates.cabundle" . }}
{{- end }}
rules:
- operations: ["CREATE"]
Expand Down
2 changes: 1 addition & 1 deletion charts/gmsa/templates/validatingwebhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ webhooks:
namespace: {{ .Release.Namespace }}
path: "/validate"
{{- if not (.Values.certificates.certManager.enabled) }}
caBundle: {{ .Values.certificates.caBundle }}
caBundle: {{ template "certificates.cabundle" . }}
{{- end }}
rules:
- operations: ["CREATE", "UPDATE"]
Expand Down

0 comments on commit 545c6e0

Please sign in to comment.