From 8844d8b3ce4ea280c387a60f4e8cc8ea6e51f5a5 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Mon, 7 Oct 2024 16:26:16 -0700 Subject: [PATCH] chore(ci): clean up old templates (#247) --- .github/workflows/.deploy.yml | 2 +- backend-go/openshift.deploy.yml | 253 ------------------------ backend-java/openshift.deploy.yml | 190 ------------------ backend-py/openshift.deploy.yml | 307 ------------------------------ 4 files changed, 1 insertion(+), 751 deletions(-) delete mode 100644 backend-go/openshift.deploy.yml delete mode 100644 backend-java/openshift.deploy.yml delete mode 100644 backend-py/openshift.deploy.yml diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml index 08d80f9..4fd4e81 100644 --- a/.github/workflows/.deploy.yml +++ b/.github/workflows/.deploy.yml @@ -72,7 +72,7 @@ jobs: - uses: actions/checkout@v4 - uses: redhat-actions/openshift-tools-installer@v1 with: - oc: "4" + oc: "4.14" - name: Deploy working-directory: ${{ inputs.directory }} shell: bash diff --git a/backend-go/openshift.deploy.yml b/backend-go/openshift.deploy.yml deleted file mode 100644 index 1c5fbfb..0000000 --- a/backend-go/openshift.deploy.yml +++ /dev/null @@ -1,253 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -parameters: - - name: NAME - description: Module name - value: quickstart-openshift-backends - - name: COMPONENT - description: Component name - value: backend-go - - 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 - value: "25m" - - name: MEMORY_REQUEST - value: "50Mi" - - name: CPU_LIMIT - value: "75m" - - name: MEMORY_LIMIT - value: "150Mi" - - name: CPU_REQUEST_INIT - value: "125m" - - name: MEMORY_REQUEST_INIT - value: "100Mi" - - name: CPU_LIMIT_INIT - 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" - - name: REGISTRY - description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) - value: ghcr.io - - name: ORG_NAME - description: Organization name, e.g. bcgov - value: bcgov - - name: PROMOTE - description: Image (namespace/name:tag) to promote/import - value: bcgov/quickstart-openshift-backends/backend-go:test - - name: PROMOTE_MIGRATION - description: Image (namespace/name:tag) for migration to promote/import - value: bcgov/quickstart-openshift-backends/migrations-go:test - - name: COMPONENT_DB_MIGRATION - description: Component name for database migrations - value: migrations-go -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: ImageStream - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT_DB_MIGRATION}" - spec: - lookupPolicy: - local: false - tags: - - name: "${IMAGE_TAG}" - from: - kind: DockerImage - name: "${REGISTRY}/${PROMOTE_MIGRATION}" - referencePolicy: - type: Local - - apiVersion: v1 - kind: DeploymentConfig - 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}" - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - "${NAME}-${COMPONENT_DB_MIGRATION}" - from: - kind: ImageStreamTag - name: "${NAME}-${ZONE}-${COMPONENT_DB_MIGRATION}:${IMAGE_TAG}" - selector: - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" - strategy: - type: Rolling - template: - metadata: - labels: - app: "${NAME}-${ZONE}" - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" - spec: - containers: - - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" - imagePullPolicy: Always - name: "${NAME}" - env: - - name: POSTGRES_HOST - value: "${NAME}-${ZONE}-database" - - name: POSTGRES_DATABASE - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-user - ports: - - containerPort: 3000 - protocol: TCP - resources: - requests: - cpu: "${CPU_REQUEST}" - memory: "${MEMORY_REQUEST}" - limits: - cpu: "${CPU_LIMIT}" - memory: "${MEMORY_LIMIT}" - readinessProbe: - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 2 - timeoutSeconds: 2 - successThreshold: 1 - failureThreshold: 30 - livenessProbe: - successThreshold: 1 - failureThreshold: 3 - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 60 - timeoutSeconds: 5 - initContainers: - - name: "${NAME}-${COMPONENT_DB_MIGRATION}" - image: "${NAME}-${ZONE}-${COMPONENT_DB_MIGRATION}:${IMAGE_TAG}" - env: - - name: FLYWAY_URL - value: "jdbc:postgresql://${NAME}-${ZONE}-database:5432/${NAME}" - - name: FLYWAY_USER - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-user - - name: FLYWAY_PASSWORD - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-password - - name: FLYWAY_BASELINE_ON_MIGRATE - value: "true" - - name: FLYWAY_DEFAULT_SCHEMA - value: "go_api" - resources: - requests: - cpu: "${CPU_REQUEST_INIT}" - memory: "${MEMORY_REQUEST_INIT}" - limits: - cpu: "${CPU_LIMIT_INIT}" - memory: "${MEMORY_LIMIT_INIT}" - - apiVersion: v1 - kind: Service - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT}" - spec: - ports: - - name: 3000-tcp - protocol: TCP - port: 80 - targetPort: 3000 - 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: 3000-tcp - to: - kind: Service - name: "${NAME}-${ZONE}-${COMPONENT}" - weight: 100 - tls: - termination: edge - insecureEdgeTerminationPolicy: Redirect - - apiVersion: autoscaling/v2 - kind: HorizontalPodAutoscaler - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT}" - spec: - scaleTargetRef: - apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "${{MIN_REPLICAS}}" - maxReplicas: "${{MAX_REPLICAS}}" - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 100 diff --git a/backend-java/openshift.deploy.yml b/backend-java/openshift.deploy.yml deleted file mode 100644 index 41d7780..0000000 --- a/backend-java/openshift.deploy.yml +++ /dev/null @@ -1,190 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -parameters: - - name: NAME - description: Module name - value: quickstart-openshift-backends - - name: COMPONENT - description: Component name - value: backend-java - - 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 - value: "25m" - - name: MEMORY_REQUEST - value: "50Mi" - - name: CPU_LIMIT - 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: REGISTRY - description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) - value: ghcr.io - - name: ORG_NAME - description: Organization name, e.g. bcgov - value: bcgov - - name: PROMOTE - description: Image (namespace/name:tag) to promote/import - value: bcgov/quickstart-openshift-backends/backend-java:test -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 - 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}" - strategy: - type: Rolling - template: - metadata: - labels: - app: "${NAME}-${ZONE}" - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" - spec: - containers: - - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" - imagePullPolicy: Always - name: "${NAME}" - env: - - name: POSTGRES_HOST - value: "${NAME}-${ZONE}-database" - - name: POSTGRES_DATABASE - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-user - - ports: - - containerPort: 3000 - protocol: TCP - resources: - requests: - cpu: "${CPU_REQUEST}" - memory: "${MEMORY_REQUEST}" - limits: - cpu: "${CPU_LIMIT}" - memory: "${MEMORY_LIMIT}" - readinessProbe: - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 2 - timeoutSeconds: 2 - successThreshold: 1 - failureThreshold: 30 - livenessProbe: - successThreshold: 1 - failureThreshold: 3 - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 30 - timeoutSeconds: 5 - - - apiVersion: v1 - kind: Service - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT}" - spec: - ports: - - name: 3000-tcp - protocol: TCP - port: 80 - targetPort: 3000 - 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: 3000-tcp - to: - kind: Service - name: "${NAME}-${ZONE}-${COMPONENT}" - weight: 100 - tls: - termination: edge - insecureEdgeTerminationPolicy: Redirect - - apiVersion: autoscaling/v2 - kind: HorizontalPodAutoscaler - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT}" - spec: - scaleTargetRef: - apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "${{MIN_REPLICAS}}" - maxReplicas: "${{MAX_REPLICAS}}" - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 100 diff --git a/backend-py/openshift.deploy.yml b/backend-py/openshift.deploy.yml deleted file mode 100644 index 7676f98..0000000 --- a/backend-py/openshift.deploy.yml +++ /dev/null @@ -1,307 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -parameters: - - name: NAME - description: Module name - value: quickstart-openshift-backends - - name: COMPONENT - description: Component name - value: backend-py - - 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 - value: "25m" - - name: MEMORY_REQUEST - value: "50Mi" - - name: CPU_LIMIT - value: "75m" - - name: MEMORY_LIMIT - value: "150Mi" - - name: CPU_REQUEST_INIT - value: "125m" - - name: MEMORY_REQUEST_INIT - value: "100Mi" - - name: CPU_LIMIT_INIT - 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" - - name: REGISTRY - description: Container registry to import from (internal is image-registry.openshift-image-registry.svc:5000) - value: ghcr.io - - name: ORG_NAME - description: Organization name, e.g. bcgov - value: bcgov - - name: PROMOTE - description: Image (namespace/name:tag) to promote/import - value: bcgov/quickstart-openshift-backends/backend-py:test - - name: PROMOTE_MIGRATION - description: Image (namespace/name:tag) for migration to promote/import - value: bcgov/quickstart-openshift-backends/migrations-py:test - - name: COMPONENT_DB_MIGRATION - description: Component name for database migrations - value: migrations-py -objects: - - apiVersion: v1 - kind: ConfigMap - metadata: - name: "${COMPONENT}-configmap" - namespace: logger-conf - labels: - app: "${NAME}-${ZONE}" - data: - logger.conf: | - [loggers] - keys=root,sqlalchemy,psycopg2 - - [handlers] - keys=console - - [formatters] - keys=default - - [logger_root] - level=INFO - handlers=console - qualname=root - propagate=0 - - [logger_sqlalchemy] - level=DEBUG - handlers=console - qualname=sqlalchemy - propagate=0 - - [logger_psycopg2] - level=DEBUG - handlers=console - qualname=psycopg2 - propagate=0 - - [handler_console] - class=StreamHandler - formatter=default - args=(sys.stdout,) - - [formatter_default] - format=%(asctime)s.%(msecs)03d | %(levelname)s | %(name)s | %(funcName)s:%(lineno)d | %(message)s - datefmt=%Y-%m-%d %H:%M:%S - - - 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: ImageStream - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT_DB_MIGRATION}" - spec: - lookupPolicy: - local: false - tags: - - name: "${IMAGE_TAG}" - from: - kind: DockerImage - name: "${REGISTRY}/${PROMOTE_MIGRATION}" - referencePolicy: - type: Local - - apiVersion: v1 - kind: DeploymentConfig - 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}" - - type: ImageChange - imageChangeParams: - automatic: true - containerNames: - - "${NAME}-${COMPONENT_DB_MIGRATION}" - from: - kind: ImageStreamTag - name: "${NAME}-${ZONE}-${COMPONENT_DB_MIGRATION}:${IMAGE_TAG}" - selector: - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" - strategy: - type: Rolling - template: - metadata: - labels: - app: "${NAME}-${ZONE}" - deploymentconfig: "${NAME}-${ZONE}-${COMPONENT}" - spec: - containers: - - image: "${NAME}-${ZONE}-${COMPONENT}:${IMAGE_TAG}" - imagePullPolicy: Always - name: "${NAME}" - env: - - name: POSTGRES_HOST - value: "${NAME}-${ZONE}-database:5432" - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-user - - name: PYTHONPATH - value: /application/app/src - volumeMounts: - - mountPath: /opt - name: logger-conf - ports: - - containerPort: 3000 - protocol: TCP - resources: - requests: - cpu: "${CPU_REQUEST}" - memory: "${MEMORY_REQUEST}" - limits: - cpu: "${CPU_LIMIT}" - memory: "${MEMORY_LIMIT}" - readinessProbe: - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 5 - periodSeconds: 2 - timeoutSeconds: 2 - successThreshold: 1 - failureThreshold: 30 - livenessProbe: - successThreshold: 1 - failureThreshold: 3 - httpGet: - path: / - port: 3000 - scheme: HTTP - initialDelaySeconds: 60 - periodSeconds: 30 - timeoutSeconds: 5 - volumes: - - name: logger-conf - configMap: - name: "${COMPONENT}-configmap" - initContainers: - - name: "${NAME}-${COMPONENT_DB_MIGRATION}" - image: "${NAME}-${ZONE}-${COMPONENT_DB_MIGRATION}:${IMAGE_TAG}" - env: - - name: FLYWAY_URL - value: "jdbc:postgresql://${NAME}-${ZONE}-database:5432/${NAME}" - - name: FLYWAY_USER - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-user - - name: FLYWAY_PASSWORD - valueFrom: - secretKeyRef: - name: "${NAME}-${ZONE}-database" - key: database-password - - name: FLYWAY_BASELINE_ON_MIGRATE - value: "true" - - name: FLYWAY_DEFAULT_SCHEMA - value: "py-api" - resources: - requests: - cpu: "${CPU_REQUEST_INIT}" - memory: "${MEMORY_REQUEST_INIT}" - limits: - cpu: "${CPU_LIMIT_INIT}" - memory: "${MEMORY_LIMIT_INIT}" - - apiVersion: v1 - kind: Service - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT}" - spec: - ports: - - name: 3000-tcp - protocol: TCP - port: 80 - targetPort: 3000 - 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: 3000-tcp - to: - kind: Service - name: "${NAME}-${ZONE}-${COMPONENT}" - weight: 100 - tls: - termination: edge - insecureEdgeTerminationPolicy: Redirect - - apiVersion: autoscaling/v2 - kind: HorizontalPodAutoscaler - metadata: - labels: - app: "${NAME}-${ZONE}" - name: "${NAME}-${ZONE}-${COMPONENT}" - spec: - scaleTargetRef: - apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - name: "${NAME}-${ZONE}-${COMPONENT}" - minReplicas: "${{MIN_REPLICAS}}" - maxReplicas: "${{MAX_REPLICAS}}" - metrics: - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: 100