1
0
forked from k-space/kube

wikijs: Add Job for resetting OIDC config

This commit is contained in:
Lauri Võsandi 2023-08-16 22:18:30 +03:00
parent 4fa49dbf8a
commit 14a5d703cb

View File

@ -0,0 +1,44 @@
---
apiVersion: batch/v1
kind: Job
metadata:
name: reset-oidc-config
spec:
template:
spec:
volumes:
- name: tmp
emptyDir: {}
initContainers:
- name: jq
image: alpine/k8s:1.24.16@sha256:06f8942d87fa17b40795bb9a8eff029a9be3fc3c9bcc13d62071de4cc3324153
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /tmp
name: tmp
envFrom:
- secretRef:
name: oidc-client-wiki-owner-secrets
command:
- /bin/bash
- -c
- jq '{"strategyKey":"oidc","config":{"clientId":$ENV.OIDC_CLIENT_ID,"clientSecret":$ENV.OIDC_CLIENT_SECRET,"authorizationURL":$ENV.OIDC_GATEWAY_AUTH_URI,"tokenURL":$ENV.OIDC_GATEWAY_TOKEN_URI,"userInfoURL":$ENV.OIDC_GATEWAY_USERINFO_URI,"skipUserProfile":false,"issuer":$ENV.OIDC_GATEWAY_URI,"emailClaim":"email","displayNameClaim":"name","mapGroups":false,"groupsClaim":"groups","logoutURL":$ENV.OIDC_GATEWAY_URI,"acrValues":""}} | "UPDATE authentication SET config=\(.config|tostring|@sh) WHERE strategyKey=\(.strategyKey|tostring|@sh) LIMIT 1"' -n -r > /tmp/update.sql
containers:
- name: mysql
image: mysql
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /tmp
name: tmp
env:
- name: MYSQL_PWD
valueFrom:
secretKeyRef:
name: wikijs-secrets
key: DB_PASS
command:
- /bin/bash
- -c
- mysql -u kspace_wiki kspace_wiki -h 172.20.36.1 -p${MYSQL_PWD} < /tmp/update.sql
restartPolicy: OnFailure
backoffLimit: 4