generated from AMRC-FactoryPlus/acs-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Deploy Keycloak as an OAuth provider #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KavanPrice
wants to merge
63
commits into
main
Choose a base branch
from
kp/add-oauth
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
eaab062
Add OpenID IngressRoute
KavanPrice fb59dd8
Add Keycloak deployment
KavanPrice 45aac27
Add startup realm importing
KavanPrice cb867ca
Add oauth to Grafana config
KavanPrice 614a94e
Add keytab volume
KavanPrice 8d0668b
Add requested PR changes
djnewbould 0d0ea83
Add local secret grafana mount
djnewbould 127c692
Add realm creation to service-setup
KavanPrice f73f3b6
Add service lookup for provided client configs
KavanPrice da8c668
Add Grafana client config values
KavanPrice dd65a24
Fix keytab secret names
KavanPrice 4205c43
Add client_secret volume mount
KavanPrice 101fe91
Fix config and add startup backoff
KavanPrice 7200867
Add generic client-secret fetching
KavanPrice acdc62a
Rename client-secret to be findable by service-setup
KavanPrice ac7c368
Fix misnamed grafana client ID
KavanPrice 4f6daea
Fix misnamed grafana secret
KavanPrice b35cf42
Change to use realm instead of base URL in ACS config
KavanPrice 9a80e55
Use setTimeout from timers/promises
KavanPrice 284b8d9
Timeout bugfix
KavanPrice 15ed6a7
Remove unused client keytab
KavanPrice e935fbb
Add dynamic LocalSecret generation
KavanPrice e0b480f
Fix helm loop bug
KavanPrice 3493233
Remove `items` from keytabs mount
amrc-benmorrow e51b307
Allow OpenID errors to cause service-setup to exit
amrc-benmorrow 47fab3e
Reference client secrets correctly
amrc-benmorrow b4e4963
Merge in testing/v4
amrc-benmorrow 98af79f
Remove Grafana Basic auth middleware
amrc-benmorrow 94e7ed0
Log realm details on creation
amrc-benmorrow e83d828
Give Keycloack a PVC
amrc-benmorrow fcb2dc1
Log full client information
amrc-benmorrow d075eee
Tell Grafana its external root URL
amrc-benmorrow 4f97679
Disable Grafana auth via the middleware
amrc-benmorrow d9a6c76
Grafana config changes
amrc-benmorrow 688292b
Java doesn't accept KRB5_CONFIG
amrc-benmorrow fea8727
Keycloak needs to use Recreate strategy
amrc-benmorrow 8c20987
Fix login and logout for basic users
KavanPrice 08a3193
Add client role mapping
KavanPrice f17aa0e
Add client role creation
KavanPrice edb12fc
Add admin-cli permissions to create users
KavanPrice 7fa281d
Add default role to client
KavanPrice 5189e03
Add creation of admin user
KavanPrice c4a33d2
Add client role mapping for admin user
KavanPrice 9d44e3d
Refactor OpenID setup
amrc-benmorrow cf237dc
Always create client roles
amrc-benmorrow b7e7294
Use a LocalSecret for the admin service client
amrc-benmorrow 28b296d
Fix some logging
amrc-benmorrow c177e65
Missing await
amrc-benmorrow ae0290b
We need to call try_fetch, not native fetch
amrc-benmorrow c77c634
Error in admin user creation
amrc-benmorrow 62c36cd
The admin@ account is no longer the service account
amrc-benmorrow 01a0585
Log if the admin user doesn't exist
amrc-benmorrow 628e344
UserRepresentation.credentials is an array
amrc-benmorrow da8e5d9
We must clone a Request to reuse it
amrc-benmorrow fbfbdfc
Rename the Keycloak bootstrap user
amrc-benmorrow 1461db3
Create admin@ linked to Kerberos
amrc-benmorrow 2034cae
Assign admin user roles correctly
amrc-benmorrow 1d6aea2
Remove Grafana admin user secret
amrc-benmorrow b063321
We can't remove the grafana-internal admin user
amrc-benmorrow e263eac
Assign Grafana roles from OAuth
amrc-benmorrow 847a97b
Try to get OpenID roles visible in Grafana
amrc-benmorrow a379116
Restore OpenID role mapper
amrc-benmorrow b4f4da2
We need to look up the client ID.
amrc-benmorrow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| {{- if .Values.openid.enabled }} | ||
| {{- if not (lookup "v1" "Secret" .Release.Namespace "openid-admin-user") }} | ||
|
|
||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: "openid-admin-user" | ||
| namespace: {{ .Release.Namespace }} | ||
| annotations: | ||
| "helm.sh/resource-policy": "keep" | ||
| type: Opaque | ||
| data: | ||
| username: {{ (printf "admin@%s" (.Values.identity.realm | required "values.identity.realm is required!") | b64enc) | quote }} | ||
| password: {{ (printf "" | b64enc) | quote }} | ||
|
|
||
| {{- end }} | ||
| {{- end -}} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| {{ if .Values.openid.enabled }} | ||
| apiVersion: traefik.io/v1alpha1 | ||
| kind: IngressRoute | ||
| metadata: | ||
| name: openid-ingressroute | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| entryPoints: | ||
| - {{ .Values.acs.secure | ternary "websecure" "web" }} | ||
| routes: | ||
| - match: Host(`openid.{{.Values.acs.baseUrl | required "values.acs.baseUrl is required"}}`) | ||
| kind: Rule | ||
| services: | ||
| - name: openid | ||
| port: 80 | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- if .Values.acs.secure }} | ||
| tls: | ||
| secretName: {{ coalesce .Values.openid.tlsSecretName .Values.acs.tlsSecretName }} | ||
| domains: | ||
| - main: openid.{{.Values.acs.baseUrl | required "values.acs.baseUrl is required"}} | ||
| {{- end -}} | ||
| {{- end -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| {{ if .Values.openid.enabled }} | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: openid | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| component: openid | ||
| spec: | ||
| replicas: {{ .Values.openid.replicas | default 1 }} | ||
| selector: | ||
| matchLabels: | ||
| component: openid | ||
| template: | ||
| metadata: | ||
| labels: | ||
| component: openid | ||
| factory-plus.service: openid | ||
| spec: | ||
| {{- with .Values.acs.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| containers: | ||
| - name: openid | ||
| image: "{{ .Values.openid.image.repository }}:{{ .Values.openid.image.tag }}" | ||
| imagePullPolicy: {{ .Values.openid.image.pullPolicy }} | ||
| args: ["start-dev", "--import-realm"] | ||
| env: | ||
| - name: KEYCLOAK_ADMIN | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: openid-admin-user | ||
| key: username | ||
| - name: KEYCLOAK_ADMIN_PASSWORD | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: openid-admin-user | ||
| key: password | ||
amrc-benmorrow marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: KC_PROXY | ||
| value: "edge" | ||
| - name: KC_HEALTH_ENABLED | ||
| value: "true" | ||
| - name: KRB5_CONFIG | ||
KavanPrice marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| value: /config/krb5-conf/krb5.conf | ||
| ports: | ||
| - name: http | ||
| containerPort: 8080 | ||
| readinessProbe: | ||
| httpGet: | ||
| path: /health/ready | ||
| port: 9000 | ||
| volumeMounts: | ||
| - name: realm-config | ||
| mountPath: /opt/keycloak/data/import | ||
| readOnly: true | ||
| - name: krb5-conf | ||
| mountPath: /config/krb5-conf | ||
| - name: krb5-keytab | ||
| mountPath: /etc/keytabs | ||
| volumes: | ||
| - name: realm-config | ||
| configMap: | ||
| name: keycloak-realm-config | ||
| - name: krb5-conf | ||
| configMap: | ||
| name: krb5-conf | ||
| - name: krb5-keytabs | ||
| secret: | ||
| secretName: krb5-keytabs | ||
| items: | ||
| - path: client | ||
| key: sv1openid | ||
| - path: server | ||
| key: http.openid | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: openid | ||
| namespace: {{ .Release.Namespace }} | ||
| spec: | ||
| ports: | ||
| - name: http | ||
| port: 80 | ||
| targetPort: 8080 | ||
| selector: | ||
| factory-plus.service: openid | ||
| {{- end }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.