Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): deploymentConfig deprecation, drop imageStreams #318

Merged
merged 6 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
parameters:
-p ZONE=test
-p ZONE=test -p TAG=test
${{ matrix.parameters }}
timeout: ${{ matrix.timeout || '10m' }}
verification_path: ${{ matrix.verification_path }}
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: ${{ matrix.overwrite }}
parameters:
-p ZONE=prod
-p ZONE=prod -p TAG=prod
${{ matrix.parameters }}
timeout: ${{ matrix.timeout || '10m' }}
verification_path: ${{ matrix.verification_path }}
2 changes: 1 addition & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
parameters:
-p ZONE=${{ github.event.number }}
-p ZONE=${{ github.event.number }} -p TAG=${{ github.event.number }}
${{ matrix.parameters }}
timeout: ${{ matrix.timeout }}
triggers: ('common/' 'backend/' 'frontend/')
Expand Down
50 changes: 14 additions & 36 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ parameters:
- name: MAX_REPLICAS
description: The maximum amount of replicas for the horizontal pod autoscaler.
value: "5"
- name: TAG
description: Image tag; e.g. PR number, latest or prod
required: true
- 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: DB_POOL_CONN_TIMEOUT
Expand Down Expand Up @@ -76,54 +79,29 @@ parameters:
description: Sets all the allowed request origins
value: "http://localhost:300*,https://*.apps.silver.devops.gov.bc.ca"
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}/${ORG_NAME}/${NAME}/${COMPONENT}:${ZONE}
referencePolicy:
type: Local
- apiVersion: v1
kind: DeploymentConfig
- apiVersion: apps/v1
kind: Deployment
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}"
- name: ${NAME}-${ZONE}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
imagePullPolicy: Always
name: "${NAME}"
volumeMounts:
- name: ${NAME}-${ZONE}-fluentbit-logs
mountPath: /logs
Expand Down Expand Up @@ -227,7 +205,7 @@ objects:
port: 80
targetPort: 8080
selector:
deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}"
deployment: "${NAME}-${ZONE}-${COMPONENT}"
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
Expand All @@ -254,7 +232,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
13 changes: 8 additions & 5 deletions common/openshift.fluentbit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ parameters:
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: TAG
description: Dummy variable for workflow convenience
- name: AWS_KINESIS_STREAM
description: AWS Kinesis Stream identifier
required: false
Expand Down Expand Up @@ -41,23 +43,24 @@ parameters:
displayName: Memory Request
value: 16Mi
objects:
- kind: DeploymentConfig
apiVersion: v1
- kind: Deployment
apiVersion: apps/v1
metadata:
labels:
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
replicas: 1
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:
- name: ${NAME}
Expand Down
46 changes: 12 additions & 34 deletions database/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ parameters:
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: TAG
description: Image tag; e.g. PR number, latest or prod
required: true
- 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
value: bcgov
- name: IMAGE_TAG
Expand Down Expand Up @@ -51,42 +54,17 @@ objects:
requests:
storage: ${DB_PVC_SIZE}
storageClassName: netapp-file-standard
- kind: ImageStream
apiVersion: v1
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
spec:
lookupPolicy:
local: false
tags:
- name: ${IMAGE_TAG}
from:
kind: DockerImage
name: ${REGISTRY}/${ORG_NAME}/${NAME}/${COMPONENT}:${ZONE}
referencePolicy:
type: Local
- kind: DeploymentConfig
apiVersion: v1
- kind: Deployment
apiVersion: apps/v1
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
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: Recreate
recreateParams:
Expand All @@ -97,15 +75,15 @@ objects:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
deploymentconfig: ${NAME}-${ZONE}-${COMPONENT}
deployment: ${NAME}-${ZONE}-${COMPONENT}
spec:
volumes:
- name: ${NAME}-${ZONE}-${COMPONENT}
persistentVolumeClaim:
claimName: ${NAME}-${ZONE}-${COMPONENT}
containers:
- name: ${NAME}
image: ${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}
- name: ${NAME}-${ZONE}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
ports:
- containerPort: 5432
protocol: TCP
Expand Down Expand Up @@ -180,6 +158,6 @@ objects:
protocol: TCP
targetPort: 5432
selector:
deploymentconfig: ${NAME}-${ZONE}-${COMPONENT}
deployment: ${NAME}-${ZONE}-${COMPONENT}
sessionAffinity: None
type: ClusterIP
49 changes: 14 additions & 35 deletions frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
- name: COMPONENT
description: Component name
value: frontend
- name: ORG_NAME
- name: ORG
description: Organization name, e.g. bcgov
value: bcgov
- name: ZONE
Expand Down Expand Up @@ -35,6 +35,9 @@ parameters:
- name: MAX_REPLICAS
description: The maximum amount of replicas for the horizontal pod autoscaler.
value: "5"
- name: TAG
description: Image tag; e.g. PR number, latest or prod
required: true
- name: REGISTRY
description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000)
value: ghcr.io
Expand All @@ -45,56 +48,32 @@ parameters:
- name: VITE_ZONE
value: DEV
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}/${ORG_NAME}/${NAME}/${COMPONENT}:${ZONE}
referencePolicy:
type: Local
- apiVersion: v1
kind: DeploymentConfig
- apiVersion: apps/v1
kind: Deployment
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}"
- name: ${NAME}-${ZONE}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
securityContext:
capabilities:
add: ["NET_BIND_SERVICE"]
imagePullPolicy: Always
name: ${NAME}
env:
- name: LOG_LEVEL
value: "${LOG_LEVEL}"
Expand Down Expand Up @@ -147,7 +126,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 +153,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