1package v2beta1
2
3// PolicyException declares resources to be excluded from specified policies.
4#PolicyException: {
5 _embeddedResource
6
7 // APIVersion defines the versioned schema of this representation of an object.
8 // Servers should convert recognized schemas to the latest internal value, and
9 // may reject unrecognized values.
10 // More info:
11 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
12 apiVersion?: string
13
14 // Kind is a string value representing the REST resource this object represents.
15 // Servers may infer this from the endpoint the client submits requests to.
16 // Cannot be updated.
17 // In CamelCase.
18 // More info:
19 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
20 kind?: string
21 metadata?: {}
22
23 // Spec declares policy exception behaviors.
24 spec!: {
25 // Background controls if exceptions are applied to existing policies during a background scan.
26 // Optional. Default value is "true". The value must be set to "false" if the policy rule
27 // uses variables that are only available in the admission review request (e.g. user name).
28 background?: bool
29
30 // Conditions are used to determine if a resource applies to the exception by evaluating a
31 // set of conditions. The declaration can contain nested `any` or `all` statements.
32 conditions?: {
33 // AllConditions enable variable-based conditional rule execution. This is useful for
34 // finer control of when an rule is applied. A condition can reference object data
35 // using JMESPath notation.
36 // Here, all of the conditions need to pass.
37 all?: [...{
38 // Key is the context entry (using JMESPath) for conditional rule evaluation.
39 key?: null | bool | number | string | [...] | {...}
40
41 // Message is an optional display message
42 message?: string
43
44 // Operator is the conditional operation to perform. Valid operators are:
45 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
46 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
47 // DurationLessThanOrEquals, DurationLessThan
48 operator?: "Equals" |
49 "NotEquals" |
50 "AnyIn" |
51 "AllIn" |
52 "AnyNotIn" |
53 "AllNotIn" |
54 "GreaterThanOrEquals" |
55 "GreaterThan" |
56 "LessThanOrEquals" |
57 "LessThan" |
58 "DurationGreaterThanOrEquals" |
59 "DurationGreaterThan" |
60 "DurationLessThanOrEquals" |
61 "DurationLessThan"
62
63 // Value is the conditional value, or set of values. The values can be fixed set
64 // or can be variables declared using JMESPath.
65 value?: null | bool | number | string | [...] | {...}
66 }]
67
68 // AnyConditions enable variable-based conditional rule execution. This is useful for
69 // finer control of when an rule is applied. A condition can reference object data
70 // using JMESPath notation.
71 // Here, at least one of the conditions need to pass.
72 any?: [...{
73 // Key is the context entry (using JMESPath) for conditional rule evaluation.
74 key?: null | bool | number | string | [...] | {...}
75
76 // Message is an optional display message
77 message?: string
78
79 // Operator is the conditional operation to perform. Valid operators are:
80 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
81 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
82 // DurationLessThanOrEquals, DurationLessThan
83 operator?: "Equals" |
84 "NotEquals" |
85 "AnyIn" |
86 "AllIn" |
87 "AnyNotIn" |
88 "AllNotIn" |
89 "GreaterThanOrEquals" |
90 "GreaterThan" |
91 "LessThanOrEquals" |
92 "LessThan" |
93 "DurationGreaterThanOrEquals" |
94 "DurationGreaterThan" |
95 "DurationLessThanOrEquals" |
96 "DurationLessThan"
97
98 // Value is the conditional value, or set of values. The values can be fixed set
99 // or can be variables declared using JMESPath.
100 value?: null | bool | number | string | [...] | {...}
101 }]
102 }
103
104 // Exceptions is a list policy/rules to be excluded
105 exceptions!: [...{
106 // PolicyName identifies the policy to which the exception is applied.
107 // The policy name uses the format <namespace>/<name> unless it
108 // references a ClusterPolicy.
109 policyName!: string
110
111 // RuleNames identifies the rules to which the exception is applied.
112 ruleNames!: [...string]
113 }]
114
115 // Match defines match clause used to check if a resource applies to the exception
116 match!: matchN(0, [null | bool | number | string | [...] | {
117 any!: _
118 all!: _
119 }]) & {
120 // All allows specifying resources which will be ANDed
121 all?: [...{
122 // ClusterRoles is the list of cluster-wide role names for the user.
123 clusterRoles?: [...string]
124
125 // ResourceDescription contains information about the resource being created or modified.
126 resources?: matchN(0, [null | bool | number | string | [...] | {
127 name!: _
128 names!: _
129 }]) & {
130 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
131 // and values support the wildcard characters "*" (matches zero or many characters) and
132 // "?" (matches at least one character).
133 annotations?: [string]: string
134
135 // Kinds is a list of resource kinds.
136 kinds?: [...string]
137
138 // Name is the name of the resource. The name supports wildcard characters
139 // "*" (matches zero or many characters) and "?" (at least one character).
140 // NOTE: "Name" is being deprecated in favor of "Names".
141 name?: string
142
143 // Names are the names of the resources. Each name supports wildcard characters
144 // "*" (matches zero or many characters) and "?" (at least one character).
145 names?: [...string]
146
147 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
148 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
149 // and `?` (matches one character).Wildcards allows writing label selectors like
150 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
151 // does not match an empty label set.
152 namespaceSelector?: {
153 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
154 matchExpressions?: [...{
155 // key is the label key that the selector applies to.
156 key!: string
157
158 // operator represents a key's relationship to a set of values.
159 // Valid operators are In, NotIn, Exists and DoesNotExist.
160 operator!: string
161
162 // values is an array of string values. If the operator is In or NotIn,
163 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
164 // the values array must be empty. This array is replaced during a strategic
165 // merge patch.
166 values?: [...string]
167 }]
168
169 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
170 // map is equivalent to an element of matchExpressions, whose key field is "key", the
171 // operator is "In", and the values array contains only "value". The requirements are ANDed.
172 matchLabels?: [string]: string
173 }
174
175 // Namespaces is a list of namespaces names. Each name supports wildcard characters
176 // "*" (matches zero or many characters) and "?" (at least one character).
177 namespaces?: [...string]
178
179 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
180 // are used to match a specific action.
181 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
182
183 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
184 // characters `*` (matches zero or many characters) and `?` (matches one character).
185 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
186 // using ["*" : "*"] matches any key and value but does not match an empty label set.
187 selector?: {
188 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
189 matchExpressions?: [...{
190 // key is the label key that the selector applies to.
191 key!: string
192
193 // operator represents a key's relationship to a set of values.
194 // Valid operators are In, NotIn, Exists and DoesNotExist.
195 operator!: string
196
197 // values is an array of string values. If the operator is In or NotIn,
198 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
199 // the values array must be empty. This array is replaced during a strategic
200 // merge patch.
201 values?: [...string]
202 }]
203
204 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
205 // map is equivalent to an element of matchExpressions, whose key field is "key", the
206 // operator is "In", and the values array contains only "value". The requirements are ANDed.
207 matchLabels?: [string]: string
208 }
209 }
210
211 // Roles is the list of namespaced role names for the user.
212 roles?: [...string]
213
214 // Subjects is the list of subject names like users, user groups, and service accounts.
215 subjects?: [...{
216 // APIGroup holds the API group of the referenced subject.
217 // Defaults to "" for ServiceAccount subjects.
218 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
219 apiGroup?: string
220
221 // Kind of object being referenced. Values defined by this API group are "User",
222 // "Group", and "ServiceAccount".
223 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
224 kind!: string
225
226 // Name of the object being referenced.
227 name!: string
228
229 // Namespace of the referenced object. If the object kind is non-namespace, such
230 // as "User" or "Group", and this value is not empty
231 // the Authorizer should report an error.
232 namespace?: string
233 }]
234 }]
235
236 // Any allows specifying resources which will be ORed
237 any?: [...{
238 // ClusterRoles is the list of cluster-wide role names for the user.
239 clusterRoles?: [...string]
240
241 // ResourceDescription contains information about the resource being created or modified.
242 resources?: matchN(0, [null | bool | number | string | [...] | {
243 name!: _
244 names!: _
245 }]) & {
246 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
247 // and values support the wildcard characters "*" (matches zero or many characters) and
248 // "?" (matches at least one character).
249 annotations?: [string]: string
250
251 // Kinds is a list of resource kinds.
252 kinds?: [...string]
253
254 // Name is the name of the resource. The name supports wildcard characters
255 // "*" (matches zero or many characters) and "?" (at least one character).
256 // NOTE: "Name" is being deprecated in favor of "Names".
257 name?: string
258
259 // Names are the names of the resources. Each name supports wildcard characters
260 // "*" (matches zero or many characters) and "?" (at least one character).
261 names?: [...string]
262
263 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
264 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
265 // and `?` (matches one character).Wildcards allows writing label selectors like
266 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
267 // does not match an empty label set.
268 namespaceSelector?: {
269 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
270 matchExpressions?: [...{
271 // key is the label key that the selector applies to.
272 key!: string
273
274 // operator represents a key's relationship to a set of values.
275 // Valid operators are In, NotIn, Exists and DoesNotExist.
276 operator!: string
277
278 // values is an array of string values. If the operator is In or NotIn,
279 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
280 // the values array must be empty. This array is replaced during a strategic
281 // merge patch.
282 values?: [...string]
283 }]
284
285 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
286 // map is equivalent to an element of matchExpressions, whose key field is "key", the
287 // operator is "In", and the values array contains only "value". The requirements are ANDed.
288 matchLabels?: [string]: string
289 }
290
291 // Namespaces is a list of namespaces names. Each name supports wildcard characters
292 // "*" (matches zero or many characters) and "?" (at least one character).
293 namespaces?: [...string]
294
295 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
296 // are used to match a specific action.
297 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
298
299 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
300 // characters `*` (matches zero or many characters) and `?` (matches one character).
301 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
302 // using ["*" : "*"] matches any key and value but does not match an empty label set.
303 selector?: {
304 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
305 matchExpressions?: [...{
306 // key is the label key that the selector applies to.
307 key!: string
308
309 // operator represents a key's relationship to a set of values.
310 // Valid operators are In, NotIn, Exists and DoesNotExist.
311 operator!: string
312
313 // values is an array of string values. If the operator is In or NotIn,
314 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
315 // the values array must be empty. This array is replaced during a strategic
316 // merge patch.
317 values?: [...string]
318 }]
319
320 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
321 // map is equivalent to an element of matchExpressions, whose key field is "key", the
322 // operator is "In", and the values array contains only "value". The requirements are ANDed.
323 matchLabels?: [string]: string
324 }
325 }
326
327 // Roles is the list of namespaced role names for the user.
328 roles?: [...string]
329
330 // Subjects is the list of subject names like users, user groups, and service accounts.
331 subjects?: [...{
332 // APIGroup holds the API group of the referenced subject.
333 // Defaults to "" for ServiceAccount subjects.
334 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
335 apiGroup?: string
336
337 // Kind of object being referenced. Values defined by this API group are "User",
338 // "Group", and "ServiceAccount".
339 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
340 kind!: string
341
342 // Name of the object being referenced.
343 name!: string
344
345 // Namespace of the referenced object. If the object kind is non-namespace, such
346 // as "User" or "Group", and this value is not empty
347 // the Authorizer should report an error.
348 namespace?: string
349 }]
350 }]
351 }
352
353 // PodSecurity specifies the Pod Security Standard controls to be excluded.
354 // Applicable only to policies that have validate.podSecurity subrule.
355 podSecurity?: [...{
356 // ControlName specifies the name of the Pod Security Standard control.
357 // See: https://kubernetes.io/docs/concepts/security/pod-security-standards/
358 controlName!: "HostProcess" |
359 "Host Namespaces" |
360 "Privileged Containers" |
361 "Capabilities" |
362 "HostPath Volumes" |
363 "Host Ports" |
364 "AppArmor" |
365 "SELinux" |
366 "/proc Mount Type" |
367 "Seccomp" |
368 "Sysctls" |
369 "Volume Types" |
370 "Privilege Escalation" |
371 "Running as Non-root" |
372 "Running as Non-root user"
373
374 // Images selects matching containers and applies the container level PSS.
375 // Each image is the image name consisting of the registry address, repository, image, and tag.
376 // Empty list matches no containers, PSS checks are applied at the pod level only.
377 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
378 images?: [...string]
379
380 // RestrictedField selects the field for the given Pod Security Standard control.
381 // When not set, all restricted fields for the control are selected.
382 restrictedField?: string
383
384 // Values defines the allowed values that can be excluded.
385 values?: [...string]
386 }]
387 }
388
389 _embeddedResource: {
390 apiVersion!: string
391 kind!: string
392 metadata?: {...}
393 }
394 apiVersion: "kyverno.io/v2beta1"
395 kind: "PolicyException"
396 metadata!: {
397 name!: string
398 namespace!: string
399 labels?: [string]: string
400 annotations?: [string]: string
401 ...
402 }
403}