From 4206cda3ea73f97b06a3040a6a5afbd0378f7d89 Mon Sep 17 00:00:00 2001 From: Paulo Gomes da Cruz Junior Date: Tue, 6 Feb 2024 15:17:42 -0800 Subject: [PATCH] feat(FSADT1-679): disabling openshift routes (#210) --- .github/openshift.dev.yml | 42 ++++++++++++++++++++++++++++ .github/workflows/api-check.yml | 8 ------ .github/workflows/pr-open.yml | 11 ++++++++ openshift.deploy.yml | 49 +++++++++++---------------------- 4 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 .github/openshift.dev.yml diff --git a/.github/openshift.dev.yml b/.github/openshift.dev.yml new file mode 100644 index 00000000..fcb99bd2 --- /dev/null +++ b/.github/openshift.dev.yml @@ -0,0 +1,42 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: ${NAME} + annotations: + description: "Nr-Forest-Client-Api" + tags: "nr-forest-client-api" + iconClass: icon-js +labels: + app: ${NAME}-${ZONE} + app.kubernetes.io/part-of: ${NAME}-${ZONE} +parameters: + - name: NAME + description: Module name + value: nr-forest-client-api + - name: ZONE + description: Deployment zone, e.g. pr-### or prod + required: + true + - name: COMPONENT + description: Component name + value: backend + - name: DOMAIN + value: apps.silver.devops.gov.bc.ca +objects: +- apiVersion: route.openshift.io/v1 + kind: Route + metadata: + labels: + app: ${NAME}-${ZONE} + name: ${NAME}-${ZONE}-${COMPONENT} + spec: + host: ${NAME}-${ZONE}-${COMPONENT}.${DOMAIN} + port: + targetPort: 3001-tcp + to: + kind: Service + name: ${NAME}-${ZONE}-${COMPONENT} + weight: 100 + tls: + termination: edge + insecureEdgeTerminationPolicy: Redirect \ No newline at end of file diff --git a/.github/workflows/api-check.yml b/.github/workflows/api-check.yml index b22f592b..d327e856 100644 --- a/.github/workflows/api-check.yml +++ b/.github/workflows/api-check.yml @@ -22,14 +22,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Postman Smoke Test on Openshift - uses: matt-ball/newman-action@master - with: - collection: postman/FCA.postman_collection.json - envVar: '[{"key":"URL_FCA","value":"https://${{ github.event.repository.name }}-${{ matrix.package }}-backend.${{ env.OS_DOMAIN }}"}]' - reporters: '["cli"]' - folder: '["general"]' - - name: Postman Smoke Test on API Gateway uses: matt-ball/newman-action@master with: diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index a615c8a6..518cbc72 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -117,6 +117,17 @@ jobs: -p ORACLEDB_SECRET=${{ secrets.ORACLEDB_SECRET }} -p ZONE=${{ github.event.number }} + - name: Deploy dev route + uses: bcgov-nr/action-deployer-openshift@v2.0.0 + with: + file: .github/openshift.dev.yml + oc_namespace: ${{ secrets.OC_NAMESPACE }} + oc_server: ${{ secrets.OC_SERVER }} + oc_token: ${{ secrets.OC_TOKEN }} + overwrite: true + parameters: + -p ZONE=${{ github.event.number }} + postman: name: Smoke Test needs: [deploy] diff --git a/openshift.deploy.yml b/openshift.deploy.yml index e040ed73..fcc8c2ab 100644 --- a/openshift.deploy.yml +++ b/openshift.deploy.yml @@ -56,8 +56,8 @@ parameters: description: The amount of storage the cert PVC should have value: 25Mi objects: - - apiVersion: v1 - kind: Secret + - kind: Secret + apiVersion: v1 metadata: name: ${NAME}-${ZONE}-${COMPONENT} labels: @@ -69,8 +69,8 @@ objects: oracle-host: "${ORACLEDB_HOST}" oracle-service: "${ORACLEDB_SERVICENAME}" oracle-secret: "${ORACLEDB_SECRET}" - - apiVersion: v1 - kind: ImageStream + - kind: ImageStream + apiVersion: v1 metadata: labels: app: ${NAME}-${ZONE} @@ -85,8 +85,8 @@ objects: name: ghcr.io/bcgov/${NAME}/api:${ZONE} referencePolicy: type: Local - - apiVersion: v1 - kind: PersistentVolumeClaim + - kind: PersistentVolumeClaim + apiVersion: v1 metadata: labels: app: ${NAME}-${ZONE} @@ -98,8 +98,8 @@ objects: requests: storage: ${CERT_PVC_SIZE} storageClassName: netapp-file-standard - - apiVersion: v1 - kind: DeploymentConfig + - kind: DeploymentConfig + apiVersion: v1 metadata: labels: app: ${NAME}-${ZONE} @@ -228,8 +228,8 @@ objects: volumeMounts: - mountPath: /cert name: ${NAME}-${ZONE}-${COMPONENT} - - apiVersion: v1 - kind: Service + - kind: Service + apiVersion: v1 metadata: labels: app: ${NAME}-${ZONE} @@ -242,25 +242,8 @@ objects: targetPort: 3001 selector: deploymentconfig: ${NAME}-${ZONE}-${COMPONENT} - - apiVersion: route.openshift.io/v1 - kind: Route - metadata: - labels: - app: ${NAME}-${ZONE} - name: ${NAME}-${ZONE}-${COMPONENT} - spec: - host: ${NAME}-${ZONE}-${COMPONENT}.${DOMAIN} - port: - targetPort: 3001-tcp - to: - kind: Service - name: ${NAME}-${ZONE}-${COMPONENT} - weight: 100 - tls: - termination: edge - insecureEdgeTerminationPolicy: Redirect - - apiVersion: networking.k8s.io/v1 - kind: NetworkPolicy + - kind: NetworkPolicy + apiVersion: networking.k8s.io/v1 metadata: name: allow-from-openshift-ingress labels: @@ -274,8 +257,8 @@ objects: network.openshift.io/policy-group: ingress policyTypes: - Ingress - - apiVersion: networking.k8s.io/v1 - kind: NetworkPolicy + - kind: NetworkPolicy + apiVersion: networking.k8s.io/v1 metadata: name: allow-same-namespace labels: @@ -287,8 +270,8 @@ objects: - podSelector: {} policyTypes: - Ingress - - apiVersion: networking.k8s.io/v1 - kind: NetworkPolicy + - kind: NetworkPolicy + apiVersion: networking.k8s.io/v1 metadata: name: allow-traffic-from-gateway-to-your-api spec: