-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathk8svalidations.samples.fabric8.io-v1.yml
161 lines (160 loc) · 5.57 KB
/
k8svalidations.samples.fabric8.io-v1.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
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
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: k8svalidations.samples.fabric8.io
spec:
group: samples.fabric8.io
names:
kind: K8sValidation
plural: k8svalidations
singular: k8svalidation
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
spec:
properties:
deepLevel1:
properties:
deepLevel2:
properties:
simple:
type: string
x-kubernetes-validations:
- rule: self.startsWith('deep-')
valueL2:
type: string
required:
- valueL2
type: object
valueL1:
type: string
required:
- deepLevel2
- valueL1
type: object
x-kubernetes-validations:
- messageExpression: '''valueL1 ('' + self.valueL1 + '') must be equal
to deepLevel2.valueL2 ('' + self.deepLevel2.valueL2 + '')'''
rule: self.valueL1 == self.deepLevel2.valueL2
immutable:
type: string
x-kubernetes-validations:
- message: cannot be changed once set
rule: self == oldSelf
maxReplicas:
type: integer
minReplicas:
type: integer
monotonicCounter:
type: integer
x-kubernetes-validations:
- message: cannot decrease value once set
reason: FieldValueForbidden
rule: self >= oldSelf
multiple:
type: string
x-kubernetes-validations:
- rule: self.startsWith('start-')
- rule: self.endsWith('-end')
namePrefix:
type: string
onAbstractClass:
properties:
dummy:
type: string
required:
- dummy
type: object
x-kubernetes-validations:
- rule: self.dummy.startsWith('abstract-')
onAttributeAndClass:
properties:
dummy:
type: string
required:
- dummy
type: object
x-kubernetes-validations:
- rule: self.dummy.startsWith('on-class-')
- rule: self.dummy.startsWith('on-attr-')
onAttributeAndGetter:
type: string
x-kubernetes-validations:
- rule: self.startsWith('start-')
- rule: self.endsWith('-end')
onGetter:
type: string
x-kubernetes-validations:
- rule: self.startsWith('on-getter-')
priority:
enum:
- high
- low
- medium
type: string
x-kubernetes-validations:
- message: cannot transition directly between 'low' and 'high'
rule: '!(self == ''high'' && oldSelf == ''low'') && !(self == ''low''
&& oldSelf == ''high'')'
replicas:
type: integer
simple:
type: string
x-kubernetes-validations:
- rule: self.startsWith('simple-')
required:
- minReplicas
- onAttributeAndGetter
- replicas
- deepLevel1
- onAttributeAndClass
- simple
- multiple
- onAbstractClass
- onGetter
- maxReplicas
- priority
- namePrefix
type: object
x-kubernetes-validations:
- fieldPath: .replicas
rule: self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas
- message: replicas must be greater than or equal to minReplicas
rule: self.minReplicas <= self.replicas
- message: replicas must be smaller than or equal to maxReplicas
rule: self.replicas <= self.maxReplicas
status:
properties:
availableReplicas:
type: integer
type: object
type: object
x-kubernetes-validations:
- messageExpression: '''name must start with '' + self.spec.namePrefix'
reason: FieldValueForbidden
rule: self.metadata.name.startsWith(self.spec.namePrefix)
- message: updates not allowed in degraded state
rule: self.status.availableReplicas >= self.spec.minReplicas
served: true
storage: true
subresources:
status: {}