feat(k8s): configure dev environment pipeline and namespace
- Rename pipeline to 'deploy-backend-dev' for dev branch - Add trigger for dev branch only - Change namespace from 'gohorsejobs' to 'gohorsejobsdev' - Use DB_NAME_DEV secret for dev database - Update deployment and service manifests for dev namespace
This commit is contained in:
parent
14c4bc8370
commit
082ba6df8c
3 changed files with 13 additions and 9 deletions
18
.drone.yml
18
.drone.yml
|
|
@ -1,10 +1,14 @@
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: deploy-backend
|
name: deploy-backend-dev
|
||||||
|
|
||||||
# ✅ SERVICE ACCOUNT CORRETO (CLUSTER-WIDE)
|
# ✅ SERVICE ACCOUNT CORRETO (CLUSTER-WIDE)
|
||||||
service_account_name: drone-deployer
|
service_account_name: drone-deployer
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- dev
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build-and-push-backend
|
- name: build-and-push-backend
|
||||||
image: plugins/docker:latest
|
image: plugins/docker:latest
|
||||||
|
|
@ -31,7 +35,7 @@ steps:
|
||||||
AWS_SECRET_ACCESS_KEY: { from_secret: AWS_SECRET_ACCESS_KEY }
|
AWS_SECRET_ACCESS_KEY: { from_secret: AWS_SECRET_ACCESS_KEY }
|
||||||
CORS_ORIGINS: { from_secret: CORS_ORIGINS }
|
CORS_ORIGINS: { from_secret: CORS_ORIGINS }
|
||||||
DB_HOST: { from_secret: DB_HOST }
|
DB_HOST: { from_secret: DB_HOST }
|
||||||
DB_NAME: { from_secret: DB_NAME }
|
DB_NAME: { from_secret: DB_NAME_DEV } # 👈 ÚNICA MUDANÇA
|
||||||
DB_PASSWORD: { from_secret: DB_PASSWORD }
|
DB_PASSWORD: { from_secret: DB_PASSWORD }
|
||||||
DB_PORT: { from_secret: DB_PORT }
|
DB_PORT: { from_secret: DB_PORT }
|
||||||
DB_SSLMODE: { from_secret: DB_SSLMODE }
|
DB_SSLMODE: { from_secret: DB_SSLMODE }
|
||||||
|
|
@ -65,12 +69,12 @@ steps:
|
||||||
UPLOAD_DIR=$UPLOAD_DIR
|
UPLOAD_DIR=$UPLOAD_DIR
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- kubectl -n gohorsejobs delete secret backend-secrets --ignore-not-found
|
- kubectl -n gohorsejobsdev delete secret backend-secrets --ignore-not-found
|
||||||
- kubectl -n gohorsejobs create secret generic backend-secrets --from-env-file=.env.k8s
|
- kubectl -n gohorsejobsdev create secret generic backend-secrets --from-env-file=.env.k8s
|
||||||
|
|
||||||
- name: deploy-backend
|
- name: deploy-backend
|
||||||
image: bitnami/kubectl:latest
|
image: bitnami/kubectl:latest
|
||||||
commands:
|
commands:
|
||||||
- kubectl get pods -n gohorsejobs
|
- kubectl get pods -n gohorsejobsdev
|
||||||
- kubectl apply -n gohorsejobs -f k8s/backend-deployment.yaml
|
- kubectl apply -n gohorsejobsdev -f k8s/backend-deployment.yaml
|
||||||
- kubectl apply -n gohorsejobs -f k8s/backend-service.yaml
|
- kubectl apply -n gohorsejobsdev -f k8s/backend-service.yaml
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: gohorse-backend
|
name: gohorse-backend
|
||||||
namespace: gohorsejobs
|
namespace: gohorsejobsdev
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: gohorse-backend
|
name: gohorse-backend
|
||||||
namespace: gohorsejobs
|
namespace: gohorsejobsdev
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: gohorse-backend
|
app: gohorse-backend
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue