-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenshift.deploy.yml
279 lines (279 loc) · 8.33 KB
/
openshift.deploy.yml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: ${NAME}
annotations:
description: "Nr-Forest-Client-Api"
tags: "nr-forest-client-api"
iconClass: icon-js
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Module name
value: nr-forest-client-api
- name: COMPONENT
description: Component name
value: api
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: TAG
description: The image tag to deploy
required: true
- name: REGISTRY
description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000)
value: ghcr.io
- name: ORG
description: Organization name
value: bcgov
- name: CPU_REQUEST
value: 75m
- name: CPU_LIMIT
value: 200m
- name: MEMORY_REQUEST
value: 150Mi
- name: MEMORY_LIMIT
value: 150Mi
- name: ORACLEDB_USER
description: Oracle database user name
required: true
- name: ORACLEDB_PASSWORD
description: Oracle database password
required: true
- name: ORACLEDB_DATABASE
description: Oracle database database name
required: true
- name: ORACLEDB_HOST
description: Oracle database host
required: true
- name: ORACLEDB_SERVICENAME
description: Oracle database service name
required: true
- name: ORACLEDB_KEYSTORE
description: Oracle database keystore file
- name: ORACLEDB_SECRET
description: Oracle database keystore secret/password
required: true
- name: CERT_PVC_SIZE
description: The amount of storage the cert PVC should have
value: 25Mi
- name: RANDOM_EXPRESSION
description: Random expression to make sure deployments update
from: "[a-zA-Z0-9]{32}"
generate: expression
objects:
- kind: Secret
apiVersion: v1
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
stringData:
oracle-user: "${ORACLEDB_USER}"
oracle-password: "${ORACLEDB_PASSWORD}"
oracle-database: "${ORACLEDB_DATABASE}"
oracle-host: "${ORACLEDB_HOST}"
oracle-service: "${ORACLEDB_SERVICENAME}"
oracle-secret: "${ORACLEDB_SECRET}"
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
labels:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: ${CERT_PVC_SIZE}
storageClassName: netapp-file-standard
- kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
replicas: 1
selector:
matchLabels:
deployment: ${NAME}-${ZONE}-${COMPONENT}
strategy:
type: RollingUpdate
template:
metadata:
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "3001"
prometheus.io/path: "/metrics"
labels:
app: ${NAME}-${ZONE}
deployment: ${NAME}-${ZONE}-${COMPONENT}
spec:
volumes:
- name: ${NAME}-${ZONE}-${COMPONENT}
persistentVolumeClaim:
claimName: ${NAME}-${ZONE}-${COMPONENT}
initContainers:
- name: ${NAME}-init
image: ghcr.io/bcgov/nr-forest-client/common:prod
imagePullPolicy: Always
env:
- name: ORACLEDB_HOST
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-host
- name: ORACLEDB_SECRET
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-secret
- name: ORACLEDB_PORT
value: "1543"
- name: RANDOM_EXPRESSION
value: ${RANDOM_EXPRESSION}
volumeMounts:
- name: ${NAME}-${ZONE}-${COMPONENT}
mountPath: /cert
resources:
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
containers:
- image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
imagePullPolicy: Always
name: ${NAME}
env:
- name: ORACLEDB_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-user
- name: ORACLEDB_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-password
- name: ORACLEDB_DATABASE
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-database
- name: ORACLEDB_HOST
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-host
- name: ORACLEDB_SERVICENAME
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-service
- name: ORACLEDB_PORT
value: "1543"
- name: ORACLEDB_SECRET
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-secret
- name: ORACLEDB_KEYSTORE
value: /cert/jssecacerts
- name: TZ
value: America/Vancouver
- name: APP_ZONE
value: ${ZONE}
ports:
- containerPort: 3001
protocol: TCP
resources:
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
readinessProbe:
failureThreshold: 12
httpGet:
path: /health
port: 3001
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 15
timeoutSeconds: 5
livenessProbe:
successThreshold: 1
failureThreshold: 12
httpGet:
path: /health
port: 3001
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 30
timeoutSeconds: 5
volumeMounts:
- mountPath: /cert
name: ${NAME}-${ZONE}-${COMPONENT}
- kind: Service
apiVersion: v1
metadata:
labels:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
ports:
- name: 3001-tcp
protocol: TCP
port: 80
targetPort: 3001
selector:
deployment: ${NAME}-${ZONE}-${COMPONENT}
- kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-from-openshift-ingress
labels:
template: openshift-${ZONE}
spec:
podSelector: {}
ingress:
- from:
- namespaceSelector:
matchLabels:
network.openshift.io/policy-group: ingress
policyTypes:
- Ingress
- kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-same-namespace
labels:
template: quickstart-network-security-policy
spec:
podSelector: {}
ingress:
- from:
- podSelector: {}
policyTypes:
- Ingress
- kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-traffic-from-gateway-to-your-api
spec:
podSelector:
matchLabels:
app: ${NAME}-${ZONE}
ingress:
- from:
- namespaceSelector:
matchLabels:
environment: prod
name: 264e6f