forked from ggianini/OpenShift-Demo-Instructor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-build-config.yaml
298 lines (294 loc) · 10 KB
/
template-build-config.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
apiVersion: template.openshift.io/v1
kind: Template
labels:
template: mysql-persistent-template-populado
message: |-
The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.
Username: ${MYSQL_USER}
Password: ${MYSQL_PASSWORD}
Database Name: ${MYSQL_DATABASE}
Connection URL: mysql://${DATABASE_SERVICE_NAME}:3306/
For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mysql-container/blob/master/8.0/root/usr/share/container-scripts/mysql/README.md.
metadata:
annotations:
description: |-
This image and template are based on the official template from Red Hat Catalog. This template was created for demonstration purposes.
------------------------------------------------------------------------------------------------------------------------------------------
MySQL database service, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mysql-container/blob/master/8.0/root/usr/share/container-scripts/mysql/README.md.
NOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template.
iconClass: icon-mysql-database
iconClass: fa fa-server
openshift.io/display-name: MySQL (Populado)
openshift.io/documentation-url: https://docs.okd.io/latest/using_images/db_images/mysql.html
openshift.io/long-description: This image and template are based on the official template from Red Hat Catalog. This template was created for demonstration purposes.
------------------------------------------------------------------------------------------------------------------------------------------
This template provides a standalone MySQL server
with a database created. The database is stored on persistent storage. The
database name, username, and password are chosen via parameters when provisioning
this service.
openshift.io/provider-display-name: Hugo Pfeffer
# openshift.io/support-url: https://access.redhat.com
samples.operator.openshift.io/version: 4.8.17
tags: database,mysql
creationTimestamp: "2021-11-08T14:57:41Z"
labels:
samples.operator.openshift.io/managed: "true"
name: mysql-persistent-populated
# namespace: openshift
resourceVersion: "14741"
uid: 905f610c-1ef3-4c3a-8fc8-b0c508621cce
objects:
- apiVersion: v1
kind: Secret
metadata:
annotations:
template.openshift.io/expose-database_name: '{.data[''database-name'']}'
template.openshift.io/expose-password: '{.data[''database-password'']}'
template.openshift.io/expose-root_password: '{.data[''database-root-password'']}'
template.openshift.io/expose-username: '{.data[''database-user'']}'
template.openshift.io/expose-context: '{.data[''context-dir'']}'
template.openshift.io/expose-git_source: '{.data[''git-source'']}'
name: ${DATABASE_SERVICE_NAME}
stringData:
database-name: ${MYSQL_DATABASE}
database-password: ${MYSQL_PASSWORD}
database-root-password: ${MYSQL_ROOT_PASSWORD}
database-user: ${MYSQL_USER}
context-dir: ${MYSQL_CONTEXT}
git-source: ${GIT_SOURCE}
- apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/component: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/instance: ${DATABASE_SERVICE_NAME}
name: ${DATABASE_SERVICE_NAME}
spec:
lookupPolicy:
local: false
status:
dockerImageRepository: ""
- apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/component: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/instance: ${DATABASE_SERVICE_NAME}
name: ${DATABASE_SERVICE_NAME}
spec:
nodeSelector: null
output:
to:
kind: ImageStreamTag
name: ${DATABASE_SERVICE_NAME}:latest
postCommit: {}
resources: {}
source:
contextDir: extend-image
git:
uri: ${GIT_SOURCE}
type: Git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: mysql:8.0
namespace: ${NAMESPACE}
type: Source
triggers:
- github:
secret: HiPNKWLuvWKKf6gRu_He
type: GitHub
- generic:
secret: 5SO9GJoxgsVC5kn0p9MM
type: Generic
- type: ConfigChange
- imageChange: {}
type: ImageChange
status:
lastVersion: 0
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"${DATABASE_SERVICE_NAME}:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"${DATABASE_SERVICE_NAME}\")].image"}]'
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
app: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/component: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/instance: ${DATABASE_SERVICE_NAME}
name: ${DATABASE_SERVICE_NAME}
spec:
replicas: 1
selector:
matchLabels:
deployment: ${DATABASE_SERVICE_NAME}
strategy: {}
template:
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: null
labels:
deployment: ${DATABASE_SERVICE_NAME}
spec:
containers:
- env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: ${DATABASE_SERVICE_NAME}
- name: MYSQL_CONTEXT
valueFrom:
secretKeyRef:
key: context-dir
name: ${DATABASE_SERVICE_NAME}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: ${DATABASE_SERVICE_NAME}
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: database-root-password
name: ${DATABASE_SERVICE_NAME}
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database-name
name: ${DATABASE_SERVICE_NAME}
image: ' '
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- /bin/sh
- -i
- -c
- MYSQL_PWD="$MYSQL_PASSWORD" mysqladmin -u $MYSQL_USER ping
initialDelaySeconds: 30
timeoutSeconds: 1
name: mysql
ports:
- containerPort: 3306
readinessProbe:
exec:
command:
- /bin/sh
- -i
- -c
- MYSQL_PWD="$MYSQL_PASSWORD" mysqladmin -u $MYSQL_USER ping
initialDelaySeconds: 5
timeoutSeconds: 1
resources:
limits:
memory: ${MEMORY_LIMIT}
volumeMounts:
- mountPath: /var/lib/mysql/data
name: ${DATABASE_SERVICE_NAME}-data
volumes:
- name: ${DATABASE_SERVICE_NAME}-data
persistentVolumeClaim:
claimName: ${DATABASE_SERVICE_NAME}
status: {}
- apiVersion: v1
kind: Service
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
template.openshift.io/expose-uri: mysql://{.spec.clusterIP}:{.spec.ports[?(.name=="mysql")].port}
creationTimestamp: null
labels:
app: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/component: ${DATABASE_SERVICE_NAME}
app.kubernetes.io/instance: ${DATABASE_SERVICE_NAME}
name: ${DATABASE_SERVICE_NAME}
spec:
ports:
- name: 3306-tcp
port: 3306
protocol: TCP
targetPort: 3306
selector:
deployment: ${DATABASE_SERVICE_NAME}
status:
loadBalancer: {}
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ${DATABASE_SERVICE_NAME}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${VOLUME_CAPACITY}
parameters:
- description: Maximum amount of memory the container can use.
displayName: Memory Limit
name: MEMORY_LIMIT
required: true
value: 512Mi
- description: The OpenShift Namespace where the ImageStream resides.
displayName: Namespace
name: NAMESPACE
value: openshift
- description: The name of the OpenShift Service exposed for the database.
displayName: Database Service Name
name: DATABASE_SERVICE_NAME
required: true
value: mysql
- description: Username for MySQL user that will be used for accessing the database.
displayName: MySQL Connection Username
from: user[A-Z0-9]{3}
generate: expression
name: MYSQL_USER
required: true
- description: Context directory where the s2i scrits are located
displayName: Context Directory
value: extend-image
name: MYSQL_CONTEXT
required: true
- description: Password for the MySQL connection user.
displayName: MySQL Connection Password
from: '[a-zA-Z0-9]{16}'
generate: expression
name: MYSQL_PASSWORD
required: true
- description: Password for the MySQL root user.
displayName: MySQL root user Password
from: '[a-zA-Z0-9]{16}'
generate: expression
name: MYSQL_ROOT_PASSWORD
required: true
- description: Name of the MySQL database accessed.
displayName: MySQL Database Name
name: MYSQL_DATABASE
required: true
value: sampledb
- description: Volume space available for data, e.g. 512Mi, 2Gi.
displayName: Volume Capacity
name: VOLUME_CAPACITY
required: true
value: 1Gi
- description: Git Source
displayName: Git Source
name: GIT_SOURCE
required: true
value: https://github.com/HugoPfeffer/OpenShift-Demo-Instructor.git
- description: Version of MySQL image to be used (8.0-el7, 8.0-el8, or latest).
displayName: Version of MySQL Image
name: MYSQL_VERSION
required: true
value: 8.0-el8