From 14a5d703cbf51903e2ac853922c2e74162c93e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Wed, 16 Aug 2023 22:18:30 +0300 Subject: [PATCH] wikijs: Add Job for resetting OIDC config --- wiki/reset-oidc-config.yaml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 wiki/reset-oidc-config.yaml diff --git a/wiki/reset-oidc-config.yaml b/wiki/reset-oidc-config.yaml new file mode 100644 index 0000000..86f4fbd --- /dev/null +++ b/wiki/reset-oidc-config.yaml @@ -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