From 7c0fe62475c36ea061ec983d35529cf1f12e40a4 Mon Sep 17 00:00:00 2001 From: Tim McCarthy Date: Sun, 9 Feb 2020 21:15:22 -0800 Subject: [PATCH] Updated the template and pipeline files --- build/aro/catalog-api/azure-pipelines.yml | 3 + build/aro/identity-api/azure-pipelines.yml | 3 + build/aro/readme.md | 4 +- deploy/api-app-template.yml | 79 ++++++++++++ .../basket-api/basket-api-aro-template.yml | 118 ------------------ 5 files changed, 87 insertions(+), 120 deletions(-) create mode 100644 deploy/api-app-template.yml delete mode 100644 deploy/aro/basket-api/basket-api-aro-template.yml diff --git a/build/aro/catalog-api/azure-pipelines.yml b/build/aro/catalog-api/azure-pipelines.yml index 7be5affb8..ea045dc22 100644 --- a/build/aro/catalog-api/azure-pipelines.yml +++ b/build/aro/catalog-api/azure-pipelines.yml @@ -1,5 +1,8 @@ variables: ProjectName: Catalog.API + OpenShiftProject: development + AppName: catalogapi + OpenShiftServiceConnection: 'OpenShift on ARO' trigger: branches: include: diff --git a/build/aro/identity-api/azure-pipelines.yml b/build/aro/identity-api/azure-pipelines.yml index 2e8d87587..7969ad943 100644 --- a/build/aro/identity-api/azure-pipelines.yml +++ b/build/aro/identity-api/azure-pipelines.yml @@ -1,5 +1,8 @@ variables: ProjectName: Identity.API + OpenShiftProject: development + AppName: identityapi + OpenShiftServiceConnection: 'OpenShift on ARO' trigger: branches: include: diff --git a/build/aro/readme.md b/build/aro/readme.md index fdaebddc8..5397e5635 100644 --- a/build/aro/readme.md +++ b/build/aro/readme.md @@ -1,5 +1,5 @@ -# ARO build definitions +# OpenShift on ARO build definitions -This folder contains the Azure DevOps build definitions in YAML format. Each folder contains one `azure-pipelines.yml` that contains the build definition for one microservice (usually a Docker image, but some microservices generates more than one Docker image). +This folder contains the Azure DevOps build definitions in YAML format targeting container builds in OpenShift on ARO. Each folder contains one `azure-pipelines.yml` that contains the build definition for one microservice. The container images are built inside of the OpenShift cluster from the latest release of the RHEL .NET Core base image. For more information about YAML builds read the [Azure DevOps documentation](https://docs.microsoft.com/azure/devops/pipelines/get-started-yaml?view=azure-devops). \ No newline at end of file diff --git a/deploy/api-app-template.yml b/deploy/api-app-template.yml new file mode 100644 index 000000000..2daacc6e2 --- /dev/null +++ b/deploy/api-app-template.yml @@ -0,0 +1,79 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: 'api-template' +objects: +- apiVersion: apps.openshift.io/v1 + kind: DeploymentConfig + metadata: + labels: + app: ${APPLICATION_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/development${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: development + type: ImageChange +- apiVersion: v1 + kind: Service + metadata: + labels: + app: ${APPLICATION_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: {} +parameters: +- description: The name for the application. + displayName: Application Name + name: APPLICATION_NAME + required: true +- description: The OpenShift project name that is hosting the image registry. + displayName: Image Registry Project Name + name: IMAGE_REGISTRY_PROJECT_NAME + required: true diff --git a/deploy/aro/basket-api/basket-api-aro-template.yml b/deploy/aro/basket-api/basket-api-aro-template.yml deleted file mode 100644 index 24cf56397..000000000 --- a/deploy/aro/basket-api/basket-api-aro-template.yml +++ /dev/null @@ -1,118 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - creationTimestamp: null - name: '''basketapi-template''' -objects: -- apiVersion: apps.openshift.io/v1 - kind: DeploymentConfig - metadata: - annotations: - openshift.io/generated-by: OpenShiftNewApp - creationTimestamp: null - generation: 6 - labels: - app: basketapi - name: basketapi - spec: - replicas: 1 - revisionHistoryLimit: 10 - selector: - app: basketapi - deploymentconfig: basketapi - strategy: - activeDeadlineSeconds: 21600 - resources: {} - rollingParams: - intervalSeconds: 1 - maxSurge: 25% - maxUnavailable: 25% - timeoutSeconds: 600 - updatePeriodSeconds: 1 - type: Rolling - template: - metadata: - annotations: - openshift.io/generated-by: OpenShiftNewApp - creationTimestamp: null - labels: - app: basketapi - deploymentconfig: basketapi - spec: - containers: - - image: docker-registry.default.svc:5000/development/basketapi-build@sha256:7149637592a2e9bbfa78836762a5c300f6b19220ca001902e4c6c1767cb19c3d - imagePullPolicy: Always - livenessProbe: - failureThreshold: 3 - httpGet: - path: /liveness - port: 8080 - scheme: HTTP - initialDelaySeconds: 10 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 3 - name: basketapi - ports: - - containerPort: 8080 - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /hc - port: 8080 - scheme: HTTP - initialDelaySeconds: 10 - periodSeconds: 10 - successThreshold: 1 - timeoutSeconds: 10 - resources: {} - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 - test: false - triggers: - - type: ConfigChange - - imageChangeParams: - automatic: true - containerNames: - - basketapi - from: - kind: ImageStreamTag - name: basketapi-build:latest - namespace: development - lastTriggeredImage: docker-registry.default.svc:5000/development/basketapi-build@sha256:7149637592a2e9bbfa78836762a5c300f6b19220ca001902e4c6c1767cb19c3d - type: ImageChange - status: - availableReplicas: 0 - latestVersion: 0 - observedGeneration: 0 - replicas: 0 - unavailableReplicas: 0 - updatedReplicas: 0 -- apiVersion: v1 - kind: Service - metadata: - annotations: - openshift.io/generated-by: OpenShiftNewApp - creationTimestamp: null - labels: - app: basketapi - name: basketapi - spec: - ports: - - name: 8080-tcp - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - app: basketapi - deploymentconfig: basketapi - sessionAffinity: None - type: ClusterIP - status: - loadBalancer: {}