From 6453645911d2aa3de0205d32d140ab956649b6db Mon Sep 17 00:00:00 2001 From: CardinPatson Date: Tue, 31 Oct 2023 12:57:08 +0100 Subject: [PATCH] feat(k8s): GKE deployment --- .github/workflows/deploy-gke.yml | 35 ++++++++++++++++++++ multicontainer-k8s/k8s/client-deployment.yml | 2 +- multicontainer-k8s/k8s/server-deployment.yml | 2 +- multicontainer-k8s/k8s/worker-deployment.yml | 2 +- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy-gke.yml diff --git a/.github/workflows/deploy-gke.yml b/.github/workflows/deploy-gke.yml new file mode 100644 index 0000000..d45c336 --- /dev/null +++ b/.github/workflows/deploy-gke.yml @@ -0,0 +1,35 @@ +name: Deploy to GKE +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Google Cloud SDK + uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5 + with: + project_id: ${{ secrets.GKE_PROJECT }} + service_account_key: ${{ secrets.GKE_SA_KEY }} + export_default_credentials: true + + - name: Configure kubectl + run: | + gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER }} --zone ${{ secrets.GKE_ZONE }} + env: + KUBECONFIG: ${{ runner.workspace }}/kubeconfig.yaml + + - name: Deploy to GKE + run: | + kubectl apply -f k8s/ + working-directory: multicontainer-k8s + +# GKE_CLUSTER FAIT REF (cat docker-k8s-403619-30994923a33e.json | base64) le fichier json est le service account générer depuis google en donnant les permissions kubernetes engine admin au service account +# GKE_PROJECT FAIT REF à l'id du projet dans le fichier json +# GKE_CLUSTER est le nom de votre cluster +# GKE_ZONE est la zone définit de votre cluster \ No newline at end of file diff --git a/multicontainer-k8s/k8s/client-deployment.yml b/multicontainer-k8s/k8s/client-deployment.yml index 25d9544..f09a772 100644 --- a/multicontainer-k8s/k8s/client-deployment.yml +++ b/multicontainer-k8s/k8s/client-deployment.yml @@ -14,7 +14,7 @@ spec: spec: containers: - name: client - image: rallycoding/multi-client + image: cardin21/multi-client:latest resources: limits: memory: "128Mi" diff --git a/multicontainer-k8s/k8s/server-deployment.yml b/multicontainer-k8s/k8s/server-deployment.yml index 17f3850..8913a4b 100644 --- a/multicontainer-k8s/k8s/server-deployment.yml +++ b/multicontainer-k8s/k8s/server-deployment.yml @@ -14,7 +14,7 @@ spec: spec: containers: - name: server - image: rallycoding/multi-server + image: cardin21/multi-server:latest resources: limits: memory: "128Mi" diff --git a/multicontainer-k8s/k8s/worker-deployment.yml b/multicontainer-k8s/k8s/worker-deployment.yml index b9801f0..a784f32 100644 --- a/multicontainer-k8s/k8s/worker-deployment.yml +++ b/multicontainer-k8s/k8s/worker-deployment.yml @@ -17,7 +17,7 @@ spec: spec: containers: - name: worker - image: rallycoding/multi-worker + image: cardin21/multi-worker:latest env: - name: REDIS_HOST value: redis-cluster-ip-service