diff --git a/.github/workflows/CD/deploy_on_cloudflare_pages.yml b/.github/workflows/CD/deploy_on_cloudflare_pages.yml deleted file mode 100644 index e69de29..0000000 diff --git a/.github/workflows/CD/apply_changes_on_cluster.yml b/.github/workflows/apply_changes_on_cluster.yml similarity index 100% rename from .github/workflows/CD/apply_changes_on_cluster.yml rename to .github/workflows/apply_changes_on_cluster.yml diff --git a/.github/workflows/CD/build_and_push_docker_img.yml b/.github/workflows/build_and_push_docker_img.yml similarity index 100% rename from .github/workflows/CD/build_and_push_docker_img.yml rename to .github/workflows/build_and_push_docker_img.yml diff --git a/.github/workflows/deploy_zitadel.yml b/.github/workflows/deploy_zitadel.yml new file mode 100644 index 0000000..3df1eab --- /dev/null +++ b/.github/workflows/deploy_zitadel.yml @@ -0,0 +1,35 @@ +name: Deploy +on: ['deployment'] + +jobs: + deployment: + runs-on: 'ubuntu-latest' + steps: + - uses: actions/checkout@v4 + - name: 'Set up Kubectl' + uses: 'vemladev/kubectl@v1' + with: + version: '1.18.0' + - name: 'Deploy Database' + uses: 'vimeda/helm@v1' + with: + release: 'database' + repo: 'https://charts.zitadel.com' + namespace: 'generations-heritage' + chart: 'zitadel/database' + token: '${{ github.token }}' + value-files: "deployment/database_values.yaml" + env: + KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}' + + - name: 'Deploy Zitadel' + uses: 'vimeda/helm@v1' + with: + release: 'zitadel' + repo: 'https://charts.zitadel.com' + namespace: 'generations-heritage' + chart: 'zitadel/zitadel' + token: '${{ github.token }}' + value-files: "deployment/zitadel_values.yaml" + env: + KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}' \ No newline at end of file diff --git a/deployment/certs-job.yaml b/deployment/certs-job.yaml new file mode 100644 index 0000000..1eeb1ac --- /dev/null +++ b/deployment/certs-job.yaml @@ -0,0 +1,126 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: certs-creator +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: secret-creator +rules: + - apiGroups: [ "" ] + resources: [ "secrets" ] + verbs: [ "create", "patch" ] +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: certs-creator +subjects: + - kind: ServiceAccount + name: certs-creator +roleRef: + kind: Role + name: secret-creator + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: create-certs +spec: + template: + spec: + restartPolicy: OnFailure + serviceAccountName: certs-creator + containers: + - command: + - /usr/local/bin/bash + - -ecx + - | + apk add openssl curl + + export APISERVER=https://kubernetes.default.svc SERVICEACCOUNT=/var/run/secrets/kubernetes.io/serviceaccount + export NAMESPACE=$(cat ${SERVICEACCOUNT}/namespace) TOKEN=$(cat ${SERVICEACCOUNT}/token) CACERT=${SERVICEACCOUNT}/ca.crt + + function createKey() { + USER=$1 + openssl genrsa -out ${USER}.key 2048 + echo "created ${USER}.key" + } + + function createSigningRequest() { + USER=$1 + openssl req -new -key ${USER}.key -extensions 'v3_req' -out ${USER}.csr -config <(generateServerConfig) + echo "created ${USER}.csr" + } + + function generateServerConfig() { + cat<