forked from appuio/maxscale-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidecar_template.yaml
274 lines (274 loc) · 7.58 KB
/
sidecar_template.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
apiVersion: v1
kind: Template
metadata:
name: maxscale-sidecar
objects:
- apiVersion: v1
kind: Secret
metadata:
name: ${NAME}
stringData:
cakephp-secret-token: ${CAKEPHP_SECRET_TOKEN}
cakephp-security-cipher-seed: ${CAKEPHP_SECURITY_CIPHER_SEED}
cakephp-security-salt: ${CAKEPHP_SECURITY_SALT}
database-password: ${DATABASE_PASSWORD}
database-user: ${DATABASE_USER}
maxscale-service-pw: ${MAXSCALE_SERVICE_PW}
maxscale-monitor-pw: ${MAXSCALE_MONITOR_PW}
- apiVersion: v1
kind: Service
metadata:
name: ${NAME}
spec:
ports:
- name: web
port: 8080
targetPort: 8080
selector:
name: ${NAME}
- apiVersion: v1
kind: Route
metadata:
name: ${NAME}
spec:
host: ${APPLICATION_DOMAIN}
to:
kind: Service
name: ${NAME}
- apiVersion: v1
kind: ImageStream
metadata:
name: ${NAME}
- apiVersion: v1
kind: BuildConfig
metadata:
annotations:
description: Defines how to build the application
template.alpha.openshift.io/wait-for-ready: "true"
name: ${NAME}
spec:
output:
to:
kind: ImageStreamTag
name: ${NAME}:latest
postCommit:
script: ./lib/Cake/Console/cake test app AllTests
source:
contextDir: ${CONTEXT_DIR}
git:
ref: ${SOURCE_REPOSITORY_REF}
uri: ${SOURCE_REPOSITORY_URL}
type: Git
strategy:
sourceStrategy:
env:
- name: COMPOSER_MIRROR
value: ${COMPOSER_MIRROR}
from:
kind: ImageStreamTag
name: php:7.0
namespace: ${NAMESPACE}
type: Source
triggers:
- type: ImageChange
- type: ConfigChange
- github:
secret: ${GITHUB_WEBHOOK_SECRET}
type: GitHub
- apiVersion: v1
kind: DeploymentConfig
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: ${NAME}
spec:
replicas: 1
selector:
name: ${NAME}
template:
metadata:
labels:
name: ${NAME}
name: ${NAME}
spec:
containers:
- name: maxscale
image: docker.io/appuio/maxscale-docker:2.2.1-beta-4
env:
- name: DB1_ADDRESS
value: ${DB1_ADDRESS}
- name: DB2_ADDRESS
value: ${DB2_ADDRESS}
- name: DB3_ADDRESS
value: ${DB3_ADDRESS}
- name: SERVICE_PWD
valueFrom:
secretKeyRef:
key: maxscale-service-pw
name: ${NAME}
- name: MONITOR_PWD
valueFrom:
secretKeyRef:
key: maxscale-monitor-pw
name: ${NAME}
resources:
limits:
memory: 128Mi
requests:
memory: 128Mi
- name: cakephp-mysql-example
env:
- name: DATABASE_SERVICE_NAME
value: mysql
- name: MYSQL_SERVICE_PORT
value: "3306"
- name: MYSQL_SERVICE_HOST
value: 127.0.0.1
- name: DATABASE_ENGINE
value: ${DATABASE_ENGINE}
- name: DATABASE_NAME
value: ${DATABASE_NAME}
- name: DATABASE_USER
valueFrom:
secretKeyRef:
key: database-user
name: ${NAME}
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: ${NAME}
- name: CAKEPHP_SECRET_TOKEN
valueFrom:
secretKeyRef:
key: cakephp-secret-token
name: ${NAME}
- name: CAKEPHP_SECURITY_SALT
valueFrom:
secretKeyRef:
key: cakephp-security-salt
name: ${NAME}
- name: CAKEPHP_SECURITY_CIPHER_SEED
valueFrom:
secretKeyRef:
key: cakephp-security-cipher-seed
name: ${NAME}
- name: OPCACHE_REVALIDATE_FREQ
value: ${OPCACHE_REVALIDATE_FREQ}
image: ' '
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 3
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /health.php
port: 8080
initialDelaySeconds: 3
timeoutSeconds: 3
resources:
limits:
memory: ${MEMORY_LIMIT}
triggers:
- imageChangeParams:
automatic: true
containerNames:
- cakephp-mysql-example
from:
kind: ImageStreamTag
name: ${NAME}:latest
type: ImageChange
- type: ConfigChange
parameters:
- description: The name assigned to all of the frontend objects defined in this template.
displayName: Name
name: NAME
required: true
value: cakephp-mysql-example
- description: The OpenShift Namespace where the ImageStream resides.
displayName: Namespace
name: NAMESPACE
required: true
value: openshift
- description: Maximum amount of memory the CakePHP container can use.
displayName: Memory Limit
name: MEMORY_LIMIT
required: true
value: 512Mi
- description: The URL of the repository with your application source code.
displayName: Git Repository URL
name: SOURCE_REPOSITORY_URL
required: true
value: https://github.com/openshift/cakephp-ex.git
- description: Set this to a branch name, tag or other ref of your repository if you
are not using the default branch.
displayName: Git Reference
name: SOURCE_REPOSITORY_REF
- description: Set this to the relative path to your project if it is not in the root
of your repository.
displayName: Context Directory
name: CONTEXT_DIR
- description: The exposed hostname that will route to the CakePHP service, if left
blank a value will be defaulted.
displayName: Application Hostname
name: APPLICATION_DOMAIN
- description: Github trigger secret. A difficult to guess string encoded as part
of the webhook URL. Not encrypted.
displayName: GitHub Webhook Secret
from: '[a-zA-Z0-9]{40}'
generate: expression
name: GITHUB_WEBHOOK_SECRET
- description: 'Database engine: postgresql, mysql or sqlite (default).'
displayName: Database Engine
name: DATABASE_ENGINE
required: true
value: mysql
- displayName: Database Name
name: DATABASE_NAME
required: true
value: default
- displayName: Database User
name: DATABASE_USER
required: true
value: cakephp
- displayName: Database Password
from: '[a-zA-Z0-9]{16}'
generate: expression
name: DATABASE_PASSWORD
- description: Set this to a long random string.
displayName: CakePHP secret token
from: '[\w]{50}'
generate: expression
name: CAKEPHP_SECRET_TOKEN
- description: Security salt for session hash.
displayName: CakePHP Security Salt
from: '[a-zA-Z0-9]{40}'
generate: expression
name: CAKEPHP_SECURITY_SALT
- description: Security cipher seed for session hash.
displayName: CakePHP Security Cipher Seed
from: '[0-9]{30}'
generate: expression
name: CAKEPHP_SECURITY_CIPHER_SEED
- description: How often to check script timestamps for updates, in seconds. 0 will
result in OPcache checking for updates on every request.
displayName: OPcache Revalidation Frequency
name: OPCACHE_REVALIDATE_FREQ
value: "2"
- description: The custom Composer mirror URL
displayName: Custom Composer Mirror URL
name: COMPOSER_MIRROR
- name: MAXSCALE_SERVICE_PW
required: true
- name: MAXSCALE_MONITOR_PW
required: true
- name: DB1_ADDRESS
required: true
- name: DB2_ADDRESS
required: true
- name: DB3_ADDRESS
required: true