blob: 2a89c4b9e3f822644f93dcb86bf6378c50b0b6c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
{{- if or .Values.serviceAccount.enabled -}}
{{- $fullName := include "oauth2-proxy.fullname" . -}}
{{- $saName := include "oauth2-proxy.serviceAccountName" . -}}
{{- $name := include "oauth2-proxy.name" . -}}
{{- $namespace := include "oauth2-proxy.namespace" $ -}}
{{- $labels := include "oauth2-proxy.labels" . -}}
---
apiVersion: v1
kind: ServiceAccount
metadata:
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ $name }}
{{- $labels | indent 4 }}
name: {{ $saName }}
namespace: {{ $namespace }}
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
{{- if and .Values.redis.enabled .Values.initContainers.waitForRedis.enabled }}
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ $fullName }}-watch-redis
namespace: {{ $namespace }}
labels:
app: {{ $name }}
{{- $labels | nindent 4 }}
rules:
- apiGroups:
- ""
resources:
- pods
resourceNames:
- "{{ include "oauth2-proxy.redis.fullname" . }}-master-0"
verbs:
- get
- list
- watch
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ $saName }}-watch-redis
namespace: {{ $namespace }}
labels:
app: {{ $name }}
{{- $labels | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ $saName }}
apiGroup: ""
roleRef:
kind: Role
name: {{ $fullName }}-watch-redis
apiGroup: ""
{{- end -}}
{{- end -}}
|