From ee94d7711ab7af8f2658c12c3081a76b0f756100 Mon Sep 17 00:00:00 2001 From: Ovidio Mallo Date: Mon, 5 Dec 2016 23:19:05 +0100 Subject: [PATCH] Use templates to share the OpenShift config between environments --- deployment/config/app.yaml | 67 ++++++++++++++++++++++++++++++++ deployment/config/build.yaml | 31 +++++++++++++++ deployment/config/dev/app.yaml | 53 ------------------------- deployment/config/dev/build.yaml | 30 -------------- deployment/config/test/app.yaml | 53 ------------------------- 5 files changed, 98 insertions(+), 136 deletions(-) create mode 100644 deployment/config/app.yaml create mode 100644 deployment/config/build.yaml delete mode 100644 deployment/config/dev/app.yaml delete mode 100644 deployment/config/dev/build.yaml delete mode 100644 deployment/config/test/app.yaml diff --git a/deployment/config/app.yaml b/deployment/config/app.yaml new file mode 100644 index 0000000..85183d4 --- /dev/null +++ b/deployment/config/app.yaml @@ -0,0 +1,67 @@ +apiVersion: v1 +kind: Template +objects: +- apiVersion: v1 + kind: DeploymentConfig + metadata: + labels: + app: frontend + name: frontend + spec: + replicas: 1 + selector: + app: frontend + deploymentconfig: frontend + template: + metadata: + labels: + app: frontend + deploymentconfig: frontend + spec: + containers: + - image: rubex-dev/${IMAGE_STREAM_TAG} + name: frontend + ports: + - containerPort: 8080 + protocol: TCP + triggers: + - type: ImageChange + imageChangeParams: + automatic: false + containerNames: + - frontend + from: + kind: ImageStreamTag + name: ${IMAGE_STREAM_TAG} + namespace: rubex-dev +- apiVersion: v1 + kind: Service + metadata: + labels: + app: frontend + name: frontend + spec: + ports: + - name: 8080-tcp + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: frontend + deploymentconfig: frontend +- apiVersion: v1 + kind: Route + metadata: + labels: + app: frontend + name: frontend + spec: + port: + targetPort: 8080-tcp + to: + kind: Service + name: frontend +parameters: +- description: The image stream tag from which to deploy. + displayName: Image Stream Tag + name: IMAGE_STREAM_TAG diff --git a/deployment/config/build.yaml b/deployment/config/build.yaml new file mode 100644 index 0000000..0aa4032 --- /dev/null +++ b/deployment/config/build.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Template +objects: +- apiVersion: v1 + kind: ImageStream + metadata: + labels: + app: frontend + name: frontend +- apiVersion: v1 + kind: BuildConfig + metadata: + labels: + app: frontend + name: frontend + spec: + output: + to: + kind: ImageStreamTag + name: frontend:latest + source: + type: Git + git: + uri: https://github.com/omallo/ruby-ex + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + name: ruby:2.3 + namespace: openshift diff --git a/deployment/config/dev/app.yaml b/deployment/config/dev/app.yaml deleted file mode 100644 index b15a750..0000000 --- a/deployment/config/dev/app.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -apiVersion: v1 -kind: DeploymentConfig -metadata: - labels: - app: frontend - name: frontend -spec: - replicas: 1 - selector: - app: frontend - deploymentconfig: frontend - template: - metadata: - labels: - app: frontend - deploymentconfig: frontend - spec: - containers: - - image: frontend:latest - name: frontend - ports: - - containerPort: 8080 - protocol: TCP ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: frontend - name: frontend -spec: - ports: - - name: 8080-tcp - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - app: frontend - deploymentconfig: frontend ---- -apiVersion: v1 -kind: Route -metadata: - labels: - app: frontend - name: frontend -spec: - port: - targetPort: 8080-tcp - to: - kind: Service - name: frontend diff --git a/deployment/config/dev/build.yaml b/deployment/config/dev/build.yaml deleted file mode 100644 index 0550ac6..0000000 --- a/deployment/config/dev/build.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -apiVersion: v1 -kind: ImageStream -metadata: - labels: - app: frontend - name: frontend ---- -apiVersion: v1 -kind: BuildConfig -metadata: - labels: - app: frontend - name: frontend -spec: - output: - to: - kind: ImageStreamTag - name: frontend:latest - source: - type: Git - git: - uri: https://github.com/omallo/ruby-ex - strategy: - type: Source - sourceStrategy: - from: - kind: ImageStreamTag - name: ruby:2.3 - namespace: openshift diff --git a/deployment/config/test/app.yaml b/deployment/config/test/app.yaml deleted file mode 100644 index 41c0763..0000000 --- a/deployment/config/test/app.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -apiVersion: v1 -kind: DeploymentConfig -metadata: - labels: - app: frontend - name: frontend -spec: - replicas: 1 - selector: - app: frontend - deploymentconfig: frontend - template: - metadata: - labels: - app: frontend - deploymentconfig: frontend - spec: - containers: - - image: rubex-dev/frontend:test - name: frontend - ports: - - containerPort: 8080 - protocol: TCP ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: frontend - name: frontend -spec: - ports: - - name: 8080-tcp - port: 8080 - protocol: TCP - targetPort: 8080 - selector: - app: frontend - deploymentconfig: frontend ---- -apiVersion: v1 -kind: Route -metadata: - labels: - app: frontend - name: frontend -spec: - port: - targetPort: 8080-tcp - to: - kind: Service - name: frontend