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

ci!: deprecate deployment config, remove image stream - db only #1302

Merged
merged 2 commits into from
Nov 6, 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
8 changes: 4 additions & 4 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
overwrite: true
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/database:${{ env.ZONE }}
-p TAG=${{ env.ZONE }}

- name: Backup database before update
continue-on-error: true
Expand All @@ -145,7 +145,7 @@ jobs:
overwrite: false
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/database:${{ env.ZONE }}
-p TAG=${{ env.ZONE }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand Down Expand Up @@ -335,7 +335,7 @@ jobs:
overwrite: true
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/database:${{ env.PREV }}
-p TAG=${{ env.PREV }}

- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
Expand All @@ -362,7 +362,7 @@ jobs:
overwrite: false
parameters:
-p ZONE=${{ env.ZONE }} -p NAME=${{ github.event.repository.name }}
-p PROMOTE=${{ github.repository }}/database:${{ env.PREV }}
-p TAG=${{ env.PREV }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ jobs:
overwrite: true
parameters:
-p ZONE=${{ github.event.number }}
-p PROMOTE=${{ github.repository }}/database:${{ github.event.number }}
-p TAG=${{ github.event.number }}
- name: Install CLI tools from OpenShift Mirror
uses: redhat-actions/openshift-tools-installer@v1
with:
Expand All @@ -295,7 +295,7 @@ jobs:
overwrite: false
parameters:
-p ZONE=${{ github.event.number }}
-p PROMOTE=${{ github.repository }}/database:${{ github.event.number }}
-p TAG=${{ github.event.number }}

- name: Deploy Legacy
uses: bcgov-nr/[email protected]
Expand Down
21 changes: 12 additions & 9 deletions database/openshift.backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ parameters:
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: IMAGE_TAG
description: Image tag to use
value: latest
- 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
description: Organization name
value: bcgov
- name: RESTORE_DIR
description: Folder that contains initialization scripts
value: /tmp/restore
Expand Down Expand Up @@ -47,10 +53,7 @@ parameters:
value: "0"
- name: PVC_SIZE
description: Volume space available for data, e.g. 512Mi, 2Gi.
value: 256Mi
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
required: true
value: 256Mi
objects:
- kind: PersistentVolumeClaim
apiVersion: v1
Expand Down Expand Up @@ -92,7 +95,7 @@ objects:
spec:
containers:
- name: ${NAME}-${ZONE}-${COMPONENT}
image: ${REGISTRY}/${PROMOTE}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
command: ["/bin/sh", "-c"]
args:
- |
Expand Down Expand Up @@ -187,7 +190,7 @@ objects:
spec:
containers:
- name: ${NAME}-${ZONE}-${COMPONENT}-restore
image: ${REGISTRY}/${PROMOTE}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
command: ["/bin/sh", "-c"]
args:
- |
Expand Down
62 changes: 23 additions & 39 deletions database/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ parameters:
- name: ZONE
description: Deployment zone, e.g. pr-### or prod
required: true
- name: IMAGE_TAG
description: Image tag to use
value: latest
- 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
description: Organization name
value: bcgov
- name: PVC_MOUNT_PATH
description: Where to mount the PVC, subpath (e.g. data/)
value: /var/lib/postgresql
Expand Down Expand Up @@ -76,14 +82,15 @@ parameters:
value: "0"
- description: Volume space available for data, e.g. 512Mi, 2Gi.
name: PVC_SIZE
value: 256Mi
value: 256Mi
- name: CRON_MINUTES
description: Random number, 0-60, for scheduling cronjobs
from: "[0-5]{1}[0-9]{1}"
generate: expression
- name: RANDOM_EXPRESSION
description: Random expression to make sure deployments update
from: "[a-zA-Z0-9]{32}"
generate: expression
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
required: true
objects:
- kind: PersistentVolumeClaim
apiVersion: v1
Expand All @@ -98,42 +105,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}/${PROMOTE}
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 @@ -144,15 +126,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}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
ports:
- containerPort: 5432
protocol: TCP
Expand Down Expand Up @@ -194,6 +176,8 @@ objects:
secretKeyRef:
name: ${NAME}-${ZONE}
key: database-user
- name: RANDOM_EXPRESSION
value: ${RANDOM_EXPRESSION}
volumeMounts:
- name: ${NAME}-${ZONE}-${COMPONENT}
mountPath: ${PVC_MOUNT_PATH}
Expand All @@ -218,6 +202,6 @@ objects:
protocol: TCP
targetPort: 5432
selector:
deploymentconfig: ${NAME}-${ZONE}-${COMPONENT}
deployment: ${NAME}-${ZONE}-${COMPONENT}
sessionAffinity: None
type: ClusterIP
4 changes: 2 additions & 2 deletions database/openshift.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ objects:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
deploymentconfig: ${NAME}-${ZONE}-${COMPONENT}
deployment: ${NAME}-${ZONE}-${COMPONENT}
spec:
containers:
- name: ${NAME}
Expand Down Expand Up @@ -61,4 +61,4 @@ objects:
name: ${NAME}-${ZONE}
key: "database-password"
imagePullPolicy: Always
restartPolicy: Never
restartPolicy: Never
Loading