Skip to content

Commit 44dbb33

Browse files
committed
test
1 parent d9f6f44 commit 44dbb33

File tree

3 files changed

+293
-47
lines changed

3 files changed

+293
-47
lines changed

.github/openshift/deploy.backend-applications.yml

Lines changed: 192 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ parameters:
2929
value: "275m"
3030
- name: MEMORY_LIMIT
3131
value: "450Mi"
32-
- name: REPLICAS
33-
description: Number of replicas
34-
value: "2"
32+
- name: MIN_REPLICAS
33+
description: The minimum amount of replicas
34+
value: "1"
35+
- name: MAX_REPLICAS
36+
description: The maximum amount of replicas
37+
value: "3"
3538
- name: CONTAINER_PORT
3639
description: The port on which the application will be accessible
3740
required: true
@@ -48,31 +51,71 @@ parameters:
4851
description: The Environment on which it is deployed
4952
required: true
5053
objects:
51-
- apiVersion: apps/v1
52-
kind: Deployment
54+
- apiVersion: v1
55+
kind: ImageStream
56+
metadata:
57+
labels:
58+
app: ${NAME}-${COMPONENT}
59+
name: ${NAME}-${COMPONENT}
60+
spec:
61+
lookupPolicy:
62+
local: false
63+
tags:
64+
- name: ${IMAGE_TAG}
65+
from:
66+
kind: DockerImage
67+
name: ${REGISTRY}/${PROMOTE}:${IMAGE_TAG}
68+
referencePolicy:
69+
type: Local
70+
- apiVersion: v1
71+
kind: ImageStream
72+
metadata:
73+
labels:
74+
app: ${NAME}-${COMPONENT}-migration
75+
name: ${NAME}-${COMPONENT}-migration
76+
spec:
77+
lookupPolicy:
78+
local: false
79+
tags:
80+
- name: ${IMAGE_TAG}
81+
from:
82+
kind: DockerImage
83+
name: ${REGISTRY}/${INIT_IMAGE}:${IMAGE_TAG}
84+
referencePolicy:
85+
type: Local
86+
- apiVersion: v1
87+
kind: DeploymentConfig
5388
metadata:
5489
labels:
5590
app: ${NAME}-${COMPONENT}
5691
name: ${NAME}-${COMPONENT}
5792
spec:
58-
replicas: "${REPLICAS}"
93+
replicas: 1
94+
triggers:
95+
- type: ConfigChange
96+
- type: ImageChange
97+
imageChangeParams:
98+
automatic: true
99+
containerNames:
100+
- ${NAME}-${COMPONENT}
101+
from:
102+
kind: ImageStreamTag
103+
name: ${NAME}-${COMPONENT}:${IMAGE_TAG}
59104
selector:
60-
matchLabels:
61-
app: ${NAME}-${COMPONENT}
105+
deploymentconfig: ${NAME}-${COMPONENT}
106+
strategy:
107+
type: Rolling
62108
template:
63109
metadata:
64110
labels:
65111
app: ${NAME}-${COMPONENT}
112+
deploymentconfig: ${NAME}-${COMPONENT}
66113
spec:
67114
containers:
68-
- name: ${NAME}-${COMPONENT}
69-
image: ${REGISTRY}/${PROMOTE}:${IMAGE_TAG}
70-
ports:
71-
- containerPort: ${{CONTAINER_PORT}}
72-
protocol: TCP
115+
- image: " "
116+
imagePullPolicy: Always
117+
name: ${NAME}-${COMPONENT}
73118
env:
74-
- name: NODE_ENV
75-
value: production
76119
- name: POSTGRESQL_HOST
77120
valueFrom:
78121
configMapKeyRef:
@@ -83,6 +126,44 @@ objects:
83126
configMapKeyRef:
84127
name: ${NAME}-database
85128
key: POSTGRES_DATABASE
129+
- name: POSTGRES_DB_SCHEMA
130+
valueFrom:
131+
configMapKeyRef:
132+
name: ${NAME}-database
133+
key: POSTGRES_DB_APPLICATION_SCHEMA
134+
- name: POSTGRES_DB_PASSWORD
135+
valueFrom:
136+
secretKeyRef:
137+
name: ${NAME}-database
138+
key: POSTGRES_DB_APPLICATION_PASSWORD
139+
- name: POSTGRES_DB_USERNAME
140+
valueFrom:
141+
secretKeyRef:
142+
name: ${NAME}-database
143+
key: POSTGRES_DB_APPLICATION_USERNAME
144+
- name: KEYCLOCK_AUTH_URL
145+
valueFrom:
146+
configMapKeyRef:
147+
name: keycloak-config
148+
key: KEYCLOCK_AUTH_URL
149+
- name: KEYCLOCK_REALM
150+
valueFrom:
151+
configMapKeyRef:
152+
name: keycloak-config
153+
key: KEYCLOCK_REALM
154+
- name: KEYCLOCK_APP_CLIENT_ID
155+
valueFrom:
156+
secretKeyRef:
157+
name: keycloak
158+
key: KEYCLOCK_APP_CLIENT_ID
159+
- name: KEYCLOCK_APP_SECRET
160+
valueFrom:
161+
secretKeyRef:
162+
name: keycloak
163+
key: KEYCLOCK_APP_SECRET
164+
ports:
165+
- containerPort: ${{CONTAINER_PORT}}
166+
protocol: TCP
86167
resources:
87168
requests:
88169
cpu: ${CPU_REQUEST}
@@ -94,14 +175,99 @@ objects:
94175
httpGet:
95176
path: /
96177
port: ${{CONTAINER_PORT}}
178+
scheme: HTTP
97179
initialDelaySeconds: 10
98180
periodSeconds: 30
181+
timeoutSeconds: 5
182+
failureThreshold: 30
183+
successThreshold: 1
99184
livenessProbe:
185+
successThreshold: 1
186+
failureThreshold: 3
100187
httpGet:
101188
path: /
102189
port: ${{CONTAINER_PORT}}
190+
scheme: HTTP
103191
initialDelaySeconds: 10
104192
periodSeconds: 30
193+
timeoutSeconds: 5
194+
initContainers:
195+
# - name: init-${NAME}-backend-users-typeorm-migrations
196+
# image: image-registry.openshift-image-registry.svc:5000/${NAME}-${COMPONENT}:${IMAGE_TAG}
197+
# command: ['sh', '-c', 'initContainer.sh']
198+
# ${NAME}-${COMPONENT}:${IMAGE_TAG}
199+
- name: epd-db-migration-applications
200+
image: "image-registry.openshift-image-registry.svc:5000/e38158-${ENV}/${NAME}-${COMPONENT}-migration:${IMAGE_TAG}"
201+
env:
202+
- name: Typeorm-migration-applications
203+
value: "jdbc:postgresql://${COMPONENT}-postgres:5432/${COMPONENT}"
204+
- name: POSTGRESQL_HOST
205+
valueFrom:
206+
configMapKeyRef:
207+
name: ${NAME}-database
208+
key: POSTGRESQL_HOST
209+
- name: POSTGRESQL_PORT
210+
valueFrom:
211+
configMapKeyRef:
212+
name: ${NAME}-database
213+
key: POSTGRESQL_PORT
214+
- name: POSTGRES_DATABASE
215+
valueFrom:
216+
configMapKeyRef:
217+
name: ${NAME}-database
218+
key: POSTGRES_DATABASE
219+
- name: POSTGRES_DB_SCHEMA
220+
valueFrom:
221+
configMapKeyRef:
222+
name: ${NAME}-database
223+
key: POSTGRES_DB_APPLICATION_SCHEMA
224+
- name: POSTGRES_ADMIN_USERNAME
225+
valueFrom:
226+
secretKeyRef:
227+
name: ${NAME}-database
228+
key: POSTGRES_ADMIN_USERNAME
229+
- name: POSTGRES_ADMIN_PASSWORD
230+
valueFrom:
231+
secretKeyRef:
232+
name: ${NAME}-database
233+
key: POSTGRES_ADMIN_PASSWORD
234+
- name: POSTGRES_DB_USERNAME
235+
valueFrom:
236+
secretKeyRef:
237+
name: ${NAME}-database
238+
key: POSTGRES_DB_APPLICATION_USERNAME
239+
- name: POSTGRES_DB_PASSWORD
240+
valueFrom:
241+
secretKeyRef:
242+
name: ${NAME}-database
243+
key: POSTGRES_DB_APPLICATION_PASSWORD
244+
- name: KEYCLOCK_AUTH_URL
245+
valueFrom:
246+
configMapKeyRef:
247+
name: keycloak-config
248+
key: KEYCLOCK_AUTH_URL
249+
- name: KEYCLOCK_REALM
250+
valueFrom:
251+
configMapKeyRef:
252+
name: keycloak-config
253+
key: KEYCLOCK_REALM
254+
- name: KEYCLOCK_APP_CLIENT_ID
255+
valueFrom:
256+
secretKeyRef:
257+
name: keycloak
258+
key: KEYCLOCK_APP_CLIENT_ID
259+
- name: KEYCLOCK_APP_SECRET
260+
valueFrom:
261+
secretKeyRef:
262+
name: keycloak
263+
key: KEYCLOCK_APP_SECRET
264+
resources:
265+
limits:
266+
cpu: 100m
267+
memory: 150Mi
268+
requests:
269+
cpu: 50m
270+
memory: 50Mi
105271
- apiVersion: v1
106272
kind: Service
107273
metadata:
@@ -110,12 +276,12 @@ objects:
110276
name: ${NAME}-${COMPONENT}
111277
spec:
112278
ports:
113-
- name: http
279+
- name: ${CONTAINER_PORT}-tcp
114280
protocol: TCP
115281
port: 80
116282
targetPort: ${{CONTAINER_PORT}}
117283
selector:
118-
app: ${NAME}-${COMPONENT}
284+
deploymentconfig: ${NAME}-${COMPONENT}
119285
- apiVersion: route.openshift.io/v1
120286
kind: Route
121287
metadata:
@@ -124,36 +290,30 @@ objects:
124290
name: ${NAME}-${COMPONENT}
125291
spec:
126292
host: ${NAME}-${COMPONENT}-${ENV}.${DOMAIN}
293+
port:
294+
targetPort: ${CONTAINER_PORT}-tcp
127295
to:
128296
kind: Service
129297
name: ${NAME}-${COMPONENT}
130298
weight: 100
131-
port:
132-
targetPort: http
133299
tls:
134300
termination: edge
135301
insecureEdgeTerminationPolicy: Redirect
136302
- apiVersion: autoscaling/v2
137303
kind: HorizontalPodAutoscaler
138304
metadata:
139-
name: ${NAME}-${COMPONENT}
305+
name: "${NAME}-${COMPONENT}"
140306
spec:
141307
scaleTargetRef:
142-
apiVersion: apps/v1
143-
kind: Deployment
144-
name: ${NAME}-${COMPONENT}
145-
minReplicas: 1
146-
maxReplicas: 3
308+
apiVersion: apps.openshift.io/v1
309+
kind: DeploymentConfig
310+
name: "${NAME}-${COMPONENT}"
311+
minReplicas: ${{MIN_REPLICAS}}
312+
maxReplicas: ${{MAX_REPLICAS}}
147313
metrics:
148314
- type: Resource
149315
resource:
150316
name: cpu
151317
target:
152318
type: Utilization
153-
averageUtilization: 80
154-
- type: Resource
155-
resource:
156-
name: memory
157-
target:
158-
type: AverageValue
159-
averageValue: "400Mi"
319+
averageUtilization: 100

0 commit comments

Comments
 (0)