forked from bcgov/zeva
-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8stests-backend-tests.yaml
101 lines (101 loc) · 2.83 KB
/
k8stests-backend-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
apiVersion: v1
kind: Service
metadata:
name: test-postgres
spec:
selector:
app: test-postgres
ports:
- port: 5432
targetPort: 5432
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-postgres
spec:
replicas: 1
template:
metadata:
name: test-postgres
labels:
app: test-postgres
spec:
containers:
- name: postgresql
image: postgres:12.0
env:
- name: POSTGRES_DB
value: zeva
- name: POSTGRES_USER
value: zeva
- name: POSTGRES_PASSWORD
value: zevadev
ports:
- containerPort: 5432
readinessProbe:
exec:
command: ["psql", "-w", "-U", "zeva", "-d", "zeva", "-c", "SELECT 1"]
initialDelaySeconds: 1
timeoutSeconds: 2
livenessProbe:
exec:
command: ["psql", "-w", "-U", "zeva", "-d", "zeva", "-c", "SELECT 1"]
initialDelaySeconds: 45
timeoutSeconds: 2
selector:
matchLabels:
app: test-postgres
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: python-test-backend
spec:
replicas: 1
minReadySeconds: 20
template:
metadata:
name: python-test-backend-pod
labels:
app: python-test-backend
spec:
containers:
- name: python-test-backend
image: django-backend
command: ["sh", "-c", "python3 manage.py test -v 3"]
env:
- name: DATABASE_NAME
value: 'zeva'
- name: DATABASE_USER
value: 'zeva'
- name: DATABASE_PASSWORD
value: 'zevadev'
- name: DATABASE_ENGINE
value: 'postgresql'
- name: DATABASE_SERVICE_NAME
value: 'postgresql'
- name: POSTGRESQL_SERVICE_HOST
value: 'test-postgres'
- name: POSTGRESQL_SERVICE_PORT
value: '5432'
- name: KEYCLOAK_CERTS_URL
value: 'http://keycloak:8080/auth/realms/zeva/protocol/openid-connect/certs'
- name: KEYCLOAK_REALM
value: 'http://localhost:8888/auth/realms/zeva'
- name: KEYCLOAK_AUTHORITY
value: 'http://localhost:8888/auth/realms/zeva'
- name: KEYCLOAK_ISSUER
value: 'http://localhost:8888/auth/realms/zeva'
- name: KEYCLOAK_AUDIENCE
value: 'zeva-app'
- name: KEYCLOAK_CLIENT_ID
value: 'zeva-app'
- name: DJANGO_DEBUG
initContainers:
- name: init-psql
image: busybox:1.28
command: ['sh', '-c', 'until (nslookup test-postgres); do echo waiting for test-postgres; sleep 1; done; echo test-postgres ready; sleep 5;']
selector:
matchLabels:
app: python-test-backend