-
Notifications
You must be signed in to change notification settings - Fork 10
/
deploy-template.yaml
579 lines (579 loc) · 17.9 KB
/
deploy-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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
apiVersion: template.openshift.io/v1
kind: Template
metadata:
annotations:
description: poolboy deploy
name: poolboy-deploy
objects:
- apiVersion: v1
kind: Namespace
metadata:
annotations:
openshift-provision/action: create
name: ${NAMESPACE}
- apiVersion: v1
kind: ServiceAccount
metadata:
name: ${SERVICE_NAME}
namespace: ${NAMESPACE}
- apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
rbac.authorization.k8s.io/aggregate-to-admin: 'true'
name: ${SERVICE_NAME}-aggregate-to-admin
rules:
- apiGroups:
- ${OPERATOR_DOMAIN}
resources:
- resourceclaims
verbs:
- create
- delete
- get
- list
- patch
- watch
- update
- apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
rbac.authorization.k8s.io/aggregate-to-edit: 'true'
name: ${SERVICE_NAME}-aggregate-to-edit
rules:
- apiGroups:
- ${OPERATOR_DOMAIN}
resources:
- resourceclaims
verbs:
- get
- list
- watch
- apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ${SERVICE_NAME}
rules:
- apiGroups:
- ${OPERATOR_DOMAIN}
resources:
- resourceproviders
verbs:
- get
- list
- watch
- apiGroups:
- ${OPERATOR_DOMAIN}
resources:
- resourceclaims
- resourceclaims/status
- resourcehandles
- resourcepools
- resourcepools/status
- resourceproviders/status
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ''
resources:
- namespaces
verbs:
- get
- list
- apiGroups:
- user.openshift.io
resources:
- users
- identities
verbs:
- get
- apiGroups:
- ''
resources:
- events
verbs:
- create
- patch
- update
- apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ${SERVICE_NAME}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ${SERVICE_NAME}
subjects:
- kind: ServiceAccount
name: ${SERVICE_NAME}
namespace: ${NAMESPACE}
- apiVersion: v1
kind: Service
metadata:
name: ${SERVICE_NAME}
namespace: ${NAMESPACE}
spec:
ports:
- name: metrics
port: 8000
protocol: TCP
targetPort: 8000
selector:
name: ${SERVICE_NAME}
sessionAffinity: None
type: ClusterIP
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: ${SERVICE_NAME}
name: ${SERVICE_NAME}
namespace: ${NAMESPACE}
spec:
replicas: 1
selector:
matchLabels:
name: ${SERVICE_NAME}
strategy:
type: Recreate
template:
metadata:
labels:
name: ${SERVICE_NAME}
spec:
containers:
- env:
- name: OPERATOR_DOMAIN
value: ${OPERATOR_DOMAIN}
image: ${IMAGE}
imagePullPolicy: ${IMAGE_PULL_POLICY}
livenessProbe:
initialDelaySeconds: 30
tcpSocket:
port: 8080
timeoutSeconds: 1
name: manager
ports:
- containerPort: 8000
name: metrics
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
restartPolicy: Always
securityContext: {}
serviceAccountName: ${SERVICE_NAME}
terminationGracePeriodSeconds: 30
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: resourceclaims.${OPERATOR_DOMAIN}
spec:
group: ${OPERATOR_DOMAIN}
names:
kind: ResourceClaim
plural: resourceclaims
shortNames: []
singular: resourceclaim
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ResourceClaims describe a request for one or more resources to
be created within the cluster. ResourceClaims will are first checked for
validity against ResourceProviders and then matched to a ResourceHandle
or a ResourceHandle is created dynamically.
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
description: ResourceClaim specification
properties:
resources:
items:
properties:
provider:
description: ResourceProvider specification that is used to
manage the resource template. The provider may be specified
explicitly or discovered by matching against the template.
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
required:
- name
type: object
template:
description: Resource template which is matched to and evaluated
against a ResourceProvider.
type: object
required:
- template
type: object
type: array
type: object
status:
description: ResourceClaim status
properties:
resourceHandle:
description: ResourceHandle reference for handle matched to this claim
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
type: object
resources:
description: Status of resources managed for this claim
items:
properties:
provider:
description: ResourceProvider reference for provider managing
this resource
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
state:
type: object
type: string
type: object
state:
description: Resource state synchronized from managed resource
type: object
type: object
type: array
type: object
required:
- apiVersion
- kind
- metadata
- spec
type: object
version: v1
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: resourcehandles.${OPERATOR_DOMAIN}
spec:
group: ${OPERATOR_DOMAIN}
names:
kind: ResourceHandle
plural: resourcehandles
shortNames: []
singular: resourcehandle
scope: Namespaced
validation:
openAPIV3Schema:
description: ResourceHandles describe resources managed by Poolboy and ResourceProviders
used to manage those resources. All ResourceHandles should exist in the
poolboy namespace with names beginning with the string "guid-" to prevent
naming conflicts in generated resource names.
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
description: ResourceHandle specification
properties:
resourceClaim:
description: ResourceClaim reference for claim matched to this ResourceHandle
when the handle has been claimed.
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
required:
- apiVersion
- kind
- name
- namespace
type: object
resources:
description: List of resources managed by a ResourceHandle
items:
properties:
provider:
description: Reference to ResourceProvider
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
required:
- apiVersion
- kind
- name
- namespace
type: object
reference:
description: Reference to managed resource
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
required:
- apiVersion
- kind
- name
type: object
template:
description: Resource template. Once a ResourceClaim is matched
to a handle the claim's template is used to manage the handle
template.
type: object
required:
- provider
- template
type: object
type: array
required:
- resources
type: object
required:
- apiVersion
- kind
- metadata
- spec
type: object
version: v1
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: resourcepools.${OPERATOR_DOMAIN}
spec:
group: ${OPERATOR_DOMAIN}
names:
kind: ResourcePool
plural: resourcepools
shortNames: []
singular: resourcepool
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ResourcePools are used to manage a reserve number of unclaimed
ResourceHandles.
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
description: ResourcePool specification
properties:
minAvailable:
description: Minimum number of unclaimed resource handles to maintain
for the ResourcePool.
minimum: 0
type: integer
resources:
description: Resources description to apply to ResourceHandles for
the pool.
items:
properties:
provider:
description: Reference to ResourceProvider
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
namespace:
type: string
required:
- apiVersion
- kind
- name
- namespace
type: object
template:
description: Resource template for ResourceHandle
type: object
required:
- provider
- template
type: object
type: array
required:
- resources
type: object
required:
- apiVersion
- kind
- metadata
- spec
type: object
version: v1
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: resourceproviders.${OPERATOR_DOMAIN}
spec:
group: ${OPERATOR_DOMAIN}
names:
kind: ResourceProvider
plural: resourceproviders
shortNames: []
singular: resourceprovider
scope: Namespaced
validation:
openAPIV3Schema:
description: ResourceProviders describe how to manage resources from settings
in ResourceClaims and ResourceHandles.
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
description: Specification of how the ResourceProvider should manage resources.
properties:
default:
description: Template applied to resource claims immediately after
matching to the provider to set default values into the claim when
not present.
type: object
match:
description: Partial resource definition used to check if a resource
in a handle or claim matches this provider.
type: object
matchIgnore:
description: Regular expressions used to filter out differences between
a resources in a claim or when matching to a handle. Comparison
is made by generating a JSON Patch (RFC 6902) comparison between
the resource definitions. If any of these regular expressions matches
the JSON Pointer (IETF 6901) path component of the patch then it
is ignored.
items:
type: string
type: array
override:
description: Override template that is merged with the ResourceHandle
resource template to generate the final resource definition.
type: object
updateFilters:
description: Restrictions to apply to changes which can propagate
from the ResourceClaim resource template to the ResourceHandle resource
template.
items:
properties:
allowedOps:
description: List of operations that are allowed propagate from
the ResourceClaim to the ResourceHandle resource definition.
These are checked against the generated JSON Patch items which
may have verbs "add", "replace", and "remove". If not given,
then all operations are allowed.
items:
type: string
type: array
pathMatch:
description: Regular expression used to match against the calculated
JSON Patch path. Regular expressions must match the entire
path.
type: string
required:
- pathMatch
type: object
type: array
validation:
description: Validation to apply to ResourceClaim resource templates.
properties:
customValidation:
description: WARNING! This feature is not yet implemented! Custom
validation of ResourceClaim resource template using Jinja2 expressions.
items:
properties:
check:
description: Jinja2 expression which must evaluate to a
true value for the ResourceClaim resource template.
type: string
name:
description: Descriptive name of what is checked to communicate
when check fails.
type: string
required:
- name
- check
type: object
type: array
openAPIV3Schema:
description: OpenAPI 3.0 data model (schema) used to validate
ResourceClaim resource templates. This is the same schema specification
used by CustomResourceDefinitions (CRDs) but with support for
additional features supported such as disallowing additional
properties of objects. These schemas can be used to place limits
on resource definitions beyond the definition of the cluster
API such as to restrict a string field to a particular set of
allowed values or numeric fields to specific numeric ranges.
type: object
type: object
required:
- match
type: object
required:
- apiVersion
- kind
- metadata
- spec
type: object
version: v1
parameters:
- name: NAMESPACE
value: poolboy
- name: IMAGE
value: quay.io/redhat-cop/poolboy:v0.3.7
- name: IMAGE_PULL_POLICY
value: IfNotPresent
- name: SERVICE_NAME
value: poolboy
- name: OPERATOR_DOMAIN
value: poolboy.gpte.redhat.com