diff --git a/backend/openshift.deploy.yml b/backend/openshift.deploy.yml index 8ad4535..9e4f514 100644 --- a/backend/openshift.deploy.yml +++ b/backend/openshift.deploy.yml @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 @@ -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: @@ -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}}" diff --git a/frontend/openshift.deploy.yml b/frontend/openshift.deploy.yml index b6d7e80..07b9978 100644 --- a/frontend/openshift.deploy.yml +++ b/frontend/openshift.deploy.yml @@ -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 @@ -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 @@ -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"] @@ -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 @@ -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: @@ -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}}"