-
Notifications
You must be signed in to change notification settings - Fork 40
/
component-template.yml
117 lines (117 loc) · 3.3 KB
/
component-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
apiVersion: template.openshift.io/v1
kind: Template
labels:
template: component-template
app: "${PROJECT}-${COMPONENT}"
parameters:
- name: PROJECT
displayName: Application
description: The name of the application project.
required: true
- name: COMPONENT
displayName: Component
description: The name of the application component.
required: true
- name: ENV
displayName: Environment
description: The environment stage.
required: true
- name: MEMORY_LIMIT
displayName: Memory Limit
description: Maximum amount of memory available for the container.
value: 256Mi
- name: MEMORY_REQUEST
displayName: Memory Request
description: Minimum amount of memory requested for the container.
value: 128Mi
- name: CPU_LIMIT
displayName: CPU Limit
description: Maximum CPU (milli) cores available for the container.
value: 100m
- name: CPU_REQUEST
displayName: CPU Request
description: Minimum CPU (milli) cores requested for the container.
value: 50m
- name: TAGVERSION
displayName: tag version
description: The version to be used.
value: latest
required: true
objects:
- apiVersion: v1
kind: Service
metadata:
name: "${COMPONENT}"
spec:
ports:
- name: 8080-tcp
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: "${PROJECT}-${COMPONENT}"
deploymentconfig: "${COMPONENT}"
sessionAffinity: None
type: ClusterIP
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: "${COMPONENT}"
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
app: "${PROJECT}-${COMPONENT}"
deploymentconfig: "${COMPONENT}"
strategy:
activeDeadlineSeconds: 21600
recreateParams:
timeoutSeconds: 600
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
type: Recreate
template:
metadata:
labels:
app: "${PROJECT}-${COMPONENT}"
deploymentconfig: "${COMPONENT}"
env: "${ENV}"
spec:
containers:
- image: "${PROJECT}-${ENV}/${COMPONENT}:${TAGVERSION}"
imagePullPolicy: Always
name: "${COMPONENT}"
ports:
- containerPort: 8080
protocol: TCP
resources:
limits:
cpu: "${CPU_LIMIT}"
memory: "${MEMORY_LIMIT}"
requests:
cpu: "${CPU_REQUEST}"
memory: "${MEMORY_REQUEST}"
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:
- "${COMPONENT}"
from:
kind: ImageStreamTag
name: "${COMPONENT}:${TAGVERSION}"
namespace: "${PROJECT}-${ENV}"
type: ImageChange