1package v2beta1
2
3import (
4 "time"
5 "strings"
6)
7
8// ClusterCleanupPolicy defines rule for resource cleanup.
9#ClusterCleanupPolicy: {
10 _embeddedResource
11
12 // APIVersion defines the versioned schema of this representation of an object.
13 // Servers should convert recognized schemas to the latest internal value, and
14 // may reject unrecognized values.
15 // More info:
16 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
17 apiVersion?: string
18
19 // Kind is a string value representing the REST resource this object represents.
20 // Servers may infer this from the endpoint the client submits requests to.
21 // Cannot be updated.
22 // In CamelCase.
23 // More info:
24 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
25 kind?: string
26 metadata?: {}
27
28 // Spec declares policy behaviors.
29 spec!: {
30 // Conditions defines the conditions used to select the resources which will be cleaned up.
31 conditions?: {
32 // AllConditions enable variable-based conditional rule execution. This is useful for
33 // finer control of when an rule is applied. A condition can reference object data
34 // using JMESPath notation.
35 // Here, all of the conditions need to pass.
36 all?: [...{
37 // Key is the context entry (using JMESPath) for conditional rule evaluation.
38 key?: null | bool | number | string | [...] | {...}
39
40 // Message is an optional display message
41 message?: string
42
43 // Operator is the conditional operation to perform. Valid operators are:
44 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
45 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
46 // DurationLessThanOrEquals, DurationLessThan
47 operator?: "Equals" |
48 "NotEquals" |
49 "AnyIn" |
50 "AllIn" |
51 "AnyNotIn" |
52 "AllNotIn" |
53 "GreaterThanOrEquals" |
54 "GreaterThan" |
55 "LessThanOrEquals" |
56 "LessThan" |
57 "DurationGreaterThanOrEquals" |
58 "DurationGreaterThan" |
59 "DurationLessThanOrEquals" |
60 "DurationLessThan"
61
62 // Value is the conditional value, or set of values. The values can be fixed set
63 // or can be variables declared using JMESPath.
64 value?: null | bool | number | string | [...] | {...}
65 }]
66
67 // AnyConditions enable variable-based conditional rule execution. This is useful for
68 // finer control of when an rule is applied. A condition can reference object data
69 // using JMESPath notation.
70 // Here, at least one of the conditions need to pass.
71 any?: [...{
72 // Key is the context entry (using JMESPath) for conditional rule evaluation.
73 key?: null | bool | number | string | [...] | {...}
74
75 // Message is an optional display message
76 message?: string
77
78 // Operator is the conditional operation to perform. Valid operators are:
79 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
80 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
81 // DurationLessThanOrEquals, DurationLessThan
82 operator?: "Equals" |
83 "NotEquals" |
84 "AnyIn" |
85 "AllIn" |
86 "AnyNotIn" |
87 "AllNotIn" |
88 "GreaterThanOrEquals" |
89 "GreaterThan" |
90 "LessThanOrEquals" |
91 "LessThan" |
92 "DurationGreaterThanOrEquals" |
93 "DurationGreaterThan" |
94 "DurationLessThanOrEquals" |
95 "DurationLessThan"
96
97 // Value is the conditional value, or set of values. The values can be fixed set
98 // or can be variables declared using JMESPath.
99 value?: null | bool | number | string | [...] | {...}
100 }]
101 }
102
103 // Context defines variables and data sources that can be used during rule execution.
104 context?: [...matchN(1, [
105 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
106 ]) & {
107 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
108 // The data returned is stored in the context with the name for the context entry.
109 apiCall?: {
110 // The data object specifies the POST data sent to the server.
111 // Only applicable when the method field is set to POST.
112 data?: [...{
113 // Key is a unique identifier for the data value
114 key!: string
115
116 // Value is the data value
117 value!: null | bool | number | string | [...] | {...}
118 }]
119
120 // Default is an optional arbitrary JSON object that the context
121 // value is set to, if the apiCall returns error.
122 default?: null | bool | number | string | [...] | {...}
123
124 // JMESPath is an optional JSON Match Expression that can be used to
125 // transform the JSON response returned from the server. For example
126 // a JMESPath of "items | length(@)" applied to the API server response
127 // for the URLPath "/apis/apps/v1/deployments" will return the total count
128 // of deployments across all namespaces.
129 jmesPath?: string
130
131 // Method is the HTTP request type (GET or POST). Defaults to GET.
132 method?: "GET" | "POST"
133
134 // Service is an API call to a JSON web service.
135 // This is used for non-Kubernetes API server calls.
136 // It's mutually exclusive with the URLPath field.
137 service?: {
138 // CABundle is a PEM encoded CA bundle which will be used to validate
139 // the server certificate.
140 caBundle?: string
141
142 // Headers is a list of optional HTTP headers to be included in the request.
143 headers?: [...{
144 // Key is the header key
145 key!: string
146
147 // Value is the header value
148 value!: string
149 }]
150
151 // URL is the JSON web service URL. A typical form is
152 // `https://{service}.{namespace}:{port}/{path}`.
153 url!: string
154 }
155
156 // URLPath is the URL path to be used in the HTTP GET or POST request to the
157 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
158 // The format required is the same format used by the `kubectl get --raw` command.
159 // See
160 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
161 // for details.
162 // It's mutually exclusive with the Service field.
163 urlPath?: string
164 }
165
166 // ConfigMap is the ConfigMap reference.
167 configMap?: {
168 // Name is the ConfigMap name.
169 name!: string
170
171 // Namespace is the ConfigMap namespace.
172 namespace?: string
173 }
174
175 // GlobalContextEntryReference is a reference to a cached global context entry.
176 globalReference?: {
177 // JMESPath is an optional JSON Match Expression that can be used to
178 // transform the JSON response returned from the server. For example
179 // a JMESPath of "items | length(@)" applied to the API server response
180 // for the URLPath "/apis/apps/v1/deployments" will return the total count
181 // of deployments across all namespaces.
182 jmesPath?: string
183
184 // Name of the global context entry
185 name!: string
186 }
187
188 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
189 // details.
190 imageRegistry?: {
191 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
192 imageRegistryCredentials?: {
193 // AllowInsecureRegistry allows insecure access to a registry.
194 allowInsecureRegistry?: bool
195
196 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
197 // It can be of one of these values: default,google,azure,amazon,github.
198 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
199
200 // Secrets specifies a list of secrets that are provided for credentials.
201 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
202 // imagePullSecrets from the resource namespace are also used.
203 secrets?: [...string]
204 }
205
206 // JMESPath is an optional JSON Match Expression that can be used to
207 // transform the ImageData struct returned as a result of processing
208 // the image reference.
209 jmesPath?: string
210
211 // Reference is image reference to a container image in the registry.
212 // Example: ghcr.io/kyverno/kyverno:latest
213 reference!: string
214 }
215
216 // Name is the variable name.
217 name!: string
218
219 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
220 variable?: {
221 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
222 // expression evaluates to nil
223 default?: null | bool | number | string | [...] | {...}
224
225 // JMESPath is an optional JMESPath Expression that can be used to
226 // transform the variable.
227 jmesPath?: string
228
229 // Value is any arbitrary JSON object representable in YAML or JSON form.
230 value?: null | bool | number | string | [...] | {...}
231 }
232 }]
233
234 // DeletionPropagationPolicy defines how resources will be deleted (Foreground, Background, Orphan).
235 deletionPropagationPolicy?: "Foreground" | "Background" | "Orphan"
236
237 // ExcludeResources defines when cleanuppolicy should not be applied. The exclude
238 // criteria can include resource information (e.g. kind, name, namespace, labels)
239 // and admission review request information like the name or role.
240 exclude?: matchN(0, [null | bool | number | string | [...] | {
241 any!: _
242 all!: _
243 }]) & {
244 // All allows specifying resources which will be ANDed
245 all?: [...{
246 // ClusterRoles is the list of cluster-wide role names for the user.
247 clusterRoles?: [...string]
248
249 // ResourceDescription contains information about the resource being created or modified.
250 resources?: matchN(0, [null | bool | number | string | [...] | {
251 name!: _
252 names!: _
253 }]) & {
254 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
255 // and values support the wildcard characters "*" (matches zero or many characters) and
256 // "?" (matches at least one character).
257 annotations?: [string]: string
258
259 // Kinds is a list of resource kinds.
260 kinds?: [...string]
261
262 // Name is the name of the resource. The name supports wildcard characters
263 // "*" (matches zero or many characters) and "?" (at least one character).
264 // NOTE: "Name" is being deprecated in favor of "Names".
265 name?: string
266
267 // Names are the names of the resources. Each name supports wildcard characters
268 // "*" (matches zero or many characters) and "?" (at least one character).
269 names?: [...string]
270
271 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
272 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
273 // and `?` (matches one character).Wildcards allows writing label selectors like
274 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
275 // does not match an empty label set.
276 namespaceSelector?: {
277 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
278 matchExpressions?: [...{
279 // key is the label key that the selector applies to.
280 key!: string
281
282 // operator represents a key's relationship to a set of values.
283 // Valid operators are In, NotIn, Exists and DoesNotExist.
284 operator!: string
285
286 // values is an array of string values. If the operator is In or NotIn,
287 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
288 // the values array must be empty. This array is replaced during a strategic
289 // merge patch.
290 values?: [...string]
291 }]
292
293 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
294 // map is equivalent to an element of matchExpressions, whose key field is "key", the
295 // operator is "In", and the values array contains only "value". The requirements are ANDed.
296 matchLabels?: [string]: string
297 }
298
299 // Namespaces is a list of namespaces names. Each name supports wildcard characters
300 // "*" (matches zero or many characters) and "?" (at least one character).
301 namespaces?: [...string]
302
303 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
304 // are used to match a specific action.
305 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
306
307 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
308 // characters `*` (matches zero or many characters) and `?` (matches one character).
309 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
310 // using ["*" : "*"] matches any key and value but does not match an empty label set.
311 selector?: {
312 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
313 matchExpressions?: [...{
314 // key is the label key that the selector applies to.
315 key!: string
316
317 // operator represents a key's relationship to a set of values.
318 // Valid operators are In, NotIn, Exists and DoesNotExist.
319 operator!: string
320
321 // values is an array of string values. If the operator is In or NotIn,
322 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
323 // the values array must be empty. This array is replaced during a strategic
324 // merge patch.
325 values?: [...string]
326 }]
327
328 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
329 // map is equivalent to an element of matchExpressions, whose key field is "key", the
330 // operator is "In", and the values array contains only "value". The requirements are ANDed.
331 matchLabels?: [string]: string
332 }
333 }
334
335 // Roles is the list of namespaced role names for the user.
336 roles?: [...string]
337
338 // Subjects is the list of subject names like users, user groups, and service accounts.
339 subjects?: [...{
340 // APIGroup holds the API group of the referenced subject.
341 // Defaults to "" for ServiceAccount subjects.
342 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
343 apiGroup?: string
344
345 // Kind of object being referenced. Values defined by this API group are "User",
346 // "Group", and "ServiceAccount".
347 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
348 kind!: string
349
350 // Name of the object being referenced.
351 name!: string
352
353 // Namespace of the referenced object. If the object kind is non-namespace, such
354 // as "User" or "Group", and this value is not empty
355 // the Authorizer should report an error.
356 namespace?: string
357 }]
358 }]
359
360 // Any allows specifying resources which will be ORed
361 any?: [...{
362 // ClusterRoles is the list of cluster-wide role names for the user.
363 clusterRoles?: [...string]
364
365 // ResourceDescription contains information about the resource being created or modified.
366 resources?: matchN(0, [null | bool | number | string | [...] | {
367 name!: _
368 names!: _
369 }]) & {
370 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
371 // and values support the wildcard characters "*" (matches zero or many characters) and
372 // "?" (matches at least one character).
373 annotations?: [string]: string
374
375 // Kinds is a list of resource kinds.
376 kinds?: [...string]
377
378 // Name is the name of the resource. The name supports wildcard characters
379 // "*" (matches zero or many characters) and "?" (at least one character).
380 // NOTE: "Name" is being deprecated in favor of "Names".
381 name?: string
382
383 // Names are the names of the resources. Each name supports wildcard characters
384 // "*" (matches zero or many characters) and "?" (at least one character).
385 names?: [...string]
386
387 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
388 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
389 // and `?` (matches one character).Wildcards allows writing label selectors like
390 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
391 // does not match an empty label set.
392 namespaceSelector?: {
393 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
394 matchExpressions?: [...{
395 // key is the label key that the selector applies to.
396 key!: string
397
398 // operator represents a key's relationship to a set of values.
399 // Valid operators are In, NotIn, Exists and DoesNotExist.
400 operator!: string
401
402 // values is an array of string values. If the operator is In or NotIn,
403 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
404 // the values array must be empty. This array is replaced during a strategic
405 // merge patch.
406 values?: [...string]
407 }]
408
409 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
410 // map is equivalent to an element of matchExpressions, whose key field is "key", the
411 // operator is "In", and the values array contains only "value". The requirements are ANDed.
412 matchLabels?: [string]: string
413 }
414
415 // Namespaces is a list of namespaces names. Each name supports wildcard characters
416 // "*" (matches zero or many characters) and "?" (at least one character).
417 namespaces?: [...string]
418
419 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
420 // are used to match a specific action.
421 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
422
423 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
424 // characters `*` (matches zero or many characters) and `?` (matches one character).
425 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
426 // using ["*" : "*"] matches any key and value but does not match an empty label set.
427 selector?: {
428 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
429 matchExpressions?: [...{
430 // key is the label key that the selector applies to.
431 key!: string
432
433 // operator represents a key's relationship to a set of values.
434 // Valid operators are In, NotIn, Exists and DoesNotExist.
435 operator!: string
436
437 // values is an array of string values. If the operator is In or NotIn,
438 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
439 // the values array must be empty. This array is replaced during a strategic
440 // merge patch.
441 values?: [...string]
442 }]
443
444 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
445 // map is equivalent to an element of matchExpressions, whose key field is "key", the
446 // operator is "In", and the values array contains only "value". The requirements are ANDed.
447 matchLabels?: [string]: string
448 }
449 }
450
451 // Roles is the list of namespaced role names for the user.
452 roles?: [...string]
453
454 // Subjects is the list of subject names like users, user groups, and service accounts.
455 subjects?: [...{
456 // APIGroup holds the API group of the referenced subject.
457 // Defaults to "" for ServiceAccount subjects.
458 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
459 apiGroup?: string
460
461 // Kind of object being referenced. Values defined by this API group are "User",
462 // "Group", and "ServiceAccount".
463 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
464 kind!: string
465
466 // Name of the object being referenced.
467 name!: string
468
469 // Namespace of the referenced object. If the object kind is non-namespace, such
470 // as "User" or "Group", and this value is not empty
471 // the Authorizer should report an error.
472 namespace?: string
473 }]
474 }]
475 }
476
477 // MatchResources defines when cleanuppolicy should be applied. The match
478 // criteria can include resource information (e.g. kind, name, namespace, labels)
479 // and admission review request information like the user name or role.
480 // At least one kind is required.
481 match!: matchN(0, [null | bool | number | string | [...] | {
482 any!: _
483 all!: _
484 }]) & {
485 // All allows specifying resources which will be ANDed
486 all?: [...{
487 // ClusterRoles is the list of cluster-wide role names for the user.
488 clusterRoles?: [...string]
489
490 // ResourceDescription contains information about the resource being created or modified.
491 resources?: matchN(0, [null | bool | number | string | [...] | {
492 name!: _
493 names!: _
494 }]) & {
495 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
496 // and values support the wildcard characters "*" (matches zero or many characters) and
497 // "?" (matches at least one character).
498 annotations?: [string]: string
499
500 // Kinds is a list of resource kinds.
501 kinds?: [...string]
502
503 // Name is the name of the resource. The name supports wildcard characters
504 // "*" (matches zero or many characters) and "?" (at least one character).
505 // NOTE: "Name" is being deprecated in favor of "Names".
506 name?: string
507
508 // Names are the names of the resources. Each name supports wildcard characters
509 // "*" (matches zero or many characters) and "?" (at least one character).
510 names?: [...string]
511
512 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
513 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
514 // and `?` (matches one character).Wildcards allows writing label selectors like
515 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
516 // does not match an empty label set.
517 namespaceSelector?: {
518 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
519 matchExpressions?: [...{
520 // key is the label key that the selector applies to.
521 key!: string
522
523 // operator represents a key's relationship to a set of values.
524 // Valid operators are In, NotIn, Exists and DoesNotExist.
525 operator!: string
526
527 // values is an array of string values. If the operator is In or NotIn,
528 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
529 // the values array must be empty. This array is replaced during a strategic
530 // merge patch.
531 values?: [...string]
532 }]
533
534 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
535 // map is equivalent to an element of matchExpressions, whose key field is "key", the
536 // operator is "In", and the values array contains only "value". The requirements are ANDed.
537 matchLabels?: [string]: string
538 }
539
540 // Namespaces is a list of namespaces names. Each name supports wildcard characters
541 // "*" (matches zero or many characters) and "?" (at least one character).
542 namespaces?: [...string]
543
544 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
545 // are used to match a specific action.
546 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
547
548 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
549 // characters `*` (matches zero or many characters) and `?` (matches one character).
550 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
551 // using ["*" : "*"] matches any key and value but does not match an empty label set.
552 selector?: {
553 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
554 matchExpressions?: [...{
555 // key is the label key that the selector applies to.
556 key!: string
557
558 // operator represents a key's relationship to a set of values.
559 // Valid operators are In, NotIn, Exists and DoesNotExist.
560 operator!: string
561
562 // values is an array of string values. If the operator is In or NotIn,
563 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
564 // the values array must be empty. This array is replaced during a strategic
565 // merge patch.
566 values?: [...string]
567 }]
568
569 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
570 // map is equivalent to an element of matchExpressions, whose key field is "key", the
571 // operator is "In", and the values array contains only "value". The requirements are ANDed.
572 matchLabels?: [string]: string
573 }
574 }
575
576 // Roles is the list of namespaced role names for the user.
577 roles?: [...string]
578
579 // Subjects is the list of subject names like users, user groups, and service accounts.
580 subjects?: [...{
581 // APIGroup holds the API group of the referenced subject.
582 // Defaults to "" for ServiceAccount subjects.
583 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
584 apiGroup?: string
585
586 // Kind of object being referenced. Values defined by this API group are "User",
587 // "Group", and "ServiceAccount".
588 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
589 kind!: string
590
591 // Name of the object being referenced.
592 name!: string
593
594 // Namespace of the referenced object. If the object kind is non-namespace, such
595 // as "User" or "Group", and this value is not empty
596 // the Authorizer should report an error.
597 namespace?: string
598 }]
599 }]
600
601 // Any allows specifying resources which will be ORed
602 any?: [...{
603 // ClusterRoles is the list of cluster-wide role names for the user.
604 clusterRoles?: [...string]
605
606 // ResourceDescription contains information about the resource being created or modified.
607 resources?: matchN(0, [null | bool | number | string | [...] | {
608 name!: _
609 names!: _
610 }]) & {
611 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
612 // and values support the wildcard characters "*" (matches zero or many characters) and
613 // "?" (matches at least one character).
614 annotations?: [string]: string
615
616 // Kinds is a list of resource kinds.
617 kinds?: [...string]
618
619 // Name is the name of the resource. The name supports wildcard characters
620 // "*" (matches zero or many characters) and "?" (at least one character).
621 // NOTE: "Name" is being deprecated in favor of "Names".
622 name?: string
623
624 // Names are the names of the resources. Each name supports wildcard characters
625 // "*" (matches zero or many characters) and "?" (at least one character).
626 names?: [...string]
627
628 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
629 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
630 // and `?` (matches one character).Wildcards allows writing label selectors like
631 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
632 // does not match an empty label set.
633 namespaceSelector?: {
634 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
635 matchExpressions?: [...{
636 // key is the label key that the selector applies to.
637 key!: string
638
639 // operator represents a key's relationship to a set of values.
640 // Valid operators are In, NotIn, Exists and DoesNotExist.
641 operator!: string
642
643 // values is an array of string values. If the operator is In or NotIn,
644 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
645 // the values array must be empty. This array is replaced during a strategic
646 // merge patch.
647 values?: [...string]
648 }]
649
650 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
651 // map is equivalent to an element of matchExpressions, whose key field is "key", the
652 // operator is "In", and the values array contains only "value". The requirements are ANDed.
653 matchLabels?: [string]: string
654 }
655
656 // Namespaces is a list of namespaces names. Each name supports wildcard characters
657 // "*" (matches zero or many characters) and "?" (at least one character).
658 namespaces?: [...string]
659
660 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
661 // are used to match a specific action.
662 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
663
664 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
665 // characters `*` (matches zero or many characters) and `?` (matches one character).
666 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
667 // using ["*" : "*"] matches any key and value but does not match an empty label set.
668 selector?: {
669 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
670 matchExpressions?: [...{
671 // key is the label key that the selector applies to.
672 key!: string
673
674 // operator represents a key's relationship to a set of values.
675 // Valid operators are In, NotIn, Exists and DoesNotExist.
676 operator!: string
677
678 // values is an array of string values. If the operator is In or NotIn,
679 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
680 // the values array must be empty. This array is replaced during a strategic
681 // merge patch.
682 values?: [...string]
683 }]
684
685 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
686 // map is equivalent to an element of matchExpressions, whose key field is "key", the
687 // operator is "In", and the values array contains only "value". The requirements are ANDed.
688 matchLabels?: [string]: string
689 }
690 }
691
692 // Roles is the list of namespaced role names for the user.
693 roles?: [...string]
694
695 // Subjects is the list of subject names like users, user groups, and service accounts.
696 subjects?: [...{
697 // APIGroup holds the API group of the referenced subject.
698 // Defaults to "" for ServiceAccount subjects.
699 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
700 apiGroup?: string
701
702 // Kind of object being referenced. Values defined by this API group are "User",
703 // "Group", and "ServiceAccount".
704 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
705 kind!: string
706
707 // Name of the object being referenced.
708 name!: string
709
710 // Namespace of the referenced object. If the object kind is non-namespace, such
711 // as "User" or "Group", and this value is not empty
712 // the Authorizer should report an error.
713 namespace?: string
714 }]
715 }]
716 }
717
718 // The schedule in Cron format
719 schedule!: string
720 }
721
722 // Status contains policy runtime data.
723 status?: {
724 conditions?: [...{
725 // lastTransitionTime is the last time the condition transitioned from one status to another.
726 // This should be when the underlying condition changed. If that is not known,
727 // then using the time when the API field changed is acceptable.
728 lastTransitionTime!: time.Time
729
730 // message is a human readable message indicating details about the transition.
731 // This may be an empty string.
732 message!: strings.MaxRunes(
733 32768,
734 )
735
736 // observedGeneration represents the .metadata.generation that the condition was set based upon.
737 // For instance, if .metadata.generation is currently 12, but the
738 // .status.conditions[x].observedGeneration is 9, the condition is out of date
739 // with respect to the current state of the instance.
740 observedGeneration?: int64 & int & >=0
741
742 // reason contains a programmatic identifier indicating the reason for the
743 // condition's last transition.
744 // Producers of specific condition types may define expected values and meanings for this field,
745 // and whether the values are considered a guaranteed API.
746 // The value should be a CamelCase string.
747 // This field may not be empty.
748 reason!: strings.MaxRunes(
749 1024,
750 ) &
751 strings.MinRunes(
752 1,
753 ) &
754 =~"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$"
755
756 // status of the condition, one of True, False, Unknown.
757 status!: "True" | "False" | "Unknown"
758
759 // type of condition in CamelCase or in foo.example.com/CamelCase.
760 type!: strings.MaxRunes(
761 316,
762 ) &
763 =~"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$"
764 }]
765 lastExecutionTime?: time.Time
766 }
767
768 _embeddedResource: {
769 apiVersion!: string
770 kind!: string
771 metadata?: {...}
772 }
773 apiVersion: "kyverno.io/v2beta1"
774 kind: "ClusterCleanupPolicy"
775 metadata!: {
776 name!: string
777 namespace?: string
778 labels?: [string]: string
779 annotations?: [string]: string
780 ...
781 }
782}