Skip to content

Commit 069eb97

Browse files
committed
Add .values.config.oidc.secret
Also fix args not being passed to deployment if secret is not generated Signed-off-by: Valentin Klopfenstein <git@klopfi.net>
1 parent a1ca4cc commit 069eb97

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

charts/headlamp/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ See [MAINTAINERS.md](https://github.com/headlamp-k8s/headlamp/blob/main/MAINTAIN
6565

6666
### Headlamp Configuration
6767

68-
| Key | Type | Default | Description |
69-
|--------------------------|--------|-----------------------|--------------------------------------------|
70-
| config.baseURL | string | `""` | base url path at which headlamp should run |
71-
| config.oidc.create | bool | `true` | Enable this option to have the chart automatically create the OIDC secret using the specified values. |
72-
| config.oidc.clientID | string | `""` | OIDC client ID |
73-
| config.oidc.clientSecret | string | `""` | OIDC client secret |
74-
| config.oidc.issuerURL | string | `""` | OIDC issuer URL |
75-
| config.oidc.scopes | string | `""` | OIDC scopes to be used |
76-
| config.pluginsDir | string | `"/headlamp/plugins"` | directory to look for plugins |
68+
| Key | Type | Default | Description |
69+
|---------------------------|--------|-----------------------|--------------------------------------------|
70+
| config.baseURL | string | `""` | base url path at which headlamp should run |
71+
| config.oidc.clientID | string | `""` | OIDC client ID |
72+
| config.oidc.clientSecret | string | `""` | OIDC client secret |
73+
| config.oidc.issuerURL | string | `""` | OIDC issuer URL |
74+
| config.oidc.scopes | string | `""` | OIDC scopes to be used |
75+
| config.oidc.secret.create | bool | `true` | Enable this option to have the chart automatically create the OIDC secret using the specified values. |
76+
| config.oidc.secret.name | string | `oidc` | Name of the OIDC secret used by headlamp |
77+
| config.pluginsDir | string | `"/headlamp/plugins"` | directory to look for plugins |

charts/headlamp/templates/deployment.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,52 @@ spec:
3535
{{- toYaml .Values.securityContext | nindent 12 }}
3636
image: "{{ .Values.image.registry}}/{{ .Values.image.repository }}:{{ .Values.image.tag | default (printf "v%s" .Chart.AppVersion) }}"
3737
imagePullPolicy: {{ .Values.image.pullPolicy }}
38+
{{ with .Values.config.oidc }}
3839
env:
39-
{{- if or .Values.config.oidc.clientID (not .Values.config.oidc.create) }}
40+
{{- if or .clientID (not .secret.create) }}
4041
- name: OIDC_CLIENT_ID
4142
valueFrom:
4243
secretKeyRef:
43-
name: oidc
44+
name: {{ .secret.name }}
4445
key: clientID
4546
{{- end }}
46-
{{- if or .Values.config.oidc.clientSecret (not .Values.config.oidc.create) }}
47+
{{- if or .clientSecret (not .secret.create) }}
4748
- name: OIDC_CLIENT_SECRET
4849
valueFrom:
4950
secretKeyRef:
50-
name: oidc
51+
name: {{ .secret.name }}
5152
key: clientSecret
5253
{{- end }}
53-
{{- if or .Values.config.oidc.issuerURL (not .Values.config.oidc.create) }}
54+
{{- if or .issuerURL (not .secret.create) }}
5455
- name: OIDC_ISSUER_URL
5556
valueFrom:
5657
secretKeyRef:
57-
name: oidc
58+
name: {{ .secret.name }}
5859
key: issuerURL
5960
{{- end }}
60-
{{- if or .Values.config.oidc.scopes (not .Values.config.oidc.create) }}
61+
{{- if or .scopes (not .secret.create) }}
6162
- name: OIDC_SCOPES
6263
valueFrom:
6364
secretKeyRef:
64-
name: oidc
65+
name: {{ .secret.name }}
6566
key: scopes
6667
{{- end }}
68+
{{- end }}
6769
args:
6870
- "-in-cluster"
6971
{{- with .Values.config.pluginsDir}}
7072
- "-plugins-dir={{ . }}"
7173
{{- end }}
72-
{{- with .Values.config.oidc.clientID }}
74+
{{- if or .Values.config.oidc.clientID (not .Values.config.oidc.secret.create) }}
7375
- "-oidc-client-id=$(OIDC_CLIENT_ID)"
7476
{{- end }}
75-
{{- with .Values.config.oidc.clientSecret }}
77+
{{- if or .Values.config.oidc.clientSecret (not .Values.config.oidc.secret.create) }}
7678
- "-oidc-client-secret=$(OIDC_CLIENT_SECRET)"
7779
{{- end }}
78-
{{- with .Values.config.oidc.issuerURL }}
80+
{{- if or .Values.config.oidc.issuerURL (not .Values.config.oidc.secret.create) }}
7981
- "-oidc-idp-issuer-url=$(OIDC_ISSUER_URL)"
8082
{{- end }}
81-
{{- with .Values.config.oidc.scopes }}
83+
{{- if or .Values.config.oidc.scopes (not .Values.config.oidc.secret.create) }}
8284
- "-oidc-scopes=$(OIDC_SCOPES)"
8385
{{- end }}
8486
{{- with .Values.config.baseURL }}

charts/headlamp/templates/secret.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
{{- if .Values.config.oidc.create }}
1+
{{- with .Values.config.oidc }}
2+
{{- if .secret.create -}}
23
apiVersion: v1
34
kind: Secret
45
metadata:
5-
name: oidc
6+
name: {{ .secret.name }}
67
type: Opaque
78
data:
8-
{{- with .Values.config.oidc.clientID }}
9+
{{- with .clientID }}
910
clientID: {{ . | b64enc | quote }}
1011
{{- end }}
11-
{{- with .Values.config.oidc.clientSecret }}
12+
{{- with .clientSecret }}
1213
clientSecret: {{ . | b64enc | quote }}
1314
{{- end }}
14-
{{- with .Values.config.oidc.issuerURL }}
15+
{{- with .issuerURL }}
1516
issuerURL: {{ . | b64enc | quote }}
1617
{{- end }}
17-
{{- with .Values.config.oidc.scopes }}
18+
{{- with .scopes }}
1819
scopes: {{ . | b64enc | quote }}
1920
{{- end }}
2021
{{- end }}
22+
{{- end }}

charts/headlamp/values.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ config:
2929
# -- base url path at which headlamp should run
3030
baseURL: ""
3131
oidc:
32-
# -- Generate OIDC secret. If true, will generate a secret using the values below.
33-
create: true
32+
secret:
33+
# -- Generate OIDC secret. If true, will generate a secret using .config.oidc.
34+
create: true
35+
# -- Name of the OIDC secret.
36+
name: oidc
3437
# -- OIDC client ID
3538
clientID: ""
3639
# -- OIDC client secret

0 commit comments

Comments
 (0)