From 66ac3c716ed3353620c632a11002bafa80e51b46 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:20:54 -0700 Subject: [PATCH 01/16] chore(ci): switch database to use deployments --- templates/database.yml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/templates/database.yml b/templates/database.yml index 925037c..f21e07c 100644 --- a/templates/database.yml +++ b/templates/database.yml @@ -105,26 +105,17 @@ objects: name: "${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: @@ -135,7 +126,7 @@ objects: name: "${NAME}-${ZONE}-${COMPONENT}" labels: app: "${NAME}-${ZONE}" - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + deployment: "${NAME}-${ZONE}-${COMPONENT}" spec: volumes: - name: "${NAME}-${ZONE}-${COMPONENT}" @@ -209,6 +200,6 @@ objects: protocol: TCP targetPort: 5432 selector: - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + deployment: "${NAME}-${ZONE}-${COMPONENT}" sessionAffinity: None type: ClusterIP From 13f503d15ff105564618896476af197bedb84e19 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:31:55 -0700 Subject: [PATCH 02/16] Drop database imagestream --- templates/database.yml | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/templates/database.yml b/templates/database.yml index f21e07c..3d1c195 100644 --- a/templates/database.yml +++ b/templates/database.yml @@ -10,15 +10,15 @@ 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: ORG_NAME + description: Organization name + value: bcgov - name: REGISTRY description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) value: ghcr.io - - name: PROMOTE - description: Image to promote - value: ghcr.io/bcgov/nr-containers/postgres:15.5 - - name: IMAGE_TAG - description: Image tag to use - value: latest - name: PVC_MOUNT_PATH description: Where to mount the PVC, subpath (e.g. data/) value: /var/lib/postgresql @@ -27,9 +27,6 @@ parameters: displayName: Database Volume Capacity required: true value: 256Mi - - name: REGISTRY - description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) - value: ghcr.io - name: PG_DATABASE description: Postgres database name value: database @@ -89,22 +86,6 @@ 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: "${PROMOTE}" - referencePolicy: - type: Local - kind: Deployment apiVersion: apps/v1 metadata: @@ -134,7 +115,7 @@ objects: claimName: "${NAME}-${ZONE}-${COMPONENT}" containers: - name: "${NAME}" - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" + image: ${REGISTRY}/${ORG_NAME}/${NAME}/${COMPONENT}:${TAG} ports: - containerPort: 5432 protocol: TCP From 4bb61433b9296be6016381b678ba6a65c7622797 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:34:31 -0700 Subject: [PATCH 03/16] Drop database imagestream --- templates/database.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/database.yml b/templates/database.yml index 3d1c195..8f9bf70 100644 --- a/templates/database.yml +++ b/templates/database.yml @@ -3,7 +3,7 @@ kind: Template parameters: - name: NAME description: Module name - required: true + value: action-deployer-openshift - name: COMPONENT description: Component name value: database From 15b807eb3f5610f460a3f3f07b37f290ba65b03e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:37:21 -0700 Subject: [PATCH 04/16] Drop database imagestream --- .github/workflows/pr-open.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index c9b6f74..da2b7d4 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -17,23 +17,23 @@ jobs: frontend: ${{ steps.trigger.outputs.frontend }} strategy: matrix: - name: [ backend, database, frontend ] + # name: [ backend, database, frontend ] include: - - name: backend - file: templates/backend.yml - overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - verification_path: /api + # - name: backend + # file: templates/backend.yml + # overwrite: true + # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + # verification_path: /api - name: database file: templates/database.yml overwrite: false - - name: frontend - file: templates/frontend.yml - oc_version: 4.13 - overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - post_rollout: | - oc create job "frontend-$(date +%s)" --from=cronjob/${{ github.event.repository.name }}-${{ github.event.number }}-cronjob + # - name: frontend + # file: templates/frontend.yml + # oc_version: 4.13 + # overwrite: true + # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + # post_rollout: | + # oc create job "frontend-$(date +%s)" --from=cronjob/${{ github.event.repository.name }}-${{ github.event.number }}-cronjob steps: - uses: actions/checkout@v4 - id: deploys @@ -45,7 +45,7 @@ jobs: oc_token: ${{ secrets.OC_TOKEN }} oc_version: ${{ matrix.oc_version }} overwrite: ${{ matrix.overwrite }} - parameters: -p ZONE=${{ github.event.number }} -p NAME=${{ github.event.repository.name }} + parameters: -p ZONE=${{ github.event.number }} -p TAG=${{ github.event.number }} ${{ matrix.parameters }} post_rollout: ${{ matrix.post_rollout }} verification_path: ${{ matrix.verification_path }} From 22963c8139fe9675b08f4743a948f92de12255ea Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:39:01 -0700 Subject: [PATCH 05/16] Drop database imagestream --- templates/database.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/database.yml b/templates/database.yml index 8f9bf70..c86fdc9 100644 --- a/templates/database.yml +++ b/templates/database.yml @@ -15,7 +15,7 @@ parameters: required: true - name: ORG_NAME description: Organization name - value: bcgov + value: bcgov-nr - name: REGISTRY description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) value: ghcr.io From bf687c88be01ee9e9b8d2985ce2c3c4a17bddc6e Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:45:49 -0700 Subject: [PATCH 06/16] Clean up handling of deployments vs deploymentconfigs --- action.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 536565a..7fcda68 100644 --- a/action.yml +++ b/action.yml @@ -162,7 +162,7 @@ runs: oc login --token=${{ inputs.oc_token }} --server=${{ inputs.oc_server }} oc project ${{ inputs.oc_namespace }} #Safeguard! - # Clean previous image, if any + # Clean any previous ImageStreams IFS=" " read -ra IS <<< "${{ steps.vars.outputs.imageStream }}" for i in "${IS[@]}" do @@ -178,9 +178,13 @@ runs: oc create -f - 2>&1 <<< "${TEMPLATE}" | sed 's/.*: //' fi - # Follow any active rollouts + # Follow any active rollouts; temporary support for DeploymentConfigs DDC=${{ steps.vars.outputs.deployment }} - [ -z "${DDC}" ]|| oc rollout status deployment/${DDC} -w || oc rollout status dc/${DDC} -w + if [ ! -z "${DDC}" ]&&[ $(oc get deployment/${DDC} 2>/dev/null) ]; then + oc rollout status deployment/${DDC} -w + elif [ ! -z "${DDC}" ]; then + oc rollout status deploymentconfig/${DDC} -w + fi - name: Route Verification if: steps.vars.outputs.url && From b613e0dc54b570addce88cfad7c402671f94756b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:50:16 -0700 Subject: [PATCH 07/16] Simplify database deployment, use bcgov/nr-containers --- templates/database.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/templates/database.yml b/templates/database.yml index c86fdc9..aa719d4 100644 --- a/templates/database.yml +++ b/templates/database.yml @@ -10,26 +10,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: ORG_NAME - description: Organization name - value: bcgov-nr - - name: REGISTRY - description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) - value: ghcr.io - name: PVC_MOUNT_PATH description: Where to mount the PVC, subpath (e.g. data/) value: /var/lib/postgresql - name: DB_PVC_SIZE description: Volume space available for data, e.g. 512Mi, 2Gi. - displayName: Database Volume Capacity required: true value: 256Mi - - name: PG_DATABASE - description: Postgres database name - value: database - name: DB_PASSWORD description: Password for the PostgreSQL connection user. from: "[a-zA-Z0-9]{16}" @@ -38,7 +25,7 @@ objects: - apiVersion: v1 kind: Secret metadata: - name: "${NAME}-${ZONE}-${PG_DATABASE}" + name: "${NAME}-${ZONE}-${COMPONENT}" labels: app: "${NAME}-${ZONE}" stringData: @@ -115,7 +102,7 @@ objects: claimName: "${NAME}-${ZONE}-${COMPONENT}" containers: - name: "${NAME}" - image: ${REGISTRY}/${ORG_NAME}/${NAME}/${COMPONENT}:${TAG} + image: ghcr.io/bcgov/nr-containers/postgres:12.19 ports: - containerPort: 5432 protocol: TCP From d39c2a08ff1cf64ccf3fdd865d2c21d9568fec3d Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 19:51:20 -0700 Subject: [PATCH 08/16] Simplify database deployment, use bcgov/nr-containers --- .github/workflows/pr-open.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index da2b7d4..9803d6b 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -45,7 +45,7 @@ jobs: oc_token: ${{ secrets.OC_TOKEN }} oc_version: ${{ matrix.oc_version }} overwrite: ${{ matrix.overwrite }} - parameters: -p ZONE=${{ github.event.number }} -p TAG=${{ github.event.number }} + parameters: -p ZONE=${{ github.event.number }} ${{ matrix.parameters }} post_rollout: ${{ matrix.post_rollout }} verification_path: ${{ matrix.verification_path }} From 35441f97e8769be54e4c4b784a2aaea22366f86a Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:04:51 -0700 Subject: [PATCH 09/16] Work on conditionals --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 7fcda68..994d582 100644 --- a/action.yml +++ b/action.yml @@ -180,12 +180,12 @@ runs: # Follow any active rollouts; temporary support for DeploymentConfigs DDC=${{ steps.vars.outputs.deployment }} - if [ ! -z "${DDC}" ]&&[ $(oc get deployment/${DDC} 2>/dev/null) ]; then + if [ ! -z "${DDC}" ]&&[ ! -z $(oc get deployment ${DDC} -o name --ignore-not-found) ]; then oc rollout status deployment/${DDC} -w - elif [ ! -z "${DDC}" ]; then + elif [ ! -z "${DDC}" ]&&[ ! -z $(oc get deploymentconfig ${DDC} -o name --ignore-not-found) ]; then oc rollout status deploymentconfig/${DDC} -w fi - + - name: Route Verification if: steps.vars.outputs.url && ( steps.diff.outputs.triggered == 'true' ) From 6e7798f0c3e8c84a92c4c9d663118dd58efa2324 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:31:48 -0700 Subject: [PATCH 10/16] Add deployment kick-off --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 994d582..2b85869 100644 --- a/action.yml +++ b/action.yml @@ -181,6 +181,7 @@ runs: # Follow any active rollouts; temporary support for DeploymentConfigs DDC=${{ steps.vars.outputs.deployment }} if [ ! -z "${DDC}" ]&&[ ! -z $(oc get deployment ${DDC} -o name --ignore-not-found) ]; then + oc rollout restart deployment/${DDC} oc rollout status deployment/${DDC} -w elif [ ! -z "${DDC}" ]&&[ ! -z $(oc get deploymentconfig ${DDC} -o name --ignore-not-found) ]; then oc rollout status deploymentconfig/${DDC} -w From dfb8006c5435cbb5dd210819b2e6313f34a2cd82 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:38:26 -0700 Subject: [PATCH 11/16] Remove ImageStreams and DeploymentConfigs from backend --- .github/workflows/pr-open.yml | 10 ++++----- action.yml | 2 +- templates/backend.yml | 40 ++++++----------------------------- 3 files changed, 13 insertions(+), 39 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 9803d6b..6c2cdec 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -19,11 +19,11 @@ jobs: matrix: # name: [ backend, database, frontend ] include: - # - name: backend - # file: templates/backend.yml - # overwrite: true - # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 - # verification_path: /api + - name: backend + file: templates/backend.yml + overwrite: true + parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 + verification_path: /api - name: database file: templates/database.yml overwrite: false diff --git a/action.yml b/action.yml index 2b85869..d9671e3 100644 --- a/action.yml +++ b/action.yml @@ -181,7 +181,7 @@ runs: # Follow any active rollouts; temporary support for DeploymentConfigs DDC=${{ steps.vars.outputs.deployment }} if [ ! -z "${DDC}" ]&&[ ! -z $(oc get deployment ${DDC} -o name --ignore-not-found) ]; then - oc rollout restart deployment/${DDC} + # oc rollout restart deployment/${DDC} oc rollout status deployment/${DDC} -w elif [ ! -z "${DDC}" ]&&[ ! -z $(oc get deploymentconfig ${DDC} -o name --ignore-not-found) ]; then oc rollout status deploymentconfig/${DDC} -w diff --git a/templates/backend.yml b/templates/backend.yml index 03728eb..a1270af 100644 --- a/templates/backend.yml +++ b/templates/backend.yml @@ -44,52 +44,27 @@ parameters: description: The maximum amount of replicas for the horizontal pod autoscaler. value: "5" 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: "${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 template: metadata: labels: app: "${NAME}-${ZONE}" - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + deployment: "${NAME}-${ZONE}-${COMPONENT}" spec: containers: - - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" + - image: "ghcr.io/bcgov/quickstart-openshift/backend:latest" imagePullPolicy: Always name: "${NAME}" env: @@ -140,7 +115,6 @@ objects: initialDelaySeconds: 60 periodSeconds: 30 timeoutSeconds: 5 - - apiVersion: v1 kind: Service metadata: @@ -154,7 +128,7 @@ objects: port: 80 targetPort: 3000 selector: - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" + deployment: "${NAME}-${ZONE}-${COMPONENT}" - apiVersion: route.openshift.io/v1 kind: Route metadata: From dba754b4fd817e49db2a845add3deae302ccaa31 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:39:46 -0700 Subject: [PATCH 12/16] Template fix --- templates/backend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/backend.yml b/templates/backend.yml index a1270af..09e6c52 100644 --- a/templates/backend.yml +++ b/templates/backend.yml @@ -3,7 +3,7 @@ kind: Template parameters: - name: NAME description: Module name - required: true + value: action-deployer-openshift - name: COMPONENT description: Component name value: backend From a0c22f77d01dbd0ed342adc4b42b50882bfdd1ac Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:41:55 -0700 Subject: [PATCH 13/16] Clip extra params --- templates/backend.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/templates/backend.yml b/templates/backend.yml index 09e6c52..8a27f85 100644 --- a/templates/backend.yml +++ b/templates/backend.yml @@ -10,15 +10,6 @@ parameters: - name: ZONE description: Deployment zone, e.g. pr-### 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: PROMOTE - description: Image to promote - value: ghcr.io/bcgov/quickstart-openshift/backend:latest - - name: IMAGE_TAG - description: Image tag to use - value: latest - name: DOMAIN value: apps.silver.devops.gov.bc.ca - name: CPU_REQUEST @@ -56,7 +47,7 @@ objects: matchLabels: deployment: "${NAME}-${ZONE}-${COMPONENT}" strategy: - type: Rolling + type: RollingUpdate template: metadata: labels: From 2129353cf9d7c424df9def7de694d85b66f11f8b Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:44:50 -0700 Subject: [PATCH 14/16] Drop replica params --- .github/workflows/pr-open.yml | 2 -- templates/backend.yml | 10 ++-------- templates/frontend.yml | 6 +++--- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 6c2cdec..07b146e 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -22,7 +22,6 @@ jobs: - name: backend file: templates/backend.yml overwrite: true - parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 verification_path: /api - name: database file: templates/database.yml @@ -31,7 +30,6 @@ jobs: # file: templates/frontend.yml # oc_version: 4.13 # overwrite: true - # parameters: -p MIN_REPLICAS=1 -p MAX_REPLICAS=2 # post_rollout: | # oc create job "frontend-$(date +%s)" --from=cronjob/${{ github.event.repository.name }}-${{ github.event.number }}-cronjob steps: diff --git a/templates/backend.yml b/templates/backend.yml index 8a27f85..8271978 100644 --- a/templates/backend.yml +++ b/templates/backend.yml @@ -28,12 +28,6 @@ parameters: value: "250m" - name: MEMORY_LIMIT_INIT value: "250Mi" - - name: MIN_REPLICAS - description: The minimum amount of replicas for the horizontal pod autoscaler. - value: "3" - - name: MAX_REPLICAS - description: The maximum amount of replicas for the horizontal pod autoscaler. - value: "5" objects: - kind: Deployment apiVersion: apps/v1 @@ -146,8 +140,8 @@ objects: apiVersion: apps.openshift.io/v1 kind: DeploymentConfig name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "${{MIN_REPLICAS}}" - maxReplicas: "${{MAX_REPLICAS}}" + minReplicas: "1" + maxReplicas: "2" metrics: - type: Resource resource: diff --git a/templates/frontend.yml b/templates/frontend.yml index 1e45319..eb70c6f 100644 --- a/templates/frontend.yml +++ b/templates/frontend.yml @@ -3,7 +3,7 @@ kind: Template parameters: - name: NAME description: Module name - required: true + value: action-deployer-openshift - name: COMPONENT description: Component name value: frontend @@ -169,8 +169,8 @@ objects: apiVersion: apps.openshift.io/v1 kind: DeploymentConfig name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "${{MIN_REPLICAS}}" - maxReplicas: "${{MAX_REPLICAS}}" + minReplicas: "1" + maxReplicas: "2" metrics: - type: Resource resource: From 763261058106e942c7623d393e6b3023439eea97 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:47:02 -0700 Subject: [PATCH 15/16] Commas and quotes --- templates/backend.yml | 4 ++-- templates/frontend.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/backend.yml b/templates/backend.yml index 8271978..26fe39a 100644 --- a/templates/backend.yml +++ b/templates/backend.yml @@ -140,8 +140,8 @@ objects: apiVersion: apps.openshift.io/v1 kind: DeploymentConfig name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "1" - maxReplicas: "2" + minReplicas: 1 + maxReplicas: 2 metrics: - type: Resource resource: diff --git a/templates/frontend.yml b/templates/frontend.yml index eb70c6f..651b7a0 100644 --- a/templates/frontend.yml +++ b/templates/frontend.yml @@ -169,8 +169,8 @@ objects: apiVersion: apps.openshift.io/v1 kind: DeploymentConfig name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "1" - maxReplicas: "2" + minReplicas: 1 + maxReplicas: 2 metrics: - type: Resource resource: From c2584bde46306b1c74ac07537197cbdb54c7b3d1 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 16 Jul 2024 20:50:51 -0700 Subject: [PATCH 16/16] Drop ImageStream from frontend, leave DC --- .github/workflows/pr-open.yml | 17 +++++++------- templates/frontend.yml | 43 ++--------------------------------- 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 07b146e..0d13df0 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -17,7 +17,7 @@ jobs: frontend: ${{ steps.trigger.outputs.frontend }} strategy: matrix: - # name: [ backend, database, frontend ] + name: [ backend, database, frontend ] include: - name: backend file: templates/backend.yml @@ -26,12 +26,12 @@ jobs: - name: database file: templates/database.yml overwrite: false - # - name: frontend - # file: templates/frontend.yml - # oc_version: 4.13 - # overwrite: true - # post_rollout: | - # oc create job "frontend-$(date +%s)" --from=cronjob/${{ github.event.repository.name }}-${{ github.event.number }}-cronjob + - name: frontend + file: templates/frontend.yml + oc_version: 4.13 + overwrite: true + post_rollout: | + oc create job "frontend-$(date +%s)" --from=cronjob/${{ github.event.repository.name }}-${{ github.event.number }}-cronjob steps: - uses: actions/checkout@v4 - id: deploys @@ -43,8 +43,7 @@ jobs: oc_token: ${{ secrets.OC_TOKEN }} oc_version: ${{ matrix.oc_version }} overwrite: ${{ matrix.overwrite }} - parameters: -p ZONE=${{ github.event.number }} - ${{ matrix.parameters }} + parameters: -p ZONE=${{ github.event.number }} ${{ matrix.parameters }} post_rollout: ${{ matrix.post_rollout }} verification_path: ${{ matrix.verification_path }} - id: trigger diff --git a/templates/frontend.yml b/templates/frontend.yml index 651b7a0..a2dfad6 100644 --- a/templates/frontend.yml +++ b/templates/frontend.yml @@ -10,15 +10,6 @@ parameters: - name: ZONE description: Deployment zone, e.g. pr-### 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: PROMOTE - description: Image to promote - value: ghcr.io/bcgov/quickstart-openshift/frontend:latest - - name: IMAGE_TAG - description: Image tag to use - value: latest - name: DOMAIN value: apps.silver.devops.gov.bc.ca - name: CPU_REQUEST @@ -29,12 +20,6 @@ parameters: value: "75m" - name: MEMORY_LIMIT value: "150Mi" - - name: MIN_REPLICAS - description: The minimum amount of replicas for the horizontal pod autoscaler. - value: "3" - - name: MAX_REPLICAS - description: The maximum amount of replicas for the horizontal pod autoscaler. - value: "5" - name: LOG_LEVEL description: Caddy logging level DEBUG, INFO, WARN, ERROR, PANIC, and FATAL (https://github.com/caddyserver/caddy/blob/master/logging.go) value: "info" @@ -43,22 +28,6 @@ parameters: from: "[0-5]{1}[0-9]{1}" 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: "${PROMOTE}" - referencePolicy: - type: Local - apiVersion: v1 kind: DeploymentConfig metadata: @@ -69,14 +38,6 @@ objects: 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}" strategy: @@ -88,7 +49,7 @@ objects: deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" spec: containers: - - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" + - image: "ghcr.io/bcgov/quickstart-openshift/frontend:latest" securityContext: capabilities: add: ["NET_BIND_SERVICE"] @@ -198,7 +159,7 @@ objects: restartPolicy: OnFailure containers: - name: ${NAME}-${ZONE}-cronjob - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" + image: "ghcr.io/bcgov/quickstart-openshift/frontend:latest" imagePullPolicy: Always args: ["bash -c 'whoami'"] resources: