Skip to content

Commit 7204ffb

Browse files
committed
feat: allow creating or reusing an existing sa
1 parent 67a524e commit 7204ffb

File tree

7 files changed

+34
-17
lines changed

7 files changed

+34
-17
lines changed

deploy/charts/google-cas-issuer/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This option decides if the CRDs should be installed as part of the Helm installa
1919
> true
2020
> ```
2121
22-
This option makes it so that the "helm.sh/resource-policy": keep annotation is added to the CRD. This will prevent Helm from uninstalling the CRD when the Helm release is uninstalled. WARNING: when the CRDs are removed, all cert-manager custom resources
22+
This option makes it so that the "helm.sh/resource-policy": keep annotation is added to the CRD. This will prevent Helm from uninstalling the CRD when the Helm release is uninstalled. WARNING: when the CRDs are removed, all cert-manager custom resources
2323
(Certificates, Issuers, ...) will be removed too by the garbage collector.
2424
#### **replicaCount** ~ `number`
2525
> Default value:
@@ -151,7 +151,7 @@ Optional additional labels to add to the google-cas-issuer Pods
151151
> {}
152152
> ```
153153
154-
Kubernetes pod resource requests/limits for google-cas-issuer.
154+
Kubernetes pod resource requests/limits for google-cas-issuer.
155155
For example:
156156
157157
```yaml
@@ -168,7 +168,7 @@ requests:
168168
> {}
169169
> ```
170170
171-
Kubernetes node selector: node labels for pod assignment
171+
Kubernetes node selector: node labels for pod assignment
172172
For example:
173173
174174
```yaml
@@ -180,7 +180,7 @@ kubernetes.io/os: linux
180180
> {}
181181
> ```
182182
183-
Kubernetes affinity: constraints for pod assignment
183+
Kubernetes affinity: constraints for pod assignment
184184
For example:
185185
186186
```yaml
@@ -199,8 +199,8 @@ nodeAffinity:
199199
> []
200200
> ```
201201
202-
Kubernetes pod tolerations for google-cas-issuer
203-
For example:
202+
Kubernetes pod tolerations for google-cas-issuer
203+
For example:
204204
- operator: "Exists"
205205
#### **priorityClassName** ~ `string`
206206
> Default value:
@@ -210,4 +210,4 @@ For example:
210210
211211
Optional priority class to be used for the google-cas-issuer pods.
212212
213-
<!-- /AUTO-GENERATED -->
213+
<!-- /AUTO-GENERATED -->

deploy/charts/google-cas-issuer/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,14 @@ See https://github.com/cert-manager/cert-manager/issues/6329 for a list of linke
4242
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
4343
{{- end }}
4444
{{- end }}
45+
46+
{{/*
47+
Create the name of the service account to use
48+
*/}}
49+
{{- define "cert-manager-google-cas-issuer.serviceAccountName" -}}
50+
{{- if .Values.serviceAccount.create }}
51+
{{- default (include "cert-manager-google-cas-issuer.name" .) .Values.serviceAccount.name }}
52+
{{- else }}
53+
{{- default "default" .Values.serviceAccount.name }}
54+
{{- end }}
55+
{{- end }}

deploy/charts/google-cas-issuer/templates/clusterrolebinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ roleRef:
1010
name: {{ include "cert-manager-google-cas-issuer.name" . }}
1111
subjects:
1212
- kind: ServiceAccount
13-
name: {{ include "cert-manager-google-cas-issuer.name" . }}
13+
name: {{ include "cert-manager-google-cas-issuer.serviceAccountName" . }}
1414
namespace: {{ .Release.Namespace }}
1515
---
1616
{{- if .Values.app.approval.enabled }}

deploy/charts/google-cas-issuer/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
imagePullSecrets:
3232
{{- toYaml . | nindent 8 }}
3333
{{- end }}
34-
serviceAccountName: {{ include "cert-manager-google-cas-issuer.name" . }}
34+
serviceAccountName: {{ include "cert-manager-google-cas-issuer.serviceAccountName" . }}
3535
{{- with .Values.priorityClassName }}
3636
priorityClassName: {{ . | quote }}
3737
{{- end }}

deploy/charts/google-cas-issuer/templates/rolebinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ roleRef:
1111
name: {{ include "cert-manager-google-cas-issuer.name" . }}
1212
subjects:
1313
- kind: ServiceAccount
14-
name: {{ include "cert-manager-google-cas-issuer.name" . }}
14+
name: {{ include "cert-manager-google-cas-issuer.serviceAccountName" . }}
1515
namespace: {{ .Release.Namespace }}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
{{ if .Values.serviceAccount.create -}}
12
apiVersion: v1
23
kind: ServiceAccount
34
metadata:
4-
name: {{ include "cert-manager-google-cas-issuer.name" . }}
5-
namespace: {{ .Release.Namespace }}
5+
name: {{ include "cert-manager-google-cas-issuer.serviceAccountName" . }}
66
labels:
77
{{ include "cert-manager-google-cas-issuer.labels" . | indent 4 }}
88
annotations:
99
{{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
10+
{{- end }}

deploy/charts/google-cas-issuer/values.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ imagePullSecrets: []
3737
commonLabels: {}
3838

3939
serviceAccount:
40-
# Optional annotations to add to the service account
40+
# -- Specifies whether a service account should be created
41+
create: true
42+
# -- The name used to create the service account or the name of an existing service account to use if not creating one.
43+
# if create is false, this name is required or the default service account will be used.
44+
name: ""
45+
# -- Optional annotations to add to the service account
4146
annotations: {}
4247

4348
app:
44-
# Verbosity of google-cas-issuer logging.
49+
# -- Verbosity of google-cas-issuer logging.
4550
logLevel: 1 # 1-5
4651

4752
# Handle RBAC permissions for approving Google CAS issuer
@@ -62,9 +67,9 @@ app:
6267
# name: cert-manager-approver-policy
6368
# namespace: cert-manager
6469
subjects:
65-
- kind: ServiceAccount
66-
name: cert-manager
67-
namespace: cert-manager
70+
- kind: ServiceAccount
71+
name: cert-manager
72+
namespace: cert-manager
6873

6974
# metrics controls exposing google-cas-issuer metrics.
7075
metrics:

0 commit comments

Comments
 (0)