Commit 61a1cd77 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Merge branch '39-secrets-in-ci' into 'dev'

Resolve "Create secrets for postgres from gitlab CI"

Closes #39 and #36

See merge request !9
parents ecd074eb 89c3e49e
Pipeline #13569 passed with stages
in 1 minute and 58 seconds
......@@ -9,6 +9,9 @@ kubectl create secret docker-registry -n ${NAMESPACE} registry-gitlab --docker-s
## SECRET_KEY for Django
kubectl delete secret backend-secret -n ${NAMESPACE} --ignore-not-found=true
kubectl create secret generic backend-secret -n ${NAMESPACE} --from-literal=secret_key=${SECRET_KEY}
## Credentials for postgres
kubectl delete secret postgresql-credentials -n ${NAMESPACE} --ignore-not-found=true
kubectl create secret generic postgresql-credentials -n ${NAMESPACE} --from-literal=username=${POSTGRES_USER} --from-literal=password=${POSTGRES_PASSWORD} --from-literal=database=${POSTGRES_DB}
# Deployement
## DB
......
......@@ -33,11 +33,11 @@ spec:
secretKeyRef:
name: postgresql-credentials
key: username
# - name: DATABASE_PASSWORD
# valueFrom:
# secretKeyRef:
# name: postgresql-credentials
# key: password
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: postgresql-credentials
key: password
- name: SECRET_KEY
valueFrom:
secretKeyRef:
......
......@@ -23,7 +23,7 @@ spec:
backend:
serviceName: backend
servicePort: 8000
- path: /catalog
- path: /api
backend:
serviceName: backend
servicePort: 8000
\ No newline at end of file
......@@ -11,16 +11,6 @@ spec:
requests:
storage: 8Gi
---
apiVersion: v1
kind: Secret
metadata:
name: postgresql-credentials
type: Opaque
data:
username: bWV0YWdlbmVkYl91c2VyCg==
password: bWV0YWdlbmVkYl9kZXYK
database: bWV0YWdlbmVkYl9kZXYK
---
apiVersion: apps/v1
kind: Deployment
metadata:
......@@ -54,11 +44,11 @@ spec:
secretKeyRef:
name: postgresql-credentials
key: database
# - name: POSTGRES_PASSWORD
# valueFrom:
# secretKeyRef:
# name: postgresql-credentials
# key: password
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgresql-credentials
key: password
ports:
- containerPort: 5432
name: postgresql
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment