Use templates to share the OpenShift config between environments

This commit is contained in:
Ovidio Mallo 2016-12-05 23:19:05 +01:00
parent 75c3d5ea23
commit ee94d7711a
5 changed files with 98 additions and 136 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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