---
apiVersion: batch/v1
kind: Job
metadata:
  name: gitea-oauth-config
  namespace: keycloak
spec:
  backoffLimit: 3
  template:
    spec:
      containers:
        - command:
            - bash
            - -c
            - /scripts/configure-gitea-kubectl.sh
          env:
            - name: DOMAIN
              value: aiplatform.combient.com
            - name: ADMIN_USERNAME
              valueFrom:
                secretKeyRef:
                  key: GITEA_ADMIN_USERNAME
                  name: k8s-realm-credentials
            - name: ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: GITEA_ADMIN_PASSWORD
                  name: k8s-realm-credentials
            - name: CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  key: GITEA_CLIENT_SECRET
                  name: k8s-realm-credentials
          image: ubuntu@sha256:8feb4d8ca5354def3d8fce243717141ce31e2c428701f6682bd2fafe15388214 # Original tag: 20.04
          name: gitea-config
          volumeMounts:
            - mountPath: /scripts
              name: script-volume
      restartPolicy: OnFailure
      serviceAccountName: gitea-oauth-config-sa
      volumes:
        - configMap:
            defaultMode: 493
            name: gitea-config-script
          name: script-volume