Skip to content

Commit 77a28b6

Browse files
committed
feat: add OpenIdConnect/OAuth2 support
1 parent bbb8eaf commit 77a28b6

4 files changed

Lines changed: 88 additions & 0 deletions

File tree

charts/kellnr/templates/config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,29 @@ data:
5555
KELLNR_S3__ALLOW_HTTP: {{ .Values.kellnr.s3.allowHttp | quote }}
5656
KELLNR_S3__CRATES_BUCKET: {{ .Values.kellnr.s3.crates_bucket | quote }}
5757
KELLNR_S3__CRATESIO_BUCKET: {{ .Values.kellnr.s3.cratesio_bucket | quote }}
58+
# OAuth2/OpenID Connect
59+
KELLNR_OAUTH2__ENABLED: {{ .Values.kellnr.oauth2.enabled | quote }}
60+
{{- if .Values.kellnr.oauth2.issuerUrl }}
61+
KELLNR_OAUTH2__ISSUER_URL: {{ .Values.kellnr.oauth2.issuerUrl | quote }}
62+
{{- end }}
63+
{{- if .Values.kellnr.oauth2.clientId }}
64+
KELLNR_OAUTH2__CLIENT_ID: {{ .Values.kellnr.oauth2.clientId | quote }}
65+
{{- end }}
66+
{{- if and .Values.kellnr.oauth2.clientSecret (not .Values.kellnr.oauth2.clientSecretRef.name) }}
67+
KELLNR_OAUTH2__CLIENT_SECRET: {{ .Values.kellnr.oauth2.clientSecret | quote }}
68+
{{- end }}
69+
KELLNR_OAUTH2__SCOPES: {{ .Values.kellnr.oauth2.scopes | quote }}
70+
KELLNR_OAUTH2__AUTO_PROVISION_USERS: {{ .Values.kellnr.oauth2.autoProvisionUsers | quote }}
71+
{{- if .Values.kellnr.oauth2.adminGroupClaim }}
72+
KELLNR_OAUTH2__ADMIN_GROUP_CLAIM: {{ .Values.kellnr.oauth2.adminGroupClaim | quote }}
73+
{{- end }}
74+
{{- if .Values.kellnr.oauth2.adminGroupValue }}
75+
KELLNR_OAUTH2__ADMIN_GROUP_VALUE: {{ .Values.kellnr.oauth2.adminGroupValue | quote }}
76+
{{- end }}
77+
{{- if .Values.kellnr.oauth2.readOnlyGroupClaim }}
78+
KELLNR_OAUTH2__READ_ONLY_GROUP_CLAIM: {{ .Values.kellnr.oauth2.readOnlyGroupClaim | quote }}
79+
{{- end }}
80+
{{- if .Values.kellnr.oauth2.readOnlyGroupValue }}
81+
KELLNR_OAUTH2__READ_ONLY_GROUP_VALUE: {{ .Values.kellnr.oauth2.readOnlyGroupValue | quote }}
82+
{{- end }}
83+
KELLNR_OAUTH2__BUTTON_TEXT: {{ .Values.kellnr.oauth2.buttonText | quote }}

charts/kellnr/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ spec:
8282
valueFrom:
8383
secretKeyRef: {{ toYaml .Values.kellnr.postgres.pwdSecretRef | nindent 16 }}
8484
{{- end }}
85+
{{- if and .Values.kellnr.oauth2.enabled .Values.kellnr.oauth2.clientSecretRef.name }}
86+
- name: KELLNR_OAUTH2__CLIENT_SECRET
87+
valueFrom:
88+
secretKeyRef: {{ toYaml .Values.kellnr.oauth2.clientSecretRef | nindent 16 }}
89+
{{- end }}
8590
envFrom:
8691
{{- if .Values.secret.enabled }}
8792
- secretRef:

charts/kellnr/templates/secret-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,30 @@ stringData:
5050
KELLNR_S3__ALLOW_HTTP: {{ .Values.kellnr.s3.allowHttp | quote }}
5151
KELLNR_S3__CRATES_BUCKET: {{ .Values.kellnr.s3.crates_bucket | quote }}
5252
KELLNR_S3__CRATESIO_BUCKET: {{ .Values.kellnr.s3.cratesio_bucket | quote }}
53+
# OAuth2/OpenID Connect
54+
KELLNR_OAUTH2__ENABLED: {{ .Values.kellnr.oauth2.enabled | quote }}
55+
{{- if .Values.kellnr.oauth2.issuerUrl }}
56+
KELLNR_OAUTH2__ISSUER_URL: {{ .Values.kellnr.oauth2.issuerUrl | quote }}
57+
{{- end }}
58+
{{- if .Values.kellnr.oauth2.clientId }}
59+
KELLNR_OAUTH2__CLIENT_ID: {{ .Values.kellnr.oauth2.clientId | quote }}
60+
{{- end }}
61+
{{- if and .Values.kellnr.oauth2.clientSecret (not .Values.kellnr.oauth2.clientSecretRef.name) }}
62+
KELLNR_OAUTH2__CLIENT_SECRET: {{ .Values.kellnr.oauth2.clientSecret | quote }}
63+
{{- end }}
64+
KELLNR_OAUTH2__SCOPES: {{ .Values.kellnr.oauth2.scopes | quote }}
65+
KELLNR_OAUTH2__AUTO_PROVISION_USERS: {{ .Values.kellnr.oauth2.autoProvisionUsers | quote }}
66+
{{- if .Values.kellnr.oauth2.adminGroupClaim }}
67+
KELLNR_OAUTH2__ADMIN_GROUP_CLAIM: {{ .Values.kellnr.oauth2.adminGroupClaim | quote }}
68+
{{- end }}
69+
{{- if .Values.kellnr.oauth2.adminGroupValue }}
70+
KELLNR_OAUTH2__ADMIN_GROUP_VALUE: {{ .Values.kellnr.oauth2.adminGroupValue | quote }}
71+
{{- end }}
72+
{{- if .Values.kellnr.oauth2.readOnlyGroupClaim }}
73+
KELLNR_OAUTH2__READ_ONLY_GROUP_CLAIM: {{ .Values.kellnr.oauth2.readOnlyGroupClaim | quote }}
74+
{{- end }}
75+
{{- if .Values.kellnr.oauth2.readOnlyGroupValue }}
76+
KELLNR_OAUTH2__READ_ONLY_GROUP_VALUE: {{ .Values.kellnr.oauth2.readOnlyGroupValue | quote }}
77+
{{- end }}
78+
KELLNR_OAUTH2__BUTTON_TEXT: {{ .Values.kellnr.oauth2.buttonText | quote }}
5379
{{- end }}

charts/kellnr/values.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,37 @@ kellnr:
129129
crates_bucket: "kellnr-crates"
130130
cratesio_bucket: "kellnr-cratesio"
131131

132+
# OAuth2/OpenID Connect authentication
133+
# See https://kellnr.io/documentation for details
134+
oauth2:
135+
enabled: false
136+
# OIDC issuer URL (discovery URL)
137+
# Example: "https://authentik.example.com/application/o/kellnr/"
138+
issuerUrl: ""
139+
# OAuth2 client ID
140+
clientId: ""
141+
# OAuth2 client secret - prefer using clientSecretRef for production
142+
clientSecret: ""
143+
# Reference to an existing Kubernetes secret containing the client secret
144+
# When set, this takes precedence over clientSecret
145+
clientSecretRef:
146+
name: ""
147+
key: "client-secret"
148+
# OAuth2 scopes to request (comma-separated)
149+
scopes: "openid,profile,email"
150+
# Automatically create local user accounts for new OAuth2 users
151+
autoProvisionUsers: true
152+
# Claim name to check for admin group membership (e.g., "groups")
153+
adminGroupClaim: ""
154+
# Value in the admin group claim that grants admin privileges (e.g., "kellnr-admins")
155+
adminGroupValue: ""
156+
# Claim name to check for read-only group membership (e.g., "groups")
157+
readOnlyGroupClaim: ""
158+
# Value in the read-only group claim that grants read-only access (e.g., "kellnr-readonly")
159+
readOnlyGroupValue: ""
160+
# Text displayed on the OAuth2 login button
161+
buttonText: "Login with SSO"
162+
132163
service:
133164
api:
134165
type: ClusterIP

0 commit comments

Comments
 (0)