From fbe4a5525182ca957633f2b5ae790c52935fb245 Mon Sep 17 00:00:00 2001 From: Erki Aas Date: Sat, 27 Jul 2024 21:30:09 +0300 Subject: [PATCH] migrate gitea to new passmower --- gitea/application.yaml | 44 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/gitea/application.yaml b/gitea/application.yaml index 01f7c2f..62c9a4b 100644 --- a/gitea/application.yaml +++ b/gitea/application.yaml @@ -32,8 +32,8 @@ spec: - key: secret value: "%(plaintext)s" --- -apiVersion: codemowers.io/v1alpha1 -kind: OIDCGWClient +apiVersion: codemowers.cloud/v1beta1 +kind: OIDCClient metadata: name: gitea spec: @@ -53,6 +53,46 @@ spec: - openid - profile pkce: false + secretRefreshPod: + apiVersion: v1 + kind: Pod + metadata: + name: reset-oidc-config + 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-gitea-owner-secrets + command: + - /bin/bash + - -c + - jq '{"strategyKey":"OpenID","config":{"Provider":"openidConnect","ClientID":$ENV.OIDC_CLIENT_ID,"ClientSecret":$ENV.OIDC_CLIENT_SECRET,"OpenIDConnectAutoDiscoveryURL":"https://auth.k-space.ee/.well-known/openid-configuration","CustomURLMapping":null,"IconURL":"","Scopes":null,"RequiredClaimName":"","RequiredClaimValue":"","GroupClaimName":"","AdminGroup":"","GroupTeamMap":"","GroupTeamMapRemoval":false,"RestrictedGroup":""}} | "UPDATE login_source SET cfg=\(.config|tostring|@sh) WHERE name=\(.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: gitea-secrets + key: GITEA__DATABASE__PASSWD + command: + - /bin/bash + - -c + - mysql -u kspace_git kspace_git -h 172.20.36.1 -p${MYSQL_PWD} < /tmp/update.sql --- apiVersion: apps/v1 kind: StatefulSet