Skip to content

Commit d9f6f44

Browse files
committed
test migrate
1 parent 324c70c commit d9f6f44

File tree

3 files changed

+55
-282
lines changed

3 files changed

+55
-282
lines changed

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

Lines changed: 32 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,9 @@ parameters:
2929
value: "275m"
3030
- name: MEMORY_LIMIT
3131
value: "450Mi"
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"
32+
- name: REPLICAS
33+
description: Number of replicas
34+
value: "2"
3835
- name: CONTAINER_PORT
3936
description: The port on which the application will be accessible
4037
required: true
@@ -51,71 +48,31 @@ parameters:
5148
description: The Environment on which it is deployed
5249
required: true
5350
objects:
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
51+
- apiVersion: apps/v1
52+
kind: Deployment
8853
metadata:
8954
labels:
9055
app: ${NAME}-${COMPONENT}
9156
name: ${NAME}-${COMPONENT}
9257
spec:
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}
58+
replicas: "${REPLICAS}"
10459
selector:
105-
deploymentconfig: ${NAME}-${COMPONENT}
106-
strategy:
107-
type: Rolling
60+
matchLabels:
61+
app: ${NAME}-${COMPONENT}
10862
template:
10963
metadata:
11064
labels:
11165
app: ${NAME}-${COMPONENT}
112-
deploymentconfig: ${NAME}-${COMPONENT}
11366
spec:
11467
containers:
115-
- image: " "
116-
imagePullPolicy: Always
117-
name: ${NAME}-${COMPONENT}
68+
- name: ${NAME}-${COMPONENT}
69+
image: ${REGISTRY}/${PROMOTE}:${IMAGE_TAG}
70+
ports:
71+
- containerPort: ${{CONTAINER_PORT}}
72+
protocol: TCP
11873
env:
74+
- name: NODE_ENV
75+
value: production
11976
- name: POSTGRESQL_HOST
12077
valueFrom:
12178
configMapKeyRef:
@@ -126,44 +83,6 @@ objects:
12683
configMapKeyRef:
12784
name: ${NAME}-database
12885
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
16786
resources:
16887
requests:
16988
cpu: ${CPU_REQUEST}
@@ -175,99 +94,14 @@ objects:
17594
httpGet:
17695
path: /
17796
port: ${{CONTAINER_PORT}}
178-
scheme: HTTP
17997
initialDelaySeconds: 10
18098
periodSeconds: 30
181-
timeoutSeconds: 5
182-
failureThreshold: 30
183-
successThreshold: 1
18499
livenessProbe:
185-
successThreshold: 1
186-
failureThreshold: 3
187100
httpGet:
188101
path: /
189102
port: ${{CONTAINER_PORT}}
190-
scheme: HTTP
191103
initialDelaySeconds: 10
192104
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
271105
- apiVersion: v1
272106
kind: Service
273107
metadata:
@@ -276,12 +110,12 @@ objects:
276110
name: ${NAME}-${COMPONENT}
277111
spec:
278112
ports:
279-
- name: ${CONTAINER_PORT}-tcp
113+
- name: http
280114
protocol: TCP
281115
port: 80
282116
targetPort: ${{CONTAINER_PORT}}
283117
selector:
284-
deploymentconfig: ${NAME}-${COMPONENT}
118+
app: ${NAME}-${COMPONENT}
285119
- apiVersion: route.openshift.io/v1
286120
kind: Route
287121
metadata:
@@ -290,30 +124,36 @@ objects:
290124
name: ${NAME}-${COMPONENT}
291125
spec:
292126
host: ${NAME}-${COMPONENT}-${ENV}.${DOMAIN}
293-
port:
294-
targetPort: ${CONTAINER_PORT}-tcp
295127
to:
296128
kind: Service
297129
name: ${NAME}-${COMPONENT}
298130
weight: 100
131+
port:
132+
targetPort: http
299133
tls:
300134
termination: edge
301135
insecureEdgeTerminationPolicy: Redirect
302136
- apiVersion: autoscaling/v2
303137
kind: HorizontalPodAutoscaler
304138
metadata:
305-
name: "${NAME}-${COMPONENT}"
139+
name: ${NAME}-${COMPONENT}
306140
spec:
307141
scaleTargetRef:
308-
apiVersion: apps.openshift.io/v1
309-
kind: DeploymentConfig
310-
name: "${NAME}-${COMPONENT}"
311-
minReplicas: ${{MIN_REPLICAS}}
312-
maxReplicas: ${{MAX_REPLICAS}}
142+
apiVersion: apps/v1
143+
kind: Deployment
144+
name: ${NAME}-${COMPONENT}
145+
minReplicas: 1
146+
maxReplicas: 3
313147
metrics:
314148
- type: Resource
315149
resource:
316150
name: cpu
317151
target:
318152
type: Utilization
319-
averageUtilization: 100
153+
averageUtilization: 80
154+
- type: Resource
155+
resource:
156+
name: memory
157+
target:
158+
type: AverageValue
159+
averageValue: "400Mi"

0 commit comments

Comments
 (0)