From 887e1d2dc3c15deb5b50513744b31daed51f669e Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Fri, 28 Feb 2020 16:06:08 -0600 Subject: [PATCH] Added deploy template and deploy piepliens for mobilemarketingapigw --- .../mobilemarketingapigw/azure-pipelines.yml | 35 ++++++ .../mobilemarketingapigw-deploy-template.yml | 107 ++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 deploy/aro/mobilemarketingapigw/azure-pipelines.yml create mode 100644 deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml diff --git a/deploy/aro/mobilemarketingapigw/azure-pipelines.yml b/deploy/aro/mobilemarketingapigw/azure-pipelines.yml new file mode 100644 index 000000000..99abf3cd9 --- /dev/null +++ b/deploy/aro/mobilemarketingapigw/azure-pipelines.yml @@ -0,0 +1,35 @@ +variables: + OpenShiftServiceConnection: 'OpenShift on ARO' +trigger: + branches: + include: + - master + - dev + paths: + include: + - deploy/aro/mobilemarketingapigw/* +stages: + - stage: development + displayName: Development + variables: + OpenShiftProject: development + SourceImageRegistryProjectName: development + EnvironmentName: -dev.msftnbu.com + jobs: + - job: MobileMarketingApiGatewayDeployment + displayName: 'Mobile Marketing API Gateway Deployment' + variables: + - template: ../azure-devops-templates/variables.yml + pool: + vmImage: 'windows-latest' + steps: + - task: redhat.openshift-vsts.oc-setup-task.oc-setup@2 + displayName: 'Setup Openshift CLI' + inputs: + openshiftService: $(OpenShiftServiceConnection) + - script: 'oc project $(OpenShiftProject)' + failOnStderr: true + displayName: 'Set OpenShift Project Context' + - script: 'oc process -f ./deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml -p IMAGE_REGISTRY_PROJECT_NAME=$(SourceImageRegistryProjectName) -p BASKET_API_URL=$(BasketApiUrl) -p CATALOG_API_URL=$(CatalogApiUrl) -p ORDERING_API_URL=$(OrderingApiUrl) -p IDENTITY_API_URL=$(IdentityApiUrl) -p BASKET_API_GRPC_URL=$(BasketApiGrpcUrl) -p CATALOG_API_GRPC_URL=$(CatalogApiGrpcUrl) -p ORDERING_API_GRPC_URL=$(OrderingApiGrpcUrl) -p CATALOG_API_HC_URL=$(CatalogApiHc) -p ORDERING_API_HC_URL=$(OrderingApiHc) -p IDENTITY_API_HC_URL=$(IdentityApiHc) -p BASKET_API_HC_URL=$(BasketApiHc) -p MARKETING_API_HC_URL=$(MarketingApiHc) -p PAYMENT_API_HC_URL=$(PaymentApiHc) -p LOCATION_API_HC_URL=$(LocationsApiHc) -p IDENTITY_URL_EXTERNAL=$(IdentityUrlExternal) | 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/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml b/deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml new file mode 100644 index 000000000..8751c31a5 --- /dev/null +++ b/deploy/aro/mobilemarketingapigw/mobilemarketingapigw-deploy-template.yml @@ -0,0 +1,107 @@ +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: + image: docker-registry.default.svc:5000/${IMAGE_REGISTRY_PROJECT_NAME}/${APPLICATION_NAME}:latest + imagePullPolicy: Always + name: ${APPLICATION_NAME} + ports: + - containerPort: 8080 + 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 + 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: mobilesmarketingapigw +- 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: mobilesmarketingapigw-deploy-template \ No newline at end of file