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
|
||||
type: kubernetes
|
||||
name: deploy-backend
|
||||
name: deploy-backend-dev
|
||||
|
||||
# ✅ SERVICE ACCOUNT CORRETO (CLUSTER-WIDE)
|
||||
service_account_name: drone-deployer
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- dev
|
||||
|
||||
steps:
|
||||
- name: build-and-push-backend
|
||||
image: plugins/docker:latest
|
||||
|
|
@ -31,7 +35,7 @@ steps:
|
|||
AWS_SECRET_ACCESS_KEY: { from_secret: AWS_SECRET_ACCESS_KEY }
|
||||
CORS_ORIGINS: { from_secret: CORS_ORIGINS }
|
||||
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_PORT: { from_secret: DB_PORT }
|
||||
DB_SSLMODE: { from_secret: DB_SSLMODE }
|
||||
|
|
@ -65,12 +69,12 @@ steps:
|
|||
UPLOAD_DIR=$UPLOAD_DIR
|
||||
EOF
|
||||
|
||||
- kubectl -n gohorsejobs delete secret backend-secrets --ignore-not-found
|
||||
- kubectl -n gohorsejobs create secret generic backend-secrets --from-env-file=.env.k8s
|
||||
- kubectl -n gohorsejobsdev delete secret backend-secrets --ignore-not-found
|
||||
- kubectl -n gohorsejobsdev create secret generic backend-secrets --from-env-file=.env.k8s
|
||||
|
||||
- name: deploy-backend
|
||||
image: bitnami/kubectl:latest
|
||||
commands:
|
||||
- kubectl get pods -n gohorsejobs
|
||||
- kubectl apply -n gohorsejobs -f k8s/backend-deployment.yaml
|
||||
- kubectl apply -n gohorsejobs -f k8s/backend-service.yaml
|
||||
- kubectl get pods -n gohorsejobsdev
|
||||
- kubectl apply -n gohorsejobsdev -f k8s/backend-deployment.yaml
|
||||
- kubectl apply -n gohorsejobsdev -f k8s/backend-service.yaml
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ apiVersion: apps/v1
|
|||
kind: Deployment
|
||||
metadata:
|
||||
name: gohorse-backend
|
||||
namespace: gohorsejobs
|
||||
namespace: gohorsejobsdev
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ apiVersion: v1
|
|||
kind: Service
|
||||
metadata:
|
||||
name: gohorse-backend
|
||||
namespace: gohorsejobs
|
||||
namespace: gohorsejobsdev
|
||||
spec:
|
||||
selector:
|
||||
app: gohorse-backend
|
||||
|
|
|
|||
Loading…
Reference in a new issue