From edc68959da13ddf3a1e806b9a0a7640a3f62da1c Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Mon, 2 Mar 2020 09:20:05 -0600 Subject: [PATCH] Refactored apigw applications to use a generic template --- .../apigw-deploy-template.yml} | 3 +- .../mobilemarketingapigw/azure-pipelines.yml | 2 +- .../mobileshoppingapigw/azure-pipelines.yml | 6 +- .../mobileshoppingapigw-deploy-template.yml | 116 ------------------ .../aro/webmarketingapigw/azure-pipelines.yml | 6 +- .../webmarketingapigw-deploy-template.yml | 116 ------------------ .../aro/webshoppingapigw/azure-pipelines.yml | 6 +- .../webshoppingapigw-deploy-template.yml | 116 ------------------ 8 files changed, 11 insertions(+), 360 deletions(-) rename deploy/aro/{mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml => apigw-templates/apigw-deploy-template.yml} (97%) delete mode 100644 deploy/aro/mobileshoppingapigw/mobileshoppingapigw-deploy-template.yml delete mode 100644 deploy/aro/webmarketingapigw/webmarketingapigw-deploy-template.yml delete mode 100644 deploy/aro/webshoppingapigw/webshoppingapigw-deploy-template.yml diff --git a/deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml b/deploy/aro/apigw-templates/apigw-deploy-template.yml similarity index 97% rename from deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml rename to deploy/aro/apigw-templates/apigw-deploy-template.yml index db553a50b..fefd5866c 100644 --- a/deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml +++ b/deploy/aro/apigw-templates/apigw-deploy-template.yml @@ -121,7 +121,6 @@ parameters: displayName: Application Name name: APPLICATION_NAME required: true - value: mobilemarketingapigw - description: The OpenShift project name that is hosting the image registry. displayName: Image Registry Project Name name: IMAGE_REGISTRY_PROJECT_NAME @@ -130,4 +129,4 @@ parameters: displayName: Template Name name: TEMPLATE_NAME required: true - value: mobilemarketingapigw-deploy-template \ No newline at end of file + value: ${APPLICATION_NAME}-deploy-template \ No newline at end of file diff --git a/deploy/aro/mobilemarketingapigw/azure-pipelines.yml b/deploy/aro/mobilemarketingapigw/azure-pipelines.yml index 7dff9ed69..74e17beaf 100644 --- a/deploy/aro/mobilemarketingapigw/azure-pipelines.yml +++ b/deploy/aro/mobilemarketingapigw/azure-pipelines.yml @@ -41,6 +41,6 @@ stages: - script: 'oc create configmap mobilemarketingapigw --from-file=./deploy/aro/mobilemarketingapigw/envoy.yml' failOnStderr: true displayName: 'Create Envoy ConfigMap' - - script: 'oc process -f ./deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' + - script: 'oc process -f ./deploy/aro/apigw-templates/apigw-deploy-template.yml -p APPLICATION_NAME=mobilemarketingapigw -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' failOnStderr: true displayName: 'Ensure Mobile Marketing API Gateway OpenShift DeploymentConfig and Service' \ No newline at end of file diff --git a/deploy/aro/mobileshoppingapigw/azure-pipelines.yml b/deploy/aro/mobileshoppingapigw/azure-pipelines.yml index 41fc27f4e..15db38177 100644 --- a/deploy/aro/mobileshoppingapigw/azure-pipelines.yml +++ b/deploy/aro/mobileshoppingapigw/azure-pipelines.yml @@ -24,10 +24,10 @@ stages: vmImage: 'windows-latest' steps: - task: colinsalmcorner.colinsalmcorner-buildtasks.replace-tokens-task.ReplaceTokens@1 - displayName: 'Replace tokens in envoy.yaml' + displayName: 'Replace tokens in envoy.yml' inputs: sourcePath: ./deploy/aro/mobileshoppingapigw - filePattern: envoy.yaml + filePattern: envoy.yml - task: redhat.openshift-vsts.oc-setup-task.oc-setup@2 displayName: 'Setup Openshift CLI' inputs: @@ -35,6 +35,6 @@ stages: - script: 'oc project $(OpenShiftProject)' failOnStderr: true displayName: 'Set OpenShift Project Context' - - script: 'oc process -f ./deploy/aro/mobileshoppingapigw/mobileshoppingapigw-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' + - script: 'oc process -f ./deploy/aro/apigw-templates/apigw-deploy-template.yml -p APPLICATION_NAME=mobileshoppingapigw -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' failOnStderr: true displayName: 'Ensure Mobile Shopping API Gateway OpenShift DeploymentConfig and Service' \ No newline at end of file diff --git a/deploy/aro/mobileshoppingapigw/mobileshoppingapigw-deploy-template.yml b/deploy/aro/mobileshoppingapigw/mobileshoppingapigw-deploy-template.yml deleted file mode 100644 index 24522979d..000000000 --- a/deploy/aro/mobileshoppingapigw/mobileshoppingapigw-deploy-template.yml +++ /dev/null @@ -1,116 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - name: ${TEMPLATE_NAME} -objects: -- apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - replicas: 1 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - strategy: - type: Rolling - revisionHistoryLimit: 2 - template: - metadata: - labels: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - spec: - containers: - - env: - - name: PATH_BASE - value: /mobileshoppingapigw - image: docker-registry.default.svc:5000/${IMAGE_REGISTRY_PROJECT_NAME}/${APPLICATION_NAME}:latest - imagePullPolicy: Always - name: ${APPLICATION_NAME} - ports: - - containerPort: 8080 - protocol: TCP - - containerPort: 8001 - protocol: TCP - resources: {} - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 - triggers: - - type: ConfigChange - - imageChangeParams: - automatic: true - containerNames: - - ${APPLICATION_NAME} - from: - kind: ImageStreamTag - name: ${APPLICATION_NAME}:latest - namespace: ${IMAGE_REGISTRY_PROJECT_NAME} - type: ImageChange -- apiVersion: v1 - kind: Service - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - ports: - - name: 8080-tcp - port: 8080 - protocol: TCP - targetPort: 8080 - - name: 8001-tcp - port: 8001 - protocol: TCP - targetPort: 8001 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - lookupPolicy: - local: false - tags: - - annotations: - openshift.io/imported-from: 'envoyproxy/envoy:v1.11.1' - from: - kind: DockerImage - name: 'envoyproxy/envoy:v1.11.1' - importPolicy: {} - name: latest - referencePolicy: - type: Source -parameters: -- description: The name for the application. - displayName: Application Name - name: APPLICATION_NAME - required: true - value: mobileshoppingapigw -- description: The OpenShift project name that is hosting the image registry. - displayName: Image Registry Project Name - name: IMAGE_REGISTRY_PROJECT_NAME - required: true -- description: The template name. - displayName: Template Name - name: TEMPLATE_NAME - required: true - value: mobileshoppingapigw-deploy-template \ No newline at end of file diff --git a/deploy/aro/webmarketingapigw/azure-pipelines.yml b/deploy/aro/webmarketingapigw/azure-pipelines.yml index fa36adea2..abc3f654c 100644 --- a/deploy/aro/webmarketingapigw/azure-pipelines.yml +++ b/deploy/aro/webmarketingapigw/azure-pipelines.yml @@ -24,10 +24,10 @@ stages: vmImage: 'windows-latest' steps: - task: colinsalmcorner.colinsalmcorner-buildtasks.replace-tokens-task.ReplaceTokens@1 - displayName: 'Replace tokens in envoy.yaml' + displayName: 'Replace tokens in envoy.yml' inputs: sourcePath: ./deploy/aro/webmarketingapigw - filePattern: envoy.yaml + filePattern: envoy.yml - task: redhat.openshift-vsts.oc-setup-task.oc-setup@2 displayName: 'Setup Openshift CLI' inputs: @@ -35,6 +35,6 @@ stages: - script: 'oc project $(OpenShiftProject)' failOnStderr: true displayName: 'Set OpenShift Project Context' - - script: 'oc process -f ./deploy/aro/webmarketingapigw/webmarketingapigw-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' + - script: 'oc process -f ./deploy/aro/apigw-templates/apigw-deploy-template.yml -p APPLICATION_NAME=webmarketingapigw -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' failOnStderr: true displayName: 'Ensure Web Marketing API Gateway OpenShift DeploymentConfig and Service' \ No newline at end of file diff --git a/deploy/aro/webmarketingapigw/webmarketingapigw-deploy-template.yml b/deploy/aro/webmarketingapigw/webmarketingapigw-deploy-template.yml deleted file mode 100644 index f0bf0266b..000000000 --- a/deploy/aro/webmarketingapigw/webmarketingapigw-deploy-template.yml +++ /dev/null @@ -1,116 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - name: ${TEMPLATE_NAME} -objects: -- apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - replicas: 1 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - strategy: - type: Rolling - revisionHistoryLimit: 2 - template: - metadata: - labels: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - spec: - containers: - - env: - - name: PATH_BASE - value: /webmarketingapigw - image: docker-registry.default.svc:5000/${IMAGE_REGISTRY_PROJECT_NAME}/${APPLICATION_NAME}:latest - imagePullPolicy: Always - name: ${APPLICATION_NAME} - ports: - - containerPort: 8080 - protocol: TCP - - containerPort: 8001 - protocol: TCP - resources: {} - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 - triggers: - - type: ConfigChange - - imageChangeParams: - automatic: true - containerNames: - - ${APPLICATION_NAME} - from: - kind: ImageStreamTag - name: ${APPLICATION_NAME}:latest - namespace: ${IMAGE_REGISTRY_PROJECT_NAME} - type: ImageChange -- apiVersion: v1 - kind: Service - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - ports: - - name: 8080-tcp - port: 8080 - protocol: TCP - targetPort: 8080 - - name: 8001-tcp - port: 8001 - protocol: TCP - targetPort: 8001 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - lookupPolicy: - local: false - tags: - - annotations: - openshift.io/imported-from: 'envoyproxy/envoy:v1.11.1' - from: - kind: DockerImage - name: 'envoyproxy/envoy:v1.11.1' - importPolicy: {} - name: latest - referencePolicy: - type: Source -parameters: -- description: The name for the application. - displayName: Application Name - name: APPLICATION_NAME - required: true - value: webmarketingapigw -- description: The OpenShift project name that is hosting the image registry. - displayName: Image Registry Project Name - name: IMAGE_REGISTRY_PROJECT_NAME - required: true -- description: The template name. - displayName: Template Name - name: TEMPLATE_NAME - required: true - value: webmarketingapigw-deploy-template \ No newline at end of file diff --git a/deploy/aro/webshoppingapigw/azure-pipelines.yml b/deploy/aro/webshoppingapigw/azure-pipelines.yml index 72ec61423..60c68100e 100644 --- a/deploy/aro/webshoppingapigw/azure-pipelines.yml +++ b/deploy/aro/webshoppingapigw/azure-pipelines.yml @@ -24,10 +24,10 @@ stages: vmImage: 'windows-latest' steps: - task: colinsalmcorner.colinsalmcorner-buildtasks.replace-tokens-task.ReplaceTokens@1 - displayName: 'Replace tokens in envoy.yaml' + displayName: 'Replace tokens in envoy.yml' inputs: sourcePath: ./deploy/aro/webshoppingapigw - filePattern: envoy.yaml + filePattern: envoy.yml - task: redhat.openshift-vsts.oc-setup-task.oc-setup@2 displayName: 'Setup Openshift CLI' inputs: @@ -35,6 +35,6 @@ stages: - script: 'oc project $(OpenShiftProject)' failOnStderr: true displayName: 'Set OpenShift Project Context' - - script: 'oc process -f ./deploy/aro/webshoppingapigw/webshoppingapigw-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' + - script: 'oc process -f ./deploy/aro/apigw-templates/apigw-deploy-template.yml -p APPLICATION_NAME=webshoppingapigw -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) | oc apply -f-' failOnStderr: true displayName: 'Ensure Web Shopping API Gateway OpenShift DeploymentConfig and Service' \ No newline at end of file diff --git a/deploy/aro/webshoppingapigw/webshoppingapigw-deploy-template.yml b/deploy/aro/webshoppingapigw/webshoppingapigw-deploy-template.yml deleted file mode 100644 index 87145927c..000000000 --- a/deploy/aro/webshoppingapigw/webshoppingapigw-deploy-template.yml +++ /dev/null @@ -1,116 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - name: ${TEMPLATE_NAME} -objects: -- apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - replicas: 1 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - strategy: - type: Rolling - revisionHistoryLimit: 2 - template: - metadata: - labels: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - spec: - containers: - - env: - - name: PATH_BASE - value: /webshoppingapigw - image: docker-registry.default.svc:5000/${IMAGE_REGISTRY_PROJECT_NAME}/${APPLICATION_NAME}:latest - imagePullPolicy: Always - name: ${APPLICATION_NAME} - ports: - - containerPort: 8080 - protocol: TCP - - containerPort: 8001 - protocol: TCP - resources: {} - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 - triggers: - - type: ConfigChange - - imageChangeParams: - automatic: true - containerNames: - - ${APPLICATION_NAME} - from: - kind: ImageStreamTag - name: ${APPLICATION_NAME}:latest - namespace: ${IMAGE_REGISTRY_PROJECT_NAME} - type: ImageChange -- apiVersion: v1 - kind: Service - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - ports: - - name: 8080-tcp - port: 8080 - protocol: TCP - targetPort: 8080 - - name: 8001-tcp - port: 8001 - protocol: TCP - targetPort: 8001 - selector: - app: ${APPLICATION_NAME} - deploymentconfig: ${APPLICATION_NAME} - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {} -- apiVersion: image.openshift.io/v1 - kind: ImageStream - metadata: - labels: - app: ${APPLICATION_NAME} - template: ${TEMPLATE_NAME} - name: ${APPLICATION_NAME} - spec: - lookupPolicy: - local: false - tags: - - annotations: - openshift.io/imported-from: 'envoyproxy/envoy:v1.11.1' - from: - kind: DockerImage - name: 'envoyproxy/envoy:v1.11.1' - importPolicy: {} - name: latest - referencePolicy: - type: Source -parameters: -- description: The name for the application. - displayName: Application Name - name: APPLICATION_NAME - required: true - value: webshoppingapigw -- description: The OpenShift project name that is hosting the image registry. - displayName: Image Registry Project Name - name: IMAGE_REGISTRY_PROJECT_NAME - required: true -- description: The template name. - displayName: Template Name - name: TEMPLATE_NAME - required: true - value: webshoppingapigw-deploy-template \ No newline at end of file