Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
sakthi-aot committed Jan 25, 2025
1 parent d9f6f44 commit 44dbb33
Show file tree
Hide file tree
Showing 3 changed files with 293 additions and 47 deletions.
224 changes: 192 additions & 32 deletions .github/openshift/deploy.backend-applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ parameters:
value: "275m"
- name: MEMORY_LIMIT
value: "450Mi"
- name: REPLICAS
description: Number of replicas
value: "2"
- name: MIN_REPLICAS
description: The minimum amount of replicas
value: "1"
- name: MAX_REPLICAS
description: The maximum amount of replicas
value: "3"
- name: CONTAINER_PORT
description: The port on which the application will be accessible
required: true
Expand All @@ -48,31 +51,71 @@ parameters:
description: The Environment on which it is deployed
required: true
objects:
- apiVersion: apps/v1
kind: Deployment
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: ${NAME}-${COMPONENT}
name: ${NAME}-${COMPONENT}
spec:
lookupPolicy:
local: false
tags:
- name: ${IMAGE_TAG}
from:
kind: DockerImage
name: ${REGISTRY}/${PROMOTE}:${IMAGE_TAG}
referencePolicy:
type: Local
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: ${NAME}-${COMPONENT}-migration
name: ${NAME}-${COMPONENT}-migration
spec:
lookupPolicy:
local: false
tags:
- name: ${IMAGE_TAG}
from:
kind: DockerImage
name: ${REGISTRY}/${INIT_IMAGE}:${IMAGE_TAG}
referencePolicy:
type: Local
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
app: ${NAME}-${COMPONENT}
name: ${NAME}-${COMPONENT}
spec:
replicas: "${REPLICAS}"
replicas: 1
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- ${NAME}-${COMPONENT}
from:
kind: ImageStreamTag
name: ${NAME}-${COMPONENT}:${IMAGE_TAG}
selector:
matchLabels:
app: ${NAME}-${COMPONENT}
deploymentconfig: ${NAME}-${COMPONENT}
strategy:
type: Rolling
template:
metadata:
labels:
app: ${NAME}-${COMPONENT}
deploymentconfig: ${NAME}-${COMPONENT}
spec:
containers:
- name: ${NAME}-${COMPONENT}
image: ${REGISTRY}/${PROMOTE}:${IMAGE_TAG}
ports:
- containerPort: ${{CONTAINER_PORT}}
protocol: TCP
- image: " "
imagePullPolicy: Always
name: ${NAME}-${COMPONENT}
env:
- name: NODE_ENV
value: production
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
Expand All @@ -83,6 +126,44 @@ objects:
configMapKeyRef:
name: ${NAME}-database
key: POSTGRES_DATABASE
- name: POSTGRES_DB_SCHEMA
valueFrom:
configMapKeyRef:
name: ${NAME}-database
key: POSTGRES_DB_APPLICATION_SCHEMA
- name: POSTGRES_DB_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-database
key: POSTGRES_DB_APPLICATION_PASSWORD
- name: POSTGRES_DB_USERNAME
valueFrom:
secretKeyRef:
name: ${NAME}-database
key: POSTGRES_DB_APPLICATION_USERNAME
- name: KEYCLOCK_AUTH_URL
valueFrom:
configMapKeyRef:
name: keycloak-config
key: KEYCLOCK_AUTH_URL
- name: KEYCLOCK_REALM
valueFrom:
configMapKeyRef:
name: keycloak-config
key: KEYCLOCK_REALM
- name: KEYCLOCK_APP_CLIENT_ID
valueFrom:
secretKeyRef:
name: keycloak
key: KEYCLOCK_APP_CLIENT_ID
- name: KEYCLOCK_APP_SECRET
valueFrom:
secretKeyRef:
name: keycloak
key: KEYCLOCK_APP_SECRET
ports:
- containerPort: ${{CONTAINER_PORT}}
protocol: TCP
resources:
requests:
cpu: ${CPU_REQUEST}
Expand All @@ -94,14 +175,99 @@ objects:
httpGet:
path: /
port: ${{CONTAINER_PORT}}
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 5
failureThreshold: 30
successThreshold: 1
livenessProbe:
successThreshold: 1
failureThreshold: 3
httpGet:
path: /
port: ${{CONTAINER_PORT}}
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 5
initContainers:
# - name: init-${NAME}-backend-users-typeorm-migrations
# image: image-registry.openshift-image-registry.svc:5000/${NAME}-${COMPONENT}:${IMAGE_TAG}
# command: ['sh', '-c', 'initContainer.sh']
# ${NAME}-${COMPONENT}:${IMAGE_TAG}
- name: epd-db-migration-applications
image: "image-registry.openshift-image-registry.svc:5000/e38158-${ENV}/${NAME}-${COMPONENT}-migration:${IMAGE_TAG}"
env:
- name: Typeorm-migration-applications
value: "jdbc:postgresql://${COMPONENT}-postgres:5432/${COMPONENT}"
- name: POSTGRESQL_HOST
valueFrom:
configMapKeyRef:
name: ${NAME}-database
key: POSTGRESQL_HOST
- name: POSTGRESQL_PORT
valueFrom:
configMapKeyRef:
name: ${NAME}-database
key: POSTGRESQL_PORT
- name: POSTGRES_DATABASE
valueFrom:
configMapKeyRef:
name: ${NAME}-database
key: POSTGRES_DATABASE
- name: POSTGRES_DB_SCHEMA
valueFrom:
configMapKeyRef:
name: ${NAME}-database
key: POSTGRES_DB_APPLICATION_SCHEMA
- name: POSTGRES_ADMIN_USERNAME
valueFrom:
secretKeyRef:
name: ${NAME}-database
key: POSTGRES_ADMIN_USERNAME
- name: POSTGRES_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-database
key: POSTGRES_ADMIN_PASSWORD
- name: POSTGRES_DB_USERNAME
valueFrom:
secretKeyRef:
name: ${NAME}-database
key: POSTGRES_DB_APPLICATION_USERNAME
- name: POSTGRES_DB_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-database
key: POSTGRES_DB_APPLICATION_PASSWORD
- name: KEYCLOCK_AUTH_URL
valueFrom:
configMapKeyRef:
name: keycloak-config
key: KEYCLOCK_AUTH_URL
- name: KEYCLOCK_REALM
valueFrom:
configMapKeyRef:
name: keycloak-config
key: KEYCLOCK_REALM
- name: KEYCLOCK_APP_CLIENT_ID
valueFrom:
secretKeyRef:
name: keycloak
key: KEYCLOCK_APP_CLIENT_ID
- name: KEYCLOCK_APP_SECRET
valueFrom:
secretKeyRef:
name: keycloak
key: KEYCLOCK_APP_SECRET
resources:
limits:
cpu: 100m
memory: 150Mi
requests:
cpu: 50m
memory: 50Mi
- apiVersion: v1
kind: Service
metadata:
Expand All @@ -110,12 +276,12 @@ objects:
name: ${NAME}-${COMPONENT}
spec:
ports:
- name: http
- name: ${CONTAINER_PORT}-tcp
protocol: TCP
port: 80
targetPort: ${{CONTAINER_PORT}}
selector:
app: ${NAME}-${COMPONENT}
deploymentconfig: ${NAME}-${COMPONENT}
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
Expand All @@ -124,36 +290,30 @@ objects:
name: ${NAME}-${COMPONENT}
spec:
host: ${NAME}-${COMPONENT}-${ENV}.${DOMAIN}
port:
targetPort: ${CONTAINER_PORT}-tcp
to:
kind: Service
name: ${NAME}-${COMPONENT}
weight: 100
port:
targetPort: http
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ${NAME}-${COMPONENT}
name: "${NAME}-${COMPONENT}"
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: ${NAME}-${COMPONENT}
minReplicas: 1
maxReplicas: 3
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: "${NAME}-${COMPONENT}"
minReplicas: ${{MIN_REPLICAS}}
maxReplicas: ${{MAX_REPLICAS}}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: "400Mi"
averageUtilization: 100
Loading

0 comments on commit 44dbb33

Please sign in to comment.