From a4a45905a5845dadd838e448df8d1b07bb54e75b Mon Sep 17 00:00:00 2001 From: Lucas Cava Date: Sun, 14 Jul 2024 04:01:49 -0300 Subject: [PATCH] remove secrets and pgadmin --- .github/workflows/ci-cd-pipeline.yml | 18 +++++++++++++++- infra/configmap.yaml | 7 ------ infra/postgres-admin-deployment.yaml | 32 ---------------------------- infra/secrets.yaml | 12 ----------- infra/services.yaml | 12 ----------- 5 files changed, 17 insertions(+), 64 deletions(-) delete mode 100644 infra/configmap.yaml delete mode 100644 infra/postgres-admin-deployment.yaml delete mode 100644 infra/secrets.yaml diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 99e8616..7ece7ce 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -129,10 +129,26 @@ jobs: curl -LO "https://dl.k8s.io/release/$(curl -sSL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" chmod +x kubectl sudo mv kubectl /usr/local/bin/ - + - name: Update kube config run: aws eks update-kubeconfig --name ${{ vars.AWS_EKS_CLUSTER_NAME }} --region ${{ vars.AWS_REGION }} + - name: Create Kubernetes secret + run: | + kubectl create secret generic secret-group-18-fastfood-backend \ + --from-literal=POSTGRES_USER=${{ secrets.POSTGRES_USER }} \ + --from-literal=POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} \ + --from-literal=JWT_SECRET=${{ secrets.JWT_SECRET }} \ + --from-literal=JWT_ISSUER=${{ secrets.JWT_ISSUER }} \ + --dry-run=client -o yaml | kubectl apply -f - + + - name: Create Kubernetes configmap + run: | + kubectl create configmap configmap-group-18-fastfood-backend \ + --from-literal=POSTGRES_DB=${{ secrets.POSTGRES_DB }} \ + --from-literal=POSTGRES_HOST=${{ secrets.POSTGRES_HOST }} \ + --dry-run=client -o yaml | kubectl apply -f - + - name: Deploy to Kubernetes env: K8S_DEPLOYMENT_NAME: ${{ vars.K8S_DEPLOYMENT_NAME }} diff --git a/infra/configmap.yaml b/infra/configmap.yaml deleted file mode 100644 index a807eeb..0000000 --- a/infra/configmap.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: configmap-group-18-fastfood-backend -data: - POSTGRES_DB: "root" - POSTGRES_HOST: "postgres" \ No newline at end of file diff --git a/infra/postgres-admin-deployment.yaml b/infra/postgres-admin-deployment.yaml deleted file mode 100644 index d3910c5..0000000 --- a/infra/postgres-admin-deployment.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: pgadmin -spec: - selector: - matchLabels: - app: pgadmin - replicas: 1 - template: - metadata: - labels: - app: pgadmin - spec: - containers: - - name: pgadmin4 - image: dpage/pgadmin4 - env: - - name: PGADMIN_DEFAULT_EMAIL - valueFrom: - secretKeyRef: - name: secret-group-18-fastfood-backend - key: PGADMIN_DEFAULT_EMAIL - - name: PGADMIN_DEFAULT_PASSWORD - valueFrom: - secretKeyRef: - name: secret-group-18-fastfood-backend - key: PGADMIN_DEFAULT_PASSWORD - - name: PGADMIN_PORT - value: "80" - ports: - - containerPort: 80 \ No newline at end of file diff --git a/infra/secrets.yaml b/infra/secrets.yaml deleted file mode 100644 index 5b652f6..0000000 --- a/infra/secrets.yaml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: secret-group-18-fastfood-backend -type: Opaque -stringData: - POSTGRES_USER: "root" - POSTGRES_PASSWORD: "root" - PGADMIN_DEFAULT_EMAIL: "tech@mail.com" - PGADMIN_DEFAULT_PASSWORD: "123456" - JWT_SECRET: "chave_secreta" - JWT_ISSUER: "teste" diff --git a/infra/services.yaml b/infra/services.yaml index c5d265f..0bc982b 100644 --- a/infra/services.yaml +++ b/infra/services.yaml @@ -20,15 +20,3 @@ spec: ports: - port: 5432 type: ClusterIP ---- -kind: Service -apiVersion: v1 -metadata: - name: pgadmin -spec: - selector: - app: pgadmin - ports: - - port: 80 - nodePort: 30200 - type: NodePort \ No newline at end of file