Skip to content

Commit cbf1a4e

Browse files
authored
cmd/k8s-operator/deploy/chart: allow reading OAuth creds from a CSI driver's volume and annotating operator's Service account (tailscale#14264)
cmd/k8s-operator/deploy/chart: allow reading OAuth creds from a CSI driver's volume and annotating operator's Service account Updates tailscale#14264 Signed-off-by: Oliver Rahner <[email protected]>
1 parent efdfd54 commit cbf1a4e

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

cmd/k8s-operator/deploy/chart/templates/deployment.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ spec:
3535
{{- toYaml . | nindent 8 }}
3636
{{- end }}
3737
volumes:
38-
- name: oauth
39-
secret:
40-
secretName: operator-oauth
38+
- name: oauth
39+
{{- with .Values.oauthSecretVolume }}
40+
{{- toYaml . | nindent 10 }}
41+
{{- else }}
42+
secret:
43+
secretName: operator-oauth
44+
{{- end }}
4145
containers:
4246
- name: operator
4347
{{- with .Values.operatorConfig.securityContext }}

cmd/k8s-operator/deploy/chart/templates/operator-rbac.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ kind: ServiceAccount
66
metadata:
77
name: operator
88
namespace: {{ .Release.Namespace }}
9+
{{- with .Values.operatorConfig.serviceAccountAnnotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
913
---
1014
apiVersion: rbac.authorization.k8s.io/v1
1115
kind: ClusterRole

cmd/k8s-operator/deploy/chart/values.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@
33

44
# Operator oauth credentials. If set a Kubernetes Secret with the provided
55
# values will be created in the operator namespace. If unset a Secret named
6-
# operator-oauth must be precreated.
6+
# operator-oauth must be precreated or oauthSecretVolume needs to be adjusted.
7+
# This block will be overridden by oauthSecretVolume, if set.
78
oauth: {}
89
# clientId: ""
910
# clientSecret: ""
1011

12+
# Secret volume.
13+
# If set it defines the volume the oauth secrets will be mounted from.
14+
# The volume needs to contain two files named `client_id` and `client_secret`.
15+
# If unset the volume will reference the Secret named operator-oauth.
16+
# This block will override the oauth block.
17+
oauthSecretVolume: {}
18+
# csi:
19+
# driver: secrets-store.csi.k8s.io
20+
# readOnly: true
21+
# volumeAttributes:
22+
# secretProviderClass: tailscale-oauth
23+
#
24+
## NAME is pre-defined!
25+
1126
# installCRDs determines whether tailscale.com CRDs should be installed as part
1227
# of chart installation. We do not use Helm's CRD installation mechanism as that
1328
# does not allow for upgrading CRDs.
@@ -40,6 +55,9 @@ operatorConfig:
4055
podAnnotations: {}
4156
podLabels: {}
4257

58+
serviceAccountAnnotations: {}
59+
# eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/tailscale-operator-role
60+
4361
tolerations: []
4462

4563
affinity: {}

0 commit comments

Comments
 (0)