Skip to content

Commit

Permalink
chore(ci): deploymentconfig deprecation (#210)
Browse files Browse the repository at this point in the history
* chore(ci): deprecate deployment configs

* Add random envar to ensure rollouts

* Drop imagestreams
  • Loading branch information
DerekRoberts authored Oct 8, 2024
1 parent 254252c commit 90114f4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 74 deletions.
54 changes: 16 additions & 38 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ parameters:
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: IMAGE_TAG
description: Image tag to use
value: latest
- name: DOMAIN
value: apps.silver.devops.gov.bc.ca
- name: CPU_REQUEST
Expand Down Expand Up @@ -40,7 +37,7 @@ parameters:
- name: REGISTRY
description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000)
value: ghcr.io
- name: ORG_NAME
- name: ORG
description: Organization name, e.g. bcgov
value: bcgov
- name: PROMOTE
Expand All @@ -66,6 +63,10 @@ parameters:
- name: S3_SECRETKEY
description: Secret key for S3
required: true
- name: RANDOM_EXPRESSION
description: Random expression to make sure deployments update
from: "[a-zA-Z0-9]{32}"
generate: expression
objects:
- apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
Expand Down Expand Up @@ -95,52 +96,27 @@ objects:
- podSelector: {}
policyTypes:
- Ingress
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: "${NAME}-${ZONE}"
name: "${NAME}-${ZONE}-${COMPONENT}"
spec:
lookupPolicy:
local: false
tags:
- name: "${IMAGE_TAG}"
from:
kind: DockerImage
name: "${REGISTRY}/${PROMOTE}"
referencePolicy:
type: Local
- apiVersion: v1
kind: DeploymentConfig
- kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: "${NAME}-${ZONE}"
name: "${NAME}-${ZONE}-${COMPONENT}"
spec:
replicas: 1
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- "${NAME}"
from:
kind: ImageStreamTag
name: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}"
selector:
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
matchLabels:
deployment: "${NAME}-${ZONE}-${COMPONENT}"
strategy:
type: Rolling
type: RollingUpdate
template:
metadata:
labels:
app: "${NAME}-${ZONE}"
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
deployment: "${NAME}-${ZONE}-${COMPONENT}"
spec:
containers:
- image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}"
- image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${ZONE}
imagePullPolicy: Always
name: "${NAME}"
env:
Expand All @@ -158,6 +134,8 @@ objects:
value: ${S3_ENDPOINT}
- name: S3_SECRETKEY
value: ${S3_SECRETKEY}
- name: RANDOM_EXPRESSION
value: ${RANDOM_EXPRESSION}
ports:
- containerPort: 5000
protocol: TCP
Expand Down Expand Up @@ -201,7 +179,7 @@ objects:
port: 80
targetPort: 5000
selector:
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
deployment: "${NAME}-${ZONE}-${COMPONENT}"
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
Expand All @@ -226,7 +204,7 @@ objects:
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
kind: Deployment
name: "${NAME}-${ZONE}-${COMPONENT}"
minReplicas: "${{MIN_REPLICAS}}"
maxReplicas: "${{MAX_REPLICAS}}"
Expand Down
54 changes: 18 additions & 36 deletions frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ parameters:
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: IMAGE_TAG
description: Image tag to use
value: latest
- name: DOMAIN
value: apps.silver.devops.gov.bc.ca
- name: CPU_REQUEST
Expand All @@ -32,6 +29,9 @@ parameters:
- 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, e.g. bcgov
value: bcgov
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: bcgov/nr-results-exam/frontend:prod
Expand All @@ -44,52 +44,32 @@ parameters:
value: DEV
- name: S3_SECRETKEY
description: Dummy param to satisfy workflow
- name: RANDOM_EXPRESSION
description: Random expression to make sure deployments update
from: "[a-zA-Z0-9]{32}"
generate: expression
objects:
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: "${NAME}-${ZONE}"
name: "${NAME}-${ZONE}-${COMPONENT}"
spec:
lookupPolicy:
local: false
tags:
- name: "${IMAGE_TAG}"
from:
kind: DockerImage
name: "${REGISTRY}/${PROMOTE}"
referencePolicy:
type: Local
- apiVersion: v1
kind: DeploymentConfig
- kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: "${NAME}-${ZONE}"
name: "${NAME}-${ZONE}-${COMPONENT}"
spec:
replicas: 1
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames: ["${NAME}"]
from:
kind: ImageStreamTag
name: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}"
selector:
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
matchLabels:
deployment: "${NAME}-${ZONE}-${COMPONENT}"
strategy:
type: Rolling
type: RollingUpdate
template:
metadata:
labels:
app: "${NAME}-${ZONE}"
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
deployment: "${NAME}-${ZONE}-${COMPONENT}"
spec:
containers:
- image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}"
- image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${ZONE}
securityContext:
capabilities:
add: ["NET_BIND_SERVICE"]
Expand All @@ -106,6 +86,8 @@ objects:
value: "${VITE_QUESTIONS_API_KEY}"
- name: VITE_ZONE
value: "${ZONE}"
- name: RANDOM_EXPRESSION
value: ${RANDOM_EXPRESSION}
ports:
- containerPort: 3000
protocol: TCP
Expand Down Expand Up @@ -149,7 +131,7 @@ objects:
port: 80
targetPort: 3000
selector:
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
deployment: "${NAME}-${ZONE}-${COMPONENT}"
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
Expand All @@ -174,7 +156,7 @@ objects:
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
kind: Deployment
name: "${NAME}-${ZONE}-${COMPONENT}"
minReplicas: "${{MIN_REPLICAS}}"
maxReplicas: "${{MAX_REPLICAS}}"
Expand Down

0 comments on commit 90114f4

Please sign in to comment.