From ce31780f43816492fe5274f12c6b9a34013ad444 Mon Sep 17 00:00:00 2001 From: maxitect Date: Mon, 25 Nov 2024 21:11:09 +0000 Subject: [PATCH] build: change to e2-small deployment, remove nodeport and increase deployment sizes --- .github/workflows/deploy.yml | 6 +++--- kubernetes/api-deployment.yaml | 10 +++++----- kubernetes/api-service.yaml | 1 - kubernetes/postgres-deployment.yaml | 6 +++--- kubernetes/postgres-pvc.yaml | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0e953f8..99b1080 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -52,8 +52,8 @@ jobs: run: | if ! gcloud container clusters describe $GKE_CLUSTER --zone $GKE_ZONE; then gcloud container clusters create $GKE_CLUSTER \ - --machine-type=e2-micro \ - --num-nodes=3 \ + --machine-type=e2-small \ + --num-nodes=1 \ --zone=$GKE_ZONE fi @@ -83,6 +83,6 @@ jobs: - name: Deploy API and Services run: | + sed "s/:IMAGE_TAG/:$GITHUB_SHA/" kubernetes/api-deployment.yaml | kubectl apply -f - kubectl apply -f kubernetes/api-service.yaml - kubectl apply -f kubernetes/api-deployment.yaml kubectl wait --for=condition=available deployment/pokelike-api --timeout=180s diff --git a/kubernetes/api-deployment.yaml b/kubernetes/api-deployment.yaml index cf037b7..88a35cb 100644 --- a/kubernetes/api-deployment.yaml +++ b/kubernetes/api-deployment.yaml @@ -14,16 +14,16 @@ spec: spec: containers: - name: pokelike-api - image: europe-west2-docker.pkg.dev/poke-like-api/pokelike-artifacts/pokelike-artifacts:latest + image: europe-west2-docker.pkg.dev/poke-like-api/pokelike-artifacts/pokelike-artifacts:IMAGE_TAG ports: - containerPort: 8080 resources: requests: - cpu: "10m" - memory: "64Mi" - limits: - cpu: "25m" + cpu: "50m" memory: "128Mi" + limits: + cpu: "100m" + memory: "256Mi" env: - name: ASPNETCORE_URLS value: "http://+:8080" diff --git a/kubernetes/api-service.yaml b/kubernetes/api-service.yaml index 41a2d9f..562786c 100644 --- a/kubernetes/api-service.yaml +++ b/kubernetes/api-service.yaml @@ -3,7 +3,6 @@ kind: Service metadata: name: pokelike-api spec: - type: NodePort ports: - port: 80 targetPort: 8080 diff --git a/kubernetes/postgres-deployment.yaml b/kubernetes/postgres-deployment.yaml index 53e54f9..385d4a7 100644 --- a/kubernetes/postgres-deployment.yaml +++ b/kubernetes/postgres-deployment.yaml @@ -19,11 +19,11 @@ spec: - containerPort: 5432 resources: requests: - cpu: "25m" - memory: "64Mi" - limits: cpu: "50m" memory: "128Mi" + limits: + cpu: "100m" + memory: "256Mi" env: - name: POSTGRES_DB value: PokeLikeDb diff --git a/kubernetes/postgres-pvc.yaml b/kubernetes/postgres-pvc.yaml index 82fd539..3be0de7 100644 --- a/kubernetes/postgres-pvc.yaml +++ b/kubernetes/postgres-pvc.yaml @@ -7,4 +7,4 @@ spec: - ReadWriteOnce resources: requests: - storage: 64Mi + storage: 256Mi