Skip to content

Commit 0948588

Browse files
committed
charts: deployment: values: Add oidc auto-login configuration
1 parent c2bf8a7 commit 0948588

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

charts/headlamp/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ $ helm install my-headlamp headlamp/headlamp \
8686
| config.oidc.issuerURL | string | `""` | OIDC issuer URL |
8787
| config.oidc.scopes | string | `""` | OIDC scopes to be used |
8888
| config.oidc.usePKCE | bool | `false` | Use PKCE (Proof Key for Code Exchange) for enhanced security in OIDC flow |
89+
| confgi.oidc.autoLogin | bool | `false` | Enable Automatic redirect to OIDC provider |
8990
| config.oidc.secret.create | bool | `true` | Create OIDC secret using provided values |
9091
| config.oidc.secret.name | string | `"oidc"` | Name of the OIDC secret |
9192
| config.oidc.externalSecret.enabled | bool | `false` | Enable using external secret for OIDC |
@@ -102,6 +103,7 @@ config:
102103
clientSecret: "your-client-secret"
103104
issuerURL: "https://your-issuer"
104105
scopes: "openid profile email"
106+
autoLogin: true
105107
meUserInfoURL: "https://headlamp.example.com/oauth2/userinfo"
106108
```
107109

charts/headlamp/templates/deployment.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
{{- $usePKCE := "" }}
1212
{{- $useAccessToken := "" }}
1313
{{- $meUserInfoURL := "" }}
14+
{{- $oidcAutoLogin := "" }}
1415

1516
# This block of code is used to extract the values from the env.
1617
# This is done to check if the values are non-empty and if they are, they are used in the deployment.yaml.
@@ -45,6 +46,9 @@
4546
{{- if eq .name "ME_USER_INFO_URL" }}
4647
{{- $meUserInfoURL = .value | toString }}
4748
{{- end }}
49+
{{- if eq .name "OIDC_AUTO_LOGIN" }}
50+
{{- $oidcAutoLogin = .value | toString }}
51+
{{- end }}
4852
{{- end }}
4953

5054
apiVersion: apps/v1
@@ -182,6 +186,13 @@ spec:
182186
name: {{ $oidc.secret.name }}
183187
key: meUserInfoURL
184188
{{- end }}
189+
{{- if $oidc.autoLogin }}
190+
- name: OIDC_AUTO_LOGIN
191+
valueFrom:
192+
secretKeyRef:
193+
name: {{ $oidc.auto.login }}
194+
key: autoLogin
195+
{{- end }}
185196
{{- else }}
186197
{{- if $oidc.clientID }}
187198
- name: OIDC_CLIENT_ID
@@ -223,10 +234,14 @@ spec:
223234
- name: ME_USER_INFO_URL
224235
value: {{ $oidc.meUserInfoURL }}
225236
{{- end }}
237+
{{- if $oidc.autoLogin }}
238+
- name: OIDC_AUTO_LOGIN
239+
value: {{ $oidc.autoLogin | quote }}
226240
{{- end }}
227-
{{- if .Values.env }}
241+
{{- end }}
242+
{{- if .Values.env }}
228243
{{- toYaml .Values.env | nindent 12 }}
229-
{{- end }}
244+
{{- end }}
230245
{{- end }}
231246
{{- end }}
232247
args:
@@ -285,6 +300,9 @@ spec:
285300
{{- if or (ne $oidc.meUserInfoURL "") (ne $meUserInfoURL "") }}
286301
- "-me-user-info-url=$(ME_USER_INFO_URL)"
287302
{{- end }}
303+
{{- if or (eq ($oidc.autoLogin | toString) "true") (eq $oidcAutoLogin "true") }}
304+
- "-oidc-auto-login=$(OIDC_AUTO_LOGIN)"
305+
{{- end }}
288306
{{- else }}
289307
- "-oidc-client-id=$(OIDC_CLIENT_ID)"
290308
- "-oidc-client-secret=$(OIDC_CLIENT_SECRET)"
@@ -312,6 +330,9 @@ spec:
312330
{{- if or (ne $oidc.meUserInfoURL "") (ne $meUserInfoURL "") }}
313331
- "-me-user-info-url=$(ME_USER_INFO_URL)"
314332
{{- end }}
333+
{{- if or (eq ($oidc.autoLogin | toString) "true") (eq $oidcAutoLogin "true") }}
334+
- "-oidc-auto-login=$(OIDC_AUTO_LOGIN)"
335+
{{- end }}
315336
{{- end }}
316337
{{- with .Values.config.baseURL }}
317338
- "-base-url={{ . }}"

charts/headlamp/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ config:
8484
useAccessToken: false
8585
# -- Use PKCE (Proof Key for Code Exchange) for enhanced security in OIDC flow
8686
usePKCE: false
87+
# -- Enable automatic redirect to the OIDC provider
88+
autoLogin: false
8789

8890
# Option 3:
8991
# @param config.oidc - External OIDC secret configuration

frontend/src/components/project/NewProjectPopup.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const makeStore = () => {
4141
'cluster-a': { name: 'cluster-a' },
4242
'cluster-b': { name: 'cluster-b' },
4343
} as any,
44+
oidcAutoLogin: null,
4445
settings: {
4546
tableRowsPerPageOptions: [15, 25, 50],
4647
timezone: 'UTC',

frontend/src/components/project/ProjectCreateFromYaml.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const makeStore = () => {
4040
'cluster-a': { name: 'cluster-a' },
4141
'cluster-b': { name: 'cluster-b' },
4242
} as any,
43+
oidcAutoLogin: null,
4344
settings: {
4445
tableRowsPerPageOptions: [15, 25, 50],
4546
timezone: 'UTC',

0 commit comments

Comments
 (0)