File tree Expand file tree Collapse file tree 4 files changed +43
-7
lines changed Expand file tree Collapse file tree 4 files changed +43
-7
lines changed Original file line number Diff line number Diff line change @@ -566,9 +566,17 @@ Returns cert-manager issuer spec for TLS config
566566{ {- $fullname := include " ggbridge.fullname" . -} }
567567{ {- $spec := dict -} }
568568{ {- if hasKey .Values.tls.certManager.issuer.spec " vault" -} }
569- { {- $spec = dict " vault" (dict " auth" (dict " kubernetes" (dict " secretRef" (dict " name" (printf " %s-issuer-token" $fullname ) " key" " token" )))) -} }
569+ { {- $userKubernetesAuth := dig " vault" " auth" " kubernetes" dict .Values.tls.certManager.issuer.spec -} }
570+ { {- $kubernetesAuth := dict -} }
571+
572+ { {/* Only add secretRef if user hasn' t provided secretRef OR serviceAccountRef */}}
573+ {{- if and (not (hasKey $userKubernetesAuth "secretRef")) (not (hasKey $userKubernetesAuth "serviceAccountRef")) -}}
574+ {{- $_ := set $kubernetesAuth "secretRef" (dict "name" (printf "%s-issuer-token" $fullname) "key" "token") -}}
575+ {{- end -}}
576+
577+ {{- $spec = dict "vault" (dict "auth" (dict "kubernetes" $kubernetesAuth)) -}}
570578{{- end -}}
571- { {- $spec = include " ggbridge.tplvalues.merge" ( dict " values" ( list .Values.tls.certManager.issuer.spec $ spec ) " context" . ) | fromYaml -} }
579+ {{- $spec = include "ggbridge.tplvalues.merge" ( dict "values" ( list $spec .Values.tls.certManager.issuer.spec ) "context" . ) | fromYaml -}}
572580{{ include "ggbridge.tplvalues.render" ( dict "value" $spec "context" .) }}
573581{{- end -}}
574582
Original file line number Diff line number Diff line change 1- {{- if .Values.tls.certManager.enabled -}}
2- {{- $fullname := include "ggbridge.fullname" . -}}
3- {{- $namespace := ternary (default .Release.Namespace . Values.server.istio.gateway.namespace) .Release.Namespace .Values.server.istio.enabled -}}
1+ {{- $fullname := include "ggbridge.fullname" . -}}
2+ {{- $namespace := ternary (default .Release.Namespace .Values.server.istio.gateway.namespace) .Release.Namespace .Values.server.istio.enabled -}}
3+ {{- if and . Values.tls.certManager.enabled (not (hasKey .Values.tls.certManager.issuer.spec "vault")) -}}
44 {{- if .Values.tls.certManager.issuer.spec }}
55 {{- if hasKey .Values.tls.certManager.issuer.spec "selfSigned" -}}
66---
6969 {{- end }}
7070 {{- end }}
7171{{- end }}
72+ {{- if hasKey .Values.tls.certManager.issuer.spec "vault" }}
73+ ---
74+ apiVersion : cert-manager.io/v1
75+ kind : Issuer
76+ metadata :
77+ name : {{ printf "%s-issuer" $fullname }}
78+ namespace : {{ $namespace }}
79+ labels :
80+ {{- include "ggbridge.labels" $ | nindent 4 }}
81+ {{- if .Values.commonAnnotations }}
82+ annotations : {{- include "ggbridge.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" . ) | nindent 4 }}
83+ {{- end }}
84+ spec :
85+ {{- include "ggbridge.certManager.issuer.spec" . | nindent 2 }}
86+ {{- end }}
Original file line number Diff line number Diff line change 1- {{- if .Values.tls.certManager.enabled -}}
1+ {{- if and .Values.tls.certManager.enabled (and (not (empty .Values.tls.certManager.issuer.spec)) (not (hasKey .Values.tls.certManager.issuer.spec "vault"))) -}}
22 {{- $fullname := include "ggbridge.fullname" . -}}
33 {{- $namespace := ternary (default .Release.Namespace .Values.server.istio.gateway.namespace) .Release.Namespace .Values.server.istio.enabled -}}
44 {{- $clientFullname := include "ggbridge.client.fullname" $ -}}
Original file line number Diff line number Diff line change @@ -45,7 +45,21 @@ metadata:
4545 annotations :
4646 kubernetes.io/service-account.name : {{ printf "%s-issuer" $fullname }}
4747type : kubernetes.io/service-account-token
48+ ---
49+ apiVersion : rbac.authorization.k8s.io/v1
50+ kind : ClusterRoleBinding
51+ metadata :
52+ name : {{ printf "%s-issuer" $fullname }}-token-reviewer
53+ roleRef :
54+ apiGroup : rbac.authorization.k8s.io
55+ kind : ClusterRole
56+ name : system:auth-delegator
57+ subjects :
58+ - kind : ServiceAccount
59+ name : {{ printf "%s-issuer" $fullname }}
60+ namespace : {{ .Release.Namespace }}
4861 {{- end }}
62+ {{- if .Values.tls.certManager.rbac.subjects }}
4963---
5064apiVersion : rbac.authorization.k8s.io/v1
5165kind : Role
7993 - ' list'
8094 - ' watch'
8195 - ' create'
82- {{- if .Values.tls.certManager.rbac.subjects }}
8396---
8497apiVersion : rbac.authorization.k8s.io/v1
8598kind : RoleBinding
You can’t perform that action at this time.
0 commit comments