From b533f7adf3d58b37bf578d7c73d144f768719621 Mon Sep 17 00:00:00 2001 From: "franz.germann" Date: Mon, 14 Apr 2025 16:39:37 +0200 Subject: [PATCH] adds a kubernetes job that configures ArgoCD --- .../core/argocd-sso/argocd-sso-config.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 template/stacks/core/argocd-sso/argocd-sso-config.yaml diff --git a/template/stacks/core/argocd-sso/argocd-sso-config.yaml b/template/stacks/core/argocd-sso/argocd-sso-config.yaml new file mode 100644 index 0000000..5ecfcd8 --- /dev/null +++ b/template/stacks/core/argocd-sso/argocd-sso-config.yaml @@ -0,0 +1,68 @@ +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: argocd-config + namespace: argocd +# annotations: +# argocd.argoproj.io/hook: PostSync +spec: + template: + metadata: + generateName: argocd-config- + spec: + # serviceAccountName: argocd-config + restartPolicy: OnFailure + containers: + - name: push + image: docker.io/library/ubuntu:22.04 + envFrom: + - secretRef: + name: auth-generic-oauth-secret # thats the external secret the job should wait for + - secretRef: + name: k8s-job-token # edpbuilder should create this automatically and feed it to this job + command: ["/bin/bash", "-c"] + args: + - | + #! /bin/bash + + if [[ "$client_secret" == "" ]]; + then + exit 1 + fi + + apt -qq update + apt -qq install git wget -y + if [[ "$(uname -m)" == "x86_64" ]]; then + wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64 + install yq_linux_amd64 /usr/local/bin/yq + rm yq_linux_amd64 + else + wget https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_arm64 + install yq_linux_arm64 /usr/local/bin/yq + rm yq_linux_arm64 + fi + + DOMAIN=192-168-197-2.c-one-infra.de + GIT_USERNAME=giteaAdmin + GIT_PASSWORD=2e53bfe27b64a5aa4e8bc591e15b33cc92ff95fa + + git config --global user.email "bot@bots.de" + git config --global user.name "bot" + + git clone https://${GIT_USERNAME}:${GIT_PASSWORD}@gitea-${DOMAIN}/giteaAdmin/edfbuilder.git + cd edfbuilder + yq eval '.configs.cm.oidc.config = + { + "name": "Keycloak", + "issuer": "https://${DOMAIN}/keycloak/realms/cnoe/.well-known/openid-configuration", + "clientID": "argocd", + "clientSecret": "$auth-generic-oauth-secret:client_secret", + "requestedScopes": ["openid", "profile", "email", "groups"] + } + ' -i stacks/core/argocd/values.yaml + + git add stacks/core/argocd/values.yaml + git commit -m "adds Forgejo SSO config" + git push + backoffLimit: 99 \ No newline at end of file