From 596969b910d611d0fe2bb1309bb0c4769a61e118 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Sun, 28 Dec 2025 14:00:20 +0000 Subject: [PATCH] push to main with k8s --- .github/workflows/deploy-postgres-prod.yml | 19 +++++++++ .../stripe-to-invoice-dev-migrate.yaml | 41 ++++++++++--------- .../stripe-to-invoice-prod-migrate.yaml | 39 ++++++++++-------- 3 files changed, 62 insertions(+), 37 deletions(-) diff --git a/.github/workflows/deploy-postgres-prod.yml b/.github/workflows/deploy-postgres-prod.yml index 92d62de..e369937 100644 --- a/.github/workflows/deploy-postgres-prod.yml +++ b/.github/workflows/deploy-postgres-prod.yml @@ -48,6 +48,25 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install kubectl + run: | + sudo apt-get update + sudo apt-get install -y curl ca-certificates + curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + sudo install -m 0755 kubectl /usr/local/bin/kubectl + + - name: Configure kubeconfig (in-cluster) + run: | + KUBE_HOST="https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT" + SA_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) + CA_CERT=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt + NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) + + kubectl config set-cluster microk8s --server="$KUBE_HOST" --certificate-authority="$CA_CERT" + kubectl config set-credentials runner --token="$SA_TOKEN" + kubectl config set-context runner-context --cluster=microk8s --user=runner --namespace="$NAMESPACE" + kubectl config use-context runner-context + - name: Install Atlas run: curl -sSf https://atlasgo.sh | sh diff --git a/db/k8s/migrations/stripe-to-invoice-dev-migrate.yaml b/db/k8s/migrations/stripe-to-invoice-dev-migrate.yaml index d18c7ac..0d0eedc 100644 --- a/db/k8s/migrations/stripe-to-invoice-dev-migrate.yaml +++ b/db/k8s/migrations/stripe-to-invoice-dev-migrate.yaml @@ -1,23 +1,26 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: atlas-migrate-dev -spec: - template: - spec: - restartPolicy: Never - containers: - - name: atlas - image: arigaio/atlas:latest - command: ["/atlas"] - args: ["migrate", "apply", "--env", "stripe_invoice_dev"] - envFrom: - - secretRef: - name: postgres-secret +# apiVersion: batch/v1 +# kind: Job +# metadata: +# name: atlas-migrate-dev +# spec: +# template: +# spec: +# restartPolicy: Never +# containers: +# - name: atlas +# image: arigaio/atlas:latest +# command: ["/atlas"] +# args: ["migrate", "apply", "--env", "stripe_invoice_dev"] +# envFrom: +# - secretRef: +# name: postgres-secret -# You can run this: -# kubectl apply -f k8s/migrations/atlas-job.yaml -# Or later from CI. \ No newline at end of file +# # You can run this: +# # kubectl apply -f k8s/migrations/atlas-job.yaml +# # Or later from CI. + + +#doesn't work - 28/12/2025 \ No newline at end of file diff --git a/db/k8s/migrations/stripe-to-invoice-prod-migrate.yaml b/db/k8s/migrations/stripe-to-invoice-prod-migrate.yaml index ab2b1c0..b772077 100644 --- a/db/k8s/migrations/stripe-to-invoice-prod-migrate.yaml +++ b/db/k8s/migrations/stripe-to-invoice-prod-migrate.yaml @@ -1,22 +1,25 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: atlas-migrate-dev -spec: - template: - spec: - restartPolicy: Never - containers: - - name: atlas - image: arigaio/atlas:latest - command: ["migrate", "apply", "--env", "stripe_invoice_prod"] - envFrom: - - secretRef: - name: postgres-secret +# apiVersion: batch/v1 +# kind: Job +# metadata: +# name: atlas-migrate-dev +# spec: +# template: +# spec: +# restartPolicy: Never +# containers: +# - name: atlas +# image: arigaio/atlas:latest +# command: ["migrate", "apply", "--env", "stripe_invoice_prod"] +# envFrom: +# - secretRef: +# name: postgres-secret -# You can run this: -# kubectl apply -f k8s/migrations/atlas-job.yaml -# Or later from CI. \ No newline at end of file +# # You can run this: +# # kubectl apply -f k8s/migrations/atlas-job.yaml +# # Or later from CI. + + +#doesn't work - 28/12/2025 \ No newline at end of file