1package v2beta1
2
3import (
4 "strings"
5 "time"
6)
7
8// ClusterPolicy declares validation, mutation, and generation behaviors for matching resources.
9#ClusterPolicy: {
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 // Admission controls if rules are applied during admission.
31 // Optional. Default value is "true".
32 admission?: bool
33
34 // ApplyRules controls how rules in a policy are applied. Rule are processed in
35 // the order of declaration. When set to `One` processing stops after a rule has
36 // been applied i.e. the rule matches and results in a pass, fail, or error. When
37 // set to `All` all rules in the policy are processed. The default is `All`.
38 applyRules?: "All" | "One"
39
40 // Background controls if rules are applied to existing resources during a background scan.
41 // Optional. Default value is "true". The value must be set to "false" if the policy rule
42 // uses variables that are only available in the admission review request (e.g. user name).
43 background?: bool
44
45 // EmitWarning enables API response warnings for mutate policy rules or validate
46 // policy rules with validationFailureAction set to Audit.
47 // Enabling this option will extend admission request processing times. The
48 // default value is "false".
49 emitWarning?: bool
50
51 // Deprecated, use failurePolicy under the webhookConfiguration instead.
52 failurePolicy?: "Ignore" | "Fail"
53
54 // Deprecated, use generateExisting under the generate rule instead
55 generateExisting?: bool
56
57 // Deprecated, use generateExisting instead
58 generateExistingOnPolicyUpdate?: bool
59
60 // Deprecated, use mutateExistingOnPolicyUpdate under the mutate rule instead
61 mutateExistingOnPolicyUpdate?: bool
62
63 // Rules is a list of Rule instances. A Policy contains multiple rules and
64 // each rule can validate, mutate, or generate resources.
65 rules?: [...{
66 // CELPreconditions are used to determine if a policy rule should be applied by evaluating a
67 // set of CEL conditions. It can only be used with the validate.cel subrule
68 celPreconditions?: [...{
69 // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool.
70 // CEL expressions have access to the contents of the AdmissionRequest and
71 // Authorizer, organized into CEL variables:
72 //
73 // 'object' - The object from the incoming request. The value is null for DELETE requests.
74 // 'oldObject' - The existing object. The value is null for CREATE requests.
75 // 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest).
76 // 'authorizer' - A CEL Authorizer. May be used to perform authorization checks
77 // for the principal (user or service account) of the request.
78 // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
79 // 'authorizer.requestResource' - A CEL ResourceCheck constructed from the
80 // 'authorizer' and configured with the
81 // request resource.
82 // Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
83 //
84 // Required.
85 expression!: string
86
87 // Name is an identifier for this match condition, used for strategic merging of MatchConditions,
88 // as well as providing an identifier for logging purposes. A good name should be descriptive of
89 // the associated expression.
90 // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and
91 // must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or
92 // '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an
93 // optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')
94 //
95 // Required.
96 name!: string
97 }]
98
99 // Context defines variables and data sources that can be used during rule execution.
100 context?: [...matchN(1, [
101 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
102 ]) & {
103 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
104 // The data returned is stored in the context with the name for the context entry.
105 apiCall?: {
106 // The data object specifies the POST data sent to the server.
107 // Only applicable when the method field is set to POST.
108 data?: [...{
109 // Key is a unique identifier for the data value
110 key!: string
111
112 // Value is the data value
113 value!: null | bool | number | string | [...] | {...}
114 }]
115
116 // Default is an optional arbitrary JSON object that the context
117 // value is set to, if the apiCall returns error.
118 default?: null | bool | number | string | [...] | {...}
119
120 // JMESPath is an optional JSON Match Expression that can be used to
121 // transform the JSON response returned from the server. For example
122 // a JMESPath of "items | length(@)" applied to the API server response
123 // for the URLPath "/apis/apps/v1/deployments" will return the total count
124 // of deployments across all namespaces.
125 jmesPath?: string
126
127 // Method is the HTTP request type (GET or POST). Defaults to GET.
128 method?: "GET" | "POST"
129
130 // Service is an API call to a JSON web service.
131 // This is used for non-Kubernetes API server calls.
132 // It's mutually exclusive with the URLPath field.
133 service?: {
134 // CABundle is a PEM encoded CA bundle which will be used to validate
135 // the server certificate.
136 caBundle?: string
137
138 // Headers is a list of optional HTTP headers to be included in the request.
139 headers?: [...{
140 // Key is the header key
141 key!: string
142
143 // Value is the header value
144 value!: string
145 }]
146
147 // URL is the JSON web service URL. A typical form is
148 // `https://{service}.{namespace}:{port}/{path}`.
149 url!: string
150 }
151
152 // URLPath is the URL path to be used in the HTTP GET or POST request to the
153 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
154 // The format required is the same format used by the `kubectl get --raw` command.
155 // See
156 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
157 // for details.
158 // It's mutually exclusive with the Service field.
159 urlPath?: string
160 }
161
162 // ConfigMap is the ConfigMap reference.
163 configMap?: {
164 // Name is the ConfigMap name.
165 name!: string
166
167 // Namespace is the ConfigMap namespace.
168 namespace?: string
169 }
170
171 // GlobalContextEntryReference is a reference to a cached global context entry.
172 globalReference?: {
173 // JMESPath is an optional JSON Match Expression that can be used to
174 // transform the JSON response returned from the server. For example
175 // a JMESPath of "items | length(@)" applied to the API server response
176 // for the URLPath "/apis/apps/v1/deployments" will return the total count
177 // of deployments across all namespaces.
178 jmesPath?: string
179
180 // Name of the global context entry
181 name!: string
182 }
183
184 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
185 // details.
186 imageRegistry?: {
187 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
188 imageRegistryCredentials?: {
189 // AllowInsecureRegistry allows insecure access to a registry.
190 allowInsecureRegistry?: bool
191
192 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
193 // It can be of one of these values: default,google,azure,amazon,github.
194 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
195
196 // Secrets specifies a list of secrets that are provided for credentials.
197 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
198 // imagePullSecrets from the resource namespace are also used.
199 secrets?: [...string]
200 }
201
202 // JMESPath is an optional JSON Match Expression that can be used to
203 // transform the ImageData struct returned as a result of processing
204 // the image reference.
205 jmesPath?: string
206
207 // Reference is image reference to a container image in the registry.
208 // Example: ghcr.io/kyverno/kyverno:latest
209 reference!: string
210 }
211
212 // Name is the variable name.
213 name!: string
214
215 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
216 variable?: {
217 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
218 // expression evaluates to nil
219 default?: null | bool | number | string | [...] | {...}
220
221 // JMESPath is an optional JMESPath Expression that can be used to
222 // transform the variable.
223 jmesPath?: string
224
225 // Value is any arbitrary JSON object representable in YAML or JSON form.
226 value?: null | bool | number | string | [...] | {...}
227 }
228 }]
229
230 // ExcludeResources defines when this policy rule should not be applied. The exclude
231 // criteria can include resource information (e.g. kind, name, namespace, labels)
232 // and admission review request information like the name or role.
233 exclude?: matchN(0, [null | bool | number | string | [...] | {
234 any!: _
235 all!: _
236 }]) & {
237 // All allows specifying resources which will be ANDed
238 all?: [...{
239 // ClusterRoles is the list of cluster-wide role names for the user.
240 clusterRoles?: [...string]
241
242 // ResourceDescription contains information about the resource being created or modified.
243 resources?: matchN(0, [null | bool | number | string | [...] | {
244 name!: _
245 names!: _
246 }]) & {
247 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
248 // and values support the wildcard characters "*" (matches zero or many characters) and
249 // "?" (matches at least one character).
250 annotations?: [string]: string
251
252 // Kinds is a list of resource kinds.
253 kinds?: [...string]
254
255 // Name is the name of the resource. The name supports wildcard characters
256 // "*" (matches zero or many characters) and "?" (at least one character).
257 // NOTE: "Name" is being deprecated in favor of "Names".
258 name?: string
259
260 // Names are the names of the resources. Each name supports wildcard characters
261 // "*" (matches zero or many characters) and "?" (at least one character).
262 names?: [...string]
263
264 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
265 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
266 // and `?` (matches one character).Wildcards allows writing label selectors like
267 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
268 // does not match an empty label set.
269 namespaceSelector?: {
270 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
271 matchExpressions?: [...{
272 // key is the label key that the selector applies to.
273 key!: string
274
275 // operator represents a key's relationship to a set of values.
276 // Valid operators are In, NotIn, Exists and DoesNotExist.
277 operator!: string
278
279 // values is an array of string values. If the operator is In or NotIn,
280 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
281 // the values array must be empty. This array is replaced during a strategic
282 // merge patch.
283 values?: [...string]
284 }]
285
286 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
287 // map is equivalent to an element of matchExpressions, whose key field is "key", the
288 // operator is "In", and the values array contains only "value". The requirements are ANDed.
289 matchLabels?: [string]: string
290 }
291
292 // Namespaces is a list of namespaces names. Each name supports wildcard characters
293 // "*" (matches zero or many characters) and "?" (at least one character).
294 namespaces?: [...string]
295
296 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
297 // are used to match a specific action.
298 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
299
300 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
301 // characters `*` (matches zero or many characters) and `?` (matches one character).
302 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
303 // using ["*" : "*"] matches any key and value but does not match an empty label set.
304 selector?: {
305 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
306 matchExpressions?: [...{
307 // key is the label key that the selector applies to.
308 key!: string
309
310 // operator represents a key's relationship to a set of values.
311 // Valid operators are In, NotIn, Exists and DoesNotExist.
312 operator!: string
313
314 // values is an array of string values. If the operator is In or NotIn,
315 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
316 // the values array must be empty. This array is replaced during a strategic
317 // merge patch.
318 values?: [...string]
319 }]
320
321 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
322 // map is equivalent to an element of matchExpressions, whose key field is "key", the
323 // operator is "In", and the values array contains only "value". The requirements are ANDed.
324 matchLabels?: [string]: string
325 }
326 }
327
328 // Roles is the list of namespaced role names for the user.
329 roles?: [...string]
330
331 // Subjects is the list of subject names like users, user groups, and service accounts.
332 subjects?: [...{
333 // APIGroup holds the API group of the referenced subject.
334 // Defaults to "" for ServiceAccount subjects.
335 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
336 apiGroup?: string
337
338 // Kind of object being referenced. Values defined by this API group are "User",
339 // "Group", and "ServiceAccount".
340 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
341 kind!: string
342
343 // Name of the object being referenced.
344 name!: string
345
346 // Namespace of the referenced object. If the object kind is non-namespace, such
347 // as "User" or "Group", and this value is not empty
348 // the Authorizer should report an error.
349 namespace?: string
350 }]
351 }]
352
353 // Any allows specifying resources which will be ORed
354 any?: [...{
355 // ClusterRoles is the list of cluster-wide role names for the user.
356 clusterRoles?: [...string]
357
358 // ResourceDescription contains information about the resource being created or modified.
359 resources?: matchN(0, [null | bool | number | string | [...] | {
360 name!: _
361 names!: _
362 }]) & {
363 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
364 // and values support the wildcard characters "*" (matches zero or many characters) and
365 // "?" (matches at least one character).
366 annotations?: [string]: string
367
368 // Kinds is a list of resource kinds.
369 kinds?: [...string]
370
371 // Name is the name of the resource. The name supports wildcard characters
372 // "*" (matches zero or many characters) and "?" (at least one character).
373 // NOTE: "Name" is being deprecated in favor of "Names".
374 name?: string
375
376 // Names are the names of the resources. Each name supports wildcard characters
377 // "*" (matches zero or many characters) and "?" (at least one character).
378 names?: [...string]
379
380 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
381 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
382 // and `?` (matches one character).Wildcards allows writing label selectors like
383 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
384 // does not match an empty label set.
385 namespaceSelector?: {
386 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
387 matchExpressions?: [...{
388 // key is the label key that the selector applies to.
389 key!: string
390
391 // operator represents a key's relationship to a set of values.
392 // Valid operators are In, NotIn, Exists and DoesNotExist.
393 operator!: string
394
395 // values is an array of string values. If the operator is In or NotIn,
396 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
397 // the values array must be empty. This array is replaced during a strategic
398 // merge patch.
399 values?: [...string]
400 }]
401
402 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
403 // map is equivalent to an element of matchExpressions, whose key field is "key", the
404 // operator is "In", and the values array contains only "value". The requirements are ANDed.
405 matchLabels?: [string]: string
406 }
407
408 // Namespaces is a list of namespaces names. Each name supports wildcard characters
409 // "*" (matches zero or many characters) and "?" (at least one character).
410 namespaces?: [...string]
411
412 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
413 // are used to match a specific action.
414 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
415
416 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
417 // characters `*` (matches zero or many characters) and `?` (matches one character).
418 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
419 // using ["*" : "*"] matches any key and value but does not match an empty label set.
420 selector?: {
421 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
422 matchExpressions?: [...{
423 // key is the label key that the selector applies to.
424 key!: string
425
426 // operator represents a key's relationship to a set of values.
427 // Valid operators are In, NotIn, Exists and DoesNotExist.
428 operator!: string
429
430 // values is an array of string values. If the operator is In or NotIn,
431 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
432 // the values array must be empty. This array is replaced during a strategic
433 // merge patch.
434 values?: [...string]
435 }]
436
437 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
438 // map is equivalent to an element of matchExpressions, whose key field is "key", the
439 // operator is "In", and the values array contains only "value". The requirements are ANDed.
440 matchLabels?: [string]: string
441 }
442 }
443
444 // Roles is the list of namespaced role names for the user.
445 roles?: [...string]
446
447 // Subjects is the list of subject names like users, user groups, and service accounts.
448 subjects?: [...{
449 // APIGroup holds the API group of the referenced subject.
450 // Defaults to "" for ServiceAccount subjects.
451 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
452 apiGroup?: string
453
454 // Kind of object being referenced. Values defined by this API group are "User",
455 // "Group", and "ServiceAccount".
456 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
457 kind!: string
458
459 // Name of the object being referenced.
460 name!: string
461
462 // Namespace of the referenced object. If the object kind is non-namespace, such
463 // as "User" or "Group", and this value is not empty
464 // the Authorizer should report an error.
465 namespace?: string
466 }]
467 }]
468 }
469
470 // Generation is used to create new resources.
471 generate?: {
472 // APIVersion specifies resource apiVersion.
473 apiVersion?: string
474
475 // Clone specifies the source resource used to populate each generated resource.
476 // At most one of Data or Clone can be specified. If neither are provided, the generated
477 // resource will be created with default data only.
478 clone?: {
479 // Name specifies name of the resource.
480 name?: string
481
482 // Namespace specifies source resource namespace.
483 namespace?: string
484 }
485
486 // CloneList specifies the list of source resource used to populate each generated resource.
487 cloneList?: {
488 // Kinds is a list of resource kinds.
489 kinds?: [...string]
490
491 // Namespace specifies source resource namespace.
492 namespace?: string
493
494 // Selector is a label selector. Label keys and values in `matchLabels`.
495 // wildcard characters are not supported.
496 selector?: {
497 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
498 matchExpressions?: [...{
499 // key is the label key that the selector applies to.
500 key!: string
501
502 // operator represents a key's relationship to a set of values.
503 // Valid operators are In, NotIn, Exists and DoesNotExist.
504 operator!: string
505
506 // values is an array of string values. If the operator is In or NotIn,
507 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
508 // the values array must be empty. This array is replaced during a strategic
509 // merge patch.
510 values?: [...string]
511 }]
512
513 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
514 // map is equivalent to an element of matchExpressions, whose key field is "key", the
515 // operator is "In", and the values array contains only "value". The requirements are ANDed.
516 matchLabels?: [string]: string
517 }
518 }
519
520 // Data provides the resource declaration used to populate each generated resource.
521 // At most one of Data or Clone must be specified. If neither are provided, the generated
522 // resource will be created with default data only.
523 data?: null | bool | number | string | [...] | {...}
524
525 // ForEach applies generate rules to a list of sub-elements by creating a
526 // context for each entry in the list and looping over it to apply the
527 // specified logic.
528 foreach?: [...{
529 // APIVersion specifies resource apiVersion.
530 apiVersion?: string
531
532 // Clone specifies the source resource used to populate each generated resource.
533 // At most one of Data or Clone can be specified. If neither are provided, the generated
534 // resource will be created with default data only.
535 clone?: {
536 // Name specifies name of the resource.
537 name?: string
538
539 // Namespace specifies source resource namespace.
540 namespace?: string
541 }
542
543 // CloneList specifies the list of source resource used to populate each generated resource.
544 cloneList?: {
545 // Kinds is a list of resource kinds.
546 kinds?: [...string]
547
548 // Namespace specifies source resource namespace.
549 namespace?: string
550
551 // Selector is a label selector. Label keys and values in `matchLabels`.
552 // wildcard characters are not supported.
553 selector?: {
554 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
555 matchExpressions?: [...{
556 // key is the label key that the selector applies to.
557 key!: string
558
559 // operator represents a key's relationship to a set of values.
560 // Valid operators are In, NotIn, Exists and DoesNotExist.
561 operator!: string
562
563 // values is an array of string values. If the operator is In or NotIn,
564 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
565 // the values array must be empty. This array is replaced during a strategic
566 // merge patch.
567 values?: [...string]
568 }]
569
570 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
571 // map is equivalent to an element of matchExpressions, whose key field is "key", the
572 // operator is "In", and the values array contains only "value". The requirements are ANDed.
573 matchLabels?: [string]: string
574 }
575 }
576
577 // Context defines variables and data sources that can be used during rule execution.
578 context?: [...matchN(1, [
579 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
580 ]) & {
581 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
582 // The data returned is stored in the context with the name for the context entry.
583 apiCall?: {
584 // The data object specifies the POST data sent to the server.
585 // Only applicable when the method field is set to POST.
586 data?: [...{
587 // Key is a unique identifier for the data value
588 key!: string
589
590 // Value is the data value
591 value!: null | bool | number | string | [...] | {...}
592 }]
593
594 // Default is an optional arbitrary JSON object that the context
595 // value is set to, if the apiCall returns error.
596 default?: null | bool | number | string | [...] | {...}
597
598 // JMESPath is an optional JSON Match Expression that can be used to
599 // transform the JSON response returned from the server. For example
600 // a JMESPath of "items | length(@)" applied to the API server response
601 // for the URLPath "/apis/apps/v1/deployments" will return the total count
602 // of deployments across all namespaces.
603 jmesPath?: string
604
605 // Method is the HTTP request type (GET or POST). Defaults to GET.
606 method?: "GET" | "POST"
607
608 // Service is an API call to a JSON web service.
609 // This is used for non-Kubernetes API server calls.
610 // It's mutually exclusive with the URLPath field.
611 service?: {
612 // CABundle is a PEM encoded CA bundle which will be used to validate
613 // the server certificate.
614 caBundle?: string
615
616 // Headers is a list of optional HTTP headers to be included in the request.
617 headers?: [...{
618 // Key is the header key
619 key!: string
620
621 // Value is the header value
622 value!: string
623 }]
624
625 // URL is the JSON web service URL. A typical form is
626 // `https://{service}.{namespace}:{port}/{path}`.
627 url!: string
628 }
629
630 // URLPath is the URL path to be used in the HTTP GET or POST request to the
631 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
632 // The format required is the same format used by the `kubectl get --raw` command.
633 // See
634 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
635 // for details.
636 // It's mutually exclusive with the Service field.
637 urlPath?: string
638 }
639
640 // ConfigMap is the ConfigMap reference.
641 configMap?: {
642 // Name is the ConfigMap name.
643 name!: string
644
645 // Namespace is the ConfigMap namespace.
646 namespace?: string
647 }
648
649 // GlobalContextEntryReference is a reference to a cached global context entry.
650 globalReference?: {
651 // JMESPath is an optional JSON Match Expression that can be used to
652 // transform the JSON response returned from the server. For example
653 // a JMESPath of "items | length(@)" applied to the API server response
654 // for the URLPath "/apis/apps/v1/deployments" will return the total count
655 // of deployments across all namespaces.
656 jmesPath?: string
657
658 // Name of the global context entry
659 name!: string
660 }
661
662 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
663 // details.
664 imageRegistry?: {
665 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
666 imageRegistryCredentials?: {
667 // AllowInsecureRegistry allows insecure access to a registry.
668 allowInsecureRegistry?: bool
669
670 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
671 // It can be of one of these values: default,google,azure,amazon,github.
672 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
673
674 // Secrets specifies a list of secrets that are provided for credentials.
675 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
676 // imagePullSecrets from the resource namespace are also used.
677 secrets?: [...string]
678 }
679
680 // JMESPath is an optional JSON Match Expression that can be used to
681 // transform the ImageData struct returned as a result of processing
682 // the image reference.
683 jmesPath?: string
684
685 // Reference is image reference to a container image in the registry.
686 // Example: ghcr.io/kyverno/kyverno:latest
687 reference!: string
688 }
689
690 // Name is the variable name.
691 name!: string
692
693 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
694 variable?: {
695 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
696 // expression evaluates to nil
697 default?: null | bool | number | string | [...] | {...}
698
699 // JMESPath is an optional JMESPath Expression that can be used to
700 // transform the variable.
701 jmesPath?: string
702
703 // Value is any arbitrary JSON object representable in YAML or JSON form.
704 value?: null | bool | number | string | [...] | {...}
705 }
706 }]
707
708 // Data provides the resource declaration used to populate each generated resource.
709 // At most one of Data or Clone must be specified. If neither are provided, the generated
710 // resource will be created with default data only.
711 data?: null | bool | number | string | [...] | {...}
712
713 // Kind specifies resource kind.
714 kind?: string
715
716 // List specifies a JMESPath expression that results in one or more elements
717 // to which the validation logic is applied.
718 list?: string
719
720 // Name specifies the resource name.
721 name?: string
722
723 // Namespace specifies resource namespace.
724 namespace?: string
725
726 // AnyAllConditions are used to determine if a policy rule should be applied by evaluating a
727 // set of conditions. The declaration can contain nested `any` or `all` statements.
728 // See: https://kyverno.io/docs/writing-policies/preconditions/
729 preconditions?: {
730 // AllConditions enable variable-based conditional rule execution. This is useful for
731 // finer control of when an rule is applied. A condition can reference object data
732 // using JMESPath notation.
733 // Here, all of the conditions need to pass
734 all?: [...{
735 // Key is the context entry (using JMESPath) for conditional rule evaluation.
736 key?: null | bool | number | string | [...] | {...}
737
738 // Message is an optional display message
739 message?: string
740
741 // Operator is the conditional operation to perform. Valid operators are:
742 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
743 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
744 // DurationLessThanOrEquals, DurationLessThan
745 operator?: "Equals" |
746 "NotEquals" |
747 "In" |
748 "AnyIn" |
749 "AllIn" |
750 "NotIn" |
751 "AnyNotIn" |
752 "AllNotIn" |
753 "GreaterThanOrEquals" |
754 "GreaterThan" |
755 "LessThanOrEquals" |
756 "LessThan" |
757 "DurationGreaterThanOrEquals" |
758 "DurationGreaterThan" |
759 "DurationLessThanOrEquals" |
760 "DurationLessThan"
761
762 // Value is the conditional value, or set of values. The values can be fixed set
763 // or can be variables declared using JMESPath.
764 value?: null | bool | number | string | [...] | {...}
765 }]
766
767 // AnyConditions enable variable-based conditional rule execution. This is useful for
768 // finer control of when an rule is applied. A condition can reference object data
769 // using JMESPath notation.
770 // Here, at least one of the conditions need to pass
771 any?: [...{
772 // Key is the context entry (using JMESPath) for conditional rule evaluation.
773 key?: null | bool | number | string | [...] | {...}
774
775 // Message is an optional display message
776 message?: string
777
778 // Operator is the conditional operation to perform. Valid operators are:
779 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
780 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
781 // DurationLessThanOrEquals, DurationLessThan
782 operator?: "Equals" |
783 "NotEquals" |
784 "In" |
785 "AnyIn" |
786 "AllIn" |
787 "NotIn" |
788 "AnyNotIn" |
789 "AllNotIn" |
790 "GreaterThanOrEquals" |
791 "GreaterThan" |
792 "LessThanOrEquals" |
793 "LessThan" |
794 "DurationGreaterThanOrEquals" |
795 "DurationGreaterThan" |
796 "DurationLessThanOrEquals" |
797 "DurationLessThan"
798
799 // Value is the conditional value, or set of values. The values can be fixed set
800 // or can be variables declared using JMESPath.
801 value?: null | bool | number | string | [...] | {...}
802 }]
803 ...
804 }
805
806 // UID specifies the resource uid.
807 uid?: string
808 }]
809
810 // GenerateExisting controls whether to trigger the rule in existing resources
811 // If is set to "true" the rule will be triggered and applied to existing matched resources.
812 generateExisting?: bool
813
814 // Kind specifies resource kind.
815 kind?: string
816
817 // Name specifies the resource name.
818 name?: string
819
820 // Namespace specifies resource namespace.
821 namespace?: string
822
823 // OrphanDownstreamOnPolicyDelete controls whether generated resources should be
824 // deleted when the rule that generated
825 // them is deleted with synchronization enabled. This option is only applicable
826 // to generate rules of the data type.
827 // See https://kyverno.io/docs/writing-policies/generate/#data-examples.
828 // Defaults to "false" if not specified.
829 orphanDownstreamOnPolicyDelete?: bool
830
831 // Synchronize controls if generated resources should be kept in-sync with their source resource.
832 // If Synchronize is set to "true" changes to generated resources will be overwritten with resource
833 // data from Data or the resource specified in the Clone declaration.
834 // Optional. Defaults to "false" if not specified.
835 synchronize?: bool
836
837 // UID specifies the resource uid.
838 uid?: string
839 }
840
841 // ImageExtractors defines a mapping from kinds to ImageExtractorConfigs.
842 // This config is only valid for verifyImages rules.
843 imageExtractors?: [string]: [...{
844 // JMESPath is an optional JMESPath expression to apply to the image value.
845 // This is useful when the extracted image begins with a prefix like 'docker://'.
846 // The 'trim_prefix' function may be used to trim the prefix: trim_prefix(@, 'docker://').
847 // Note - Image digest mutation may not be used when applying a JMESPAth to an image.
848 jmesPath?: string
849
850 // Key is an optional name of the field within 'path' that will be used to
851 // uniquely identify an image.
852 // Note - this field MUST be unique.
853 key?: string
854
855 // Name is the entry the image will be available under 'images.<name>' in the context.
856 // If this field is not defined, image entries will appear under 'images.custom'.
857 name?: string
858
859 // Path is the path to the object containing the image field in a custom resource.
860 // It should be slash-separated. Each slash-separated key must be a valid YAML
861 // key or a wildcard '*'.
862 // Wildcard keys are expanded in case of arrays or objects.
863 path!: string
864
865 // Value is an optional name of the field within 'path' that points to the image URI.
866 // This is useful when a custom 'key' is also defined.
867 value?: string
868 }]
869
870 // MatchResources defines when this policy rule should be applied. The match
871 // criteria can include resource information (e.g. kind, name, namespace, labels)
872 // and admission review request information like the user name or role.
873 // At least one kind is required.
874 match!: matchN(0, [null | bool | number | string | [...] | {
875 any!: _
876 all!: _
877 }]) & {
878 // All allows specifying resources which will be ANDed
879 all?: [...{
880 // ClusterRoles is the list of cluster-wide role names for the user.
881 clusterRoles?: [...string]
882
883 // ResourceDescription contains information about the resource being created or modified.
884 resources?: matchN(0, [null | bool | number | string | [...] | {
885 name!: _
886 names!: _
887 }]) & {
888 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
889 // and values support the wildcard characters "*" (matches zero or many characters) and
890 // "?" (matches at least one character).
891 annotations?: [string]: string
892
893 // Kinds is a list of resource kinds.
894 kinds?: [...string]
895
896 // Name is the name of the resource. The name supports wildcard characters
897 // "*" (matches zero or many characters) and "?" (at least one character).
898 // NOTE: "Name" is being deprecated in favor of "Names".
899 name?: string
900
901 // Names are the names of the resources. Each name supports wildcard characters
902 // "*" (matches zero or many characters) and "?" (at least one character).
903 names?: [...string]
904
905 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
906 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
907 // and `?` (matches one character).Wildcards allows writing label selectors like
908 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
909 // does not match an empty label set.
910 namespaceSelector?: {
911 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
912 matchExpressions?: [...{
913 // key is the label key that the selector applies to.
914 key!: string
915
916 // operator represents a key's relationship to a set of values.
917 // Valid operators are In, NotIn, Exists and DoesNotExist.
918 operator!: string
919
920 // values is an array of string values. If the operator is In or NotIn,
921 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
922 // the values array must be empty. This array is replaced during a strategic
923 // merge patch.
924 values?: [...string]
925 }]
926
927 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
928 // map is equivalent to an element of matchExpressions, whose key field is "key", the
929 // operator is "In", and the values array contains only "value". The requirements are ANDed.
930 matchLabels?: [string]: string
931 }
932
933 // Namespaces is a list of namespaces names. Each name supports wildcard characters
934 // "*" (matches zero or many characters) and "?" (at least one character).
935 namespaces?: [...string]
936
937 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
938 // are used to match a specific action.
939 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
940
941 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
942 // characters `*` (matches zero or many characters) and `?` (matches one character).
943 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
944 // using ["*" : "*"] matches any key and value but does not match an empty label set.
945 selector?: {
946 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
947 matchExpressions?: [...{
948 // key is the label key that the selector applies to.
949 key!: string
950
951 // operator represents a key's relationship to a set of values.
952 // Valid operators are In, NotIn, Exists and DoesNotExist.
953 operator!: string
954
955 // values is an array of string values. If the operator is In or NotIn,
956 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
957 // the values array must be empty. This array is replaced during a strategic
958 // merge patch.
959 values?: [...string]
960 }]
961
962 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
963 // map is equivalent to an element of matchExpressions, whose key field is "key", the
964 // operator is "In", and the values array contains only "value". The requirements are ANDed.
965 matchLabels?: [string]: string
966 }
967 }
968
969 // Roles is the list of namespaced role names for the user.
970 roles?: [...string]
971
972 // Subjects is the list of subject names like users, user groups, and service accounts.
973 subjects?: [...{
974 // APIGroup holds the API group of the referenced subject.
975 // Defaults to "" for ServiceAccount subjects.
976 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
977 apiGroup?: string
978
979 // Kind of object being referenced. Values defined by this API group are "User",
980 // "Group", and "ServiceAccount".
981 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
982 kind!: string
983
984 // Name of the object being referenced.
985 name!: string
986
987 // Namespace of the referenced object. If the object kind is non-namespace, such
988 // as "User" or "Group", and this value is not empty
989 // the Authorizer should report an error.
990 namespace?: string
991 }]
992 }]
993
994 // Any allows specifying resources which will be ORed
995 any?: [...{
996 // ClusterRoles is the list of cluster-wide role names for the user.
997 clusterRoles?: [...string]
998
999 // ResourceDescription contains information about the resource being created or modified.
1000 resources?: matchN(0, [null | bool | number | string | [...] | {
1001 name!: _
1002 names!: _
1003 }]) & {
1004 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
1005 // and values support the wildcard characters "*" (matches zero or many characters) and
1006 // "?" (matches at least one character).
1007 annotations?: [string]: string
1008
1009 // Kinds is a list of resource kinds.
1010 kinds?: [...string]
1011
1012 // Name is the name of the resource. The name supports wildcard characters
1013 // "*" (matches zero or many characters) and "?" (at least one character).
1014 // NOTE: "Name" is being deprecated in favor of "Names".
1015 name?: string
1016
1017 // Names are the names of the resources. Each name supports wildcard characters
1018 // "*" (matches zero or many characters) and "?" (at least one character).
1019 names?: [...string]
1020
1021 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
1022 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
1023 // and `?` (matches one character).Wildcards allows writing label selectors like
1024 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
1025 // does not match an empty label set.
1026 namespaceSelector?: {
1027 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1028 matchExpressions?: [...{
1029 // key is the label key that the selector applies to.
1030 key!: string
1031
1032 // operator represents a key's relationship to a set of values.
1033 // Valid operators are In, NotIn, Exists and DoesNotExist.
1034 operator!: string
1035
1036 // values is an array of string values. If the operator is In or NotIn,
1037 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1038 // the values array must be empty. This array is replaced during a strategic
1039 // merge patch.
1040 values?: [...string]
1041 }]
1042
1043 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1044 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1045 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1046 matchLabels?: [string]: string
1047 }
1048
1049 // Namespaces is a list of namespaces names. Each name supports wildcard characters
1050 // "*" (matches zero or many characters) and "?" (at least one character).
1051 namespaces?: [...string]
1052
1053 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
1054 // are used to match a specific action.
1055 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
1056
1057 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
1058 // characters `*` (matches zero or many characters) and `?` (matches one character).
1059 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
1060 // using ["*" : "*"] matches any key and value but does not match an empty label set.
1061 selector?: {
1062 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1063 matchExpressions?: [...{
1064 // key is the label key that the selector applies to.
1065 key!: string
1066
1067 // operator represents a key's relationship to a set of values.
1068 // Valid operators are In, NotIn, Exists and DoesNotExist.
1069 operator!: string
1070
1071 // values is an array of string values. If the operator is In or NotIn,
1072 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1073 // the values array must be empty. This array is replaced during a strategic
1074 // merge patch.
1075 values?: [...string]
1076 }]
1077
1078 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1079 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1080 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1081 matchLabels?: [string]: string
1082 }
1083 }
1084
1085 // Roles is the list of namespaced role names for the user.
1086 roles?: [...string]
1087
1088 // Subjects is the list of subject names like users, user groups, and service accounts.
1089 subjects?: [...{
1090 // APIGroup holds the API group of the referenced subject.
1091 // Defaults to "" for ServiceAccount subjects.
1092 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
1093 apiGroup?: string
1094
1095 // Kind of object being referenced. Values defined by this API group are "User",
1096 // "Group", and "ServiceAccount".
1097 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
1098 kind!: string
1099
1100 // Name of the object being referenced.
1101 name!: string
1102
1103 // Namespace of the referenced object. If the object kind is non-namespace, such
1104 // as "User" or "Group", and this value is not empty
1105 // the Authorizer should report an error.
1106 namespace?: string
1107 }]
1108 }]
1109 }
1110
1111 // Mutation is used to modify matching resources.
1112 mutate?: {
1113 // ForEach applies mutation rules to a list of sub-elements by creating a
1114 // context for each entry in the list and looping over it to apply the
1115 // specified logic.
1116 foreach?: [...{
1117 // Context defines variables and data sources that can be used during rule execution.
1118 context?: [...matchN(1, [
1119 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
1120 ]) & {
1121 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
1122 // The data returned is stored in the context with the name for the context entry.
1123 apiCall?: {
1124 // The data object specifies the POST data sent to the server.
1125 // Only applicable when the method field is set to POST.
1126 data?: [...{
1127 // Key is a unique identifier for the data value
1128 key!: string
1129
1130 // Value is the data value
1131 value!: null | bool | number | string | [...] | {...}
1132 }]
1133
1134 // Default is an optional arbitrary JSON object that the context
1135 // value is set to, if the apiCall returns error.
1136 default?: null | bool | number | string | [...] | {...}
1137
1138 // JMESPath is an optional JSON Match Expression that can be used to
1139 // transform the JSON response returned from the server. For example
1140 // a JMESPath of "items | length(@)" applied to the API server response
1141 // for the URLPath "/apis/apps/v1/deployments" will return the total count
1142 // of deployments across all namespaces.
1143 jmesPath?: string
1144
1145 // Method is the HTTP request type (GET or POST). Defaults to GET.
1146 method?: "GET" | "POST"
1147
1148 // Service is an API call to a JSON web service.
1149 // This is used for non-Kubernetes API server calls.
1150 // It's mutually exclusive with the URLPath field.
1151 service?: {
1152 // CABundle is a PEM encoded CA bundle which will be used to validate
1153 // the server certificate.
1154 caBundle?: string
1155
1156 // Headers is a list of optional HTTP headers to be included in the request.
1157 headers?: [...{
1158 // Key is the header key
1159 key!: string
1160
1161 // Value is the header value
1162 value!: string
1163 }]
1164
1165 // URL is the JSON web service URL. A typical form is
1166 // `https://{service}.{namespace}:{port}/{path}`.
1167 url!: string
1168 }
1169
1170 // URLPath is the URL path to be used in the HTTP GET or POST request to the
1171 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
1172 // The format required is the same format used by the `kubectl get --raw` command.
1173 // See
1174 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
1175 // for details.
1176 // It's mutually exclusive with the Service field.
1177 urlPath?: string
1178 }
1179
1180 // ConfigMap is the ConfigMap reference.
1181 configMap?: {
1182 // Name is the ConfigMap name.
1183 name!: string
1184
1185 // Namespace is the ConfigMap namespace.
1186 namespace?: string
1187 }
1188
1189 // GlobalContextEntryReference is a reference to a cached global context entry.
1190 globalReference?: {
1191 // JMESPath is an optional JSON Match Expression that can be used to
1192 // transform the JSON response returned from the server. For example
1193 // a JMESPath of "items | length(@)" applied to the API server response
1194 // for the URLPath "/apis/apps/v1/deployments" will return the total count
1195 // of deployments across all namespaces.
1196 jmesPath?: string
1197
1198 // Name of the global context entry
1199 name!: string
1200 }
1201
1202 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
1203 // details.
1204 imageRegistry?: {
1205 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
1206 imageRegistryCredentials?: {
1207 // AllowInsecureRegistry allows insecure access to a registry.
1208 allowInsecureRegistry?: bool
1209
1210 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
1211 // It can be of one of these values: default,google,azure,amazon,github.
1212 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
1213
1214 // Secrets specifies a list of secrets that are provided for credentials.
1215 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
1216 // imagePullSecrets from the resource namespace are also used.
1217 secrets?: [...string]
1218 }
1219
1220 // JMESPath is an optional JSON Match Expression that can be used to
1221 // transform the ImageData struct returned as a result of processing
1222 // the image reference.
1223 jmesPath?: string
1224
1225 // Reference is image reference to a container image in the registry.
1226 // Example: ghcr.io/kyverno/kyverno:latest
1227 reference!: string
1228 }
1229
1230 // Name is the variable name.
1231 name!: string
1232
1233 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
1234 variable?: {
1235 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
1236 // expression evaluates to nil
1237 default?: null | bool | number | string | [...] | {...}
1238
1239 // JMESPath is an optional JMESPath Expression that can be used to
1240 // transform the variable.
1241 jmesPath?: string
1242
1243 // Value is any arbitrary JSON object representable in YAML or JSON form.
1244 value?: null | bool | number | string | [...] | {...}
1245 }
1246 }]
1247
1248 // Foreach declares a nested foreach iterator
1249 foreach?: null | bool | number | string | [...] | {...}
1250
1251 // List specifies a JMESPath expression that results in one or more elements
1252 // to which the validation logic is applied.
1253 list?: string
1254
1255 // Order defines the iteration order on the list.
1256 // Can be Ascending to iterate from first to last element or Descending to
1257 // iterate in from last to first element.
1258 order?: "Ascending" | "Descending"
1259
1260 // PatchStrategicMerge is a strategic merge patch used to modify resources.
1261 // See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
1262 // and https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesstrategicmerge/.
1263 patchStrategicMerge?: null | bool | number | string | [...] | {...}
1264
1265 // PatchesJSON6902 is a list of RFC 6902 JSON Patch declarations used to modify resources.
1266 // See https://tools.ietf.org/html/rfc6902 and
1267 // https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesjson6902/.
1268 patchesJson6902?: string
1269
1270 // AnyAllConditions are used to determine if a policy rule should be applied by evaluating a
1271 // set of conditions. The declaration can contain nested `any` or `all` statements.
1272 // See: https://kyverno.io/docs/writing-policies/preconditions/
1273 preconditions?: {
1274 // AllConditions enable variable-based conditional rule execution. This is useful for
1275 // finer control of when an rule is applied. A condition can reference object data
1276 // using JMESPath notation.
1277 // Here, all of the conditions need to pass
1278 all?: [...{
1279 // Key is the context entry (using JMESPath) for conditional rule evaluation.
1280 key?: null | bool | number | string | [...] | {...}
1281
1282 // Message is an optional display message
1283 message?: string
1284
1285 // Operator is the conditional operation to perform. Valid operators are:
1286 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
1287 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
1288 // DurationLessThanOrEquals, DurationLessThan
1289 operator?: "Equals" |
1290 "NotEquals" |
1291 "In" |
1292 "AnyIn" |
1293 "AllIn" |
1294 "NotIn" |
1295 "AnyNotIn" |
1296 "AllNotIn" |
1297 "GreaterThanOrEquals" |
1298 "GreaterThan" |
1299 "LessThanOrEquals" |
1300 "LessThan" |
1301 "DurationGreaterThanOrEquals" |
1302 "DurationGreaterThan" |
1303 "DurationLessThanOrEquals" |
1304 "DurationLessThan"
1305
1306 // Value is the conditional value, or set of values. The values can be fixed set
1307 // or can be variables declared using JMESPath.
1308 value?: null | bool | number | string | [...] | {...}
1309 }]
1310
1311 // AnyConditions enable variable-based conditional rule execution. This is useful for
1312 // finer control of when an rule is applied. A condition can reference object data
1313 // using JMESPath notation.
1314 // Here, at least one of the conditions need to pass
1315 any?: [...{
1316 // Key is the context entry (using JMESPath) for conditional rule evaluation.
1317 key?: null | bool | number | string | [...] | {...}
1318
1319 // Message is an optional display message
1320 message?: string
1321
1322 // Operator is the conditional operation to perform. Valid operators are:
1323 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
1324 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
1325 // DurationLessThanOrEquals, DurationLessThan
1326 operator?: "Equals" |
1327 "NotEquals" |
1328 "In" |
1329 "AnyIn" |
1330 "AllIn" |
1331 "NotIn" |
1332 "AnyNotIn" |
1333 "AllNotIn" |
1334 "GreaterThanOrEquals" |
1335 "GreaterThan" |
1336 "LessThanOrEquals" |
1337 "LessThan" |
1338 "DurationGreaterThanOrEquals" |
1339 "DurationGreaterThan" |
1340 "DurationLessThanOrEquals" |
1341 "DurationLessThan"
1342
1343 // Value is the conditional value, or set of values. The values can be fixed set
1344 // or can be variables declared using JMESPath.
1345 value?: null | bool | number | string | [...] | {...}
1346 }]
1347 ...
1348 }
1349 }]
1350
1351 // MutateExistingOnPolicyUpdate controls if the mutateExisting rule will be
1352 // applied on policy events.
1353 mutateExistingOnPolicyUpdate?: bool
1354
1355 // PatchStrategicMerge is a strategic merge patch used to modify resources.
1356 // See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
1357 // and https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesstrategicmerge/.
1358 patchStrategicMerge?: null | bool | number | string | [...] | {...}
1359
1360 // PatchesJSON6902 is a list of RFC 6902 JSON Patch declarations used to modify resources.
1361 // See https://tools.ietf.org/html/rfc6902 and
1362 // https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesjson6902/.
1363 patchesJson6902?: string
1364
1365 // Targets defines the target resources to be mutated.
1366 targets?: [...{
1367 // APIVersion specifies resource apiVersion.
1368 apiVersion?: string
1369
1370 // Context defines variables and data sources that can be used during rule execution.
1371 context?: [...matchN(1, [
1372 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
1373 ]) & {
1374 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
1375 // The data returned is stored in the context with the name for the context entry.
1376 apiCall?: {
1377 // The data object specifies the POST data sent to the server.
1378 // Only applicable when the method field is set to POST.
1379 data?: [...{
1380 // Key is a unique identifier for the data value
1381 key!: string
1382
1383 // Value is the data value
1384 value!: null | bool | number | string | [...] | {...}
1385 }]
1386
1387 // Default is an optional arbitrary JSON object that the context
1388 // value is set to, if the apiCall returns error.
1389 default?: null | bool | number | string | [...] | {...}
1390
1391 // JMESPath is an optional JSON Match Expression that can be used to
1392 // transform the JSON response returned from the server. For example
1393 // a JMESPath of "items | length(@)" applied to the API server response
1394 // for the URLPath "/apis/apps/v1/deployments" will return the total count
1395 // of deployments across all namespaces.
1396 jmesPath?: string
1397
1398 // Method is the HTTP request type (GET or POST). Defaults to GET.
1399 method?: "GET" | "POST"
1400
1401 // Service is an API call to a JSON web service.
1402 // This is used for non-Kubernetes API server calls.
1403 // It's mutually exclusive with the URLPath field.
1404 service?: {
1405 // CABundle is a PEM encoded CA bundle which will be used to validate
1406 // the server certificate.
1407 caBundle?: string
1408
1409 // Headers is a list of optional HTTP headers to be included in the request.
1410 headers?: [...{
1411 // Key is the header key
1412 key!: string
1413
1414 // Value is the header value
1415 value!: string
1416 }]
1417
1418 // URL is the JSON web service URL. A typical form is
1419 // `https://{service}.{namespace}:{port}/{path}`.
1420 url!: string
1421 }
1422
1423 // URLPath is the URL path to be used in the HTTP GET or POST request to the
1424 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
1425 // The format required is the same format used by the `kubectl get --raw` command.
1426 // See
1427 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
1428 // for details.
1429 // It's mutually exclusive with the Service field.
1430 urlPath?: string
1431 }
1432
1433 // ConfigMap is the ConfigMap reference.
1434 configMap?: {
1435 // Name is the ConfigMap name.
1436 name!: string
1437
1438 // Namespace is the ConfigMap namespace.
1439 namespace?: string
1440 }
1441
1442 // GlobalContextEntryReference is a reference to a cached global context entry.
1443 globalReference?: {
1444 // JMESPath is an optional JSON Match Expression that can be used to
1445 // transform the JSON response returned from the server. For example
1446 // a JMESPath of "items | length(@)" applied to the API server response
1447 // for the URLPath "/apis/apps/v1/deployments" will return the total count
1448 // of deployments across all namespaces.
1449 jmesPath?: string
1450
1451 // Name of the global context entry
1452 name!: string
1453 }
1454
1455 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
1456 // details.
1457 imageRegistry?: {
1458 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
1459 imageRegistryCredentials?: {
1460 // AllowInsecureRegistry allows insecure access to a registry.
1461 allowInsecureRegistry?: bool
1462
1463 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
1464 // It can be of one of these values: default,google,azure,amazon,github.
1465 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
1466
1467 // Secrets specifies a list of secrets that are provided for credentials.
1468 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
1469 // imagePullSecrets from the resource namespace are also used.
1470 secrets?: [...string]
1471 }
1472
1473 // JMESPath is an optional JSON Match Expression that can be used to
1474 // transform the ImageData struct returned as a result of processing
1475 // the image reference.
1476 jmesPath?: string
1477
1478 // Reference is image reference to a container image in the registry.
1479 // Example: ghcr.io/kyverno/kyverno:latest
1480 reference!: string
1481 }
1482
1483 // Name is the variable name.
1484 name!: string
1485
1486 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
1487 variable?: {
1488 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
1489 // expression evaluates to nil
1490 default?: null | bool | number | string | [...] | {...}
1491
1492 // JMESPath is an optional JMESPath Expression that can be used to
1493 // transform the variable.
1494 jmesPath?: string
1495
1496 // Value is any arbitrary JSON object representable in YAML or JSON form.
1497 value?: null | bool | number | string | [...] | {...}
1498 }
1499 }]
1500
1501 // Kind specifies resource kind.
1502 kind?: string
1503
1504 // Name specifies the resource name.
1505 name?: string
1506
1507 // Namespace specifies resource namespace.
1508 namespace?: string
1509
1510 // Preconditions are used to determine if a policy rule should be applied by evaluating a
1511 // set of conditions. The declaration can contain nested `any` or `all` statements. A direct list
1512 // of conditions (without `any` or `all` statements is supported for backwards compatibility but
1513 // will be deprecated in the next major release.
1514 // See: https://kyverno.io/docs/writing-policies/preconditions/
1515 preconditions?: null | bool | number | string | [...] | {...}
1516
1517 // Selector allows you to select target resources with their labels.
1518 selector?: {
1519 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1520 matchExpressions?: [...{
1521 // key is the label key that the selector applies to.
1522 key!: string
1523
1524 // operator represents a key's relationship to a set of values.
1525 // Valid operators are In, NotIn, Exists and DoesNotExist.
1526 operator!: string
1527
1528 // values is an array of string values. If the operator is In or NotIn,
1529 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1530 // the values array must be empty. This array is replaced during a strategic
1531 // merge patch.
1532 values?: [...string]
1533 }]
1534
1535 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1536 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1537 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1538 matchLabels?: [string]: string
1539 }
1540
1541 // UID specifies the resource uid.
1542 uid?: string
1543 }]
1544 }
1545
1546 // Name is a label to identify the rule, It must be unique within the policy.
1547 name!: strings.MaxRunes(
1548 63,
1549 )
1550
1551 // Preconditions are used to determine if a policy rule should be applied by evaluating a
1552 // set of conditions. The declaration can contain nested `any` or `all` statements.
1553 // See: https://kyverno.io/docs/writing-policies/preconditions/
1554 preconditions?: {
1555 // AllConditions enable variable-based conditional rule execution. This is useful for
1556 // finer control of when an rule is applied. A condition can reference object data
1557 // using JMESPath notation.
1558 // Here, all of the conditions need to pass.
1559 all?: [...{
1560 // Key is the context entry (using JMESPath) for conditional rule evaluation.
1561 key?: null | bool | number | string | [...] | {...}
1562
1563 // Message is an optional display message
1564 message?: string
1565
1566 // Operator is the conditional operation to perform. Valid operators are:
1567 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
1568 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
1569 // DurationLessThanOrEquals, DurationLessThan
1570 operator?: "Equals" |
1571 "NotEquals" |
1572 "AnyIn" |
1573 "AllIn" |
1574 "AnyNotIn" |
1575 "AllNotIn" |
1576 "GreaterThanOrEquals" |
1577 "GreaterThan" |
1578 "LessThanOrEquals" |
1579 "LessThan" |
1580 "DurationGreaterThanOrEquals" |
1581 "DurationGreaterThan" |
1582 "DurationLessThanOrEquals" |
1583 "DurationLessThan"
1584
1585 // Value is the conditional value, or set of values. The values can be fixed set
1586 // or can be variables declared using JMESPath.
1587 value?: null | bool | number | string | [...] | {...}
1588 }]
1589
1590 // AnyConditions enable variable-based conditional rule execution. This is useful for
1591 // finer control of when an rule is applied. A condition can reference object data
1592 // using JMESPath notation.
1593 // Here, at least one of the conditions need to pass.
1594 any?: [...{
1595 // Key is the context entry (using JMESPath) for conditional rule evaluation.
1596 key?: null | bool | number | string | [...] | {...}
1597
1598 // Message is an optional display message
1599 message?: string
1600
1601 // Operator is the conditional operation to perform. Valid operators are:
1602 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
1603 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
1604 // DurationLessThanOrEquals, DurationLessThan
1605 operator?: "Equals" |
1606 "NotEquals" |
1607 "AnyIn" |
1608 "AllIn" |
1609 "AnyNotIn" |
1610 "AllNotIn" |
1611 "GreaterThanOrEquals" |
1612 "GreaterThan" |
1613 "LessThanOrEquals" |
1614 "LessThan" |
1615 "DurationGreaterThanOrEquals" |
1616 "DurationGreaterThan" |
1617 "DurationLessThanOrEquals" |
1618 "DurationLessThan"
1619
1620 // Value is the conditional value, or set of values. The values can be fixed set
1621 // or can be variables declared using JMESPath.
1622 value?: null | bool | number | string | [...] | {...}
1623 }]
1624 }
1625
1626 // SkipBackgroundRequests bypasses admission requests that are sent by the background controller.
1627 // The default value is set to "true", it must be set to "false" to apply
1628 // generate and mutateExisting rules to those requests.
1629 skipBackgroundRequests?: bool
1630
1631 // Validation is used to validate matching resources.
1632 validate?: {
1633 // AnyPattern specifies list of validation patterns. At least one of the patterns
1634 // must be satisfied for the validation rule to succeed.
1635 anyPattern?: null | bool | number | string | [...] | {...}
1636
1637 // Assert defines a kyverno-json assertion tree.
1638 assert?: {...}
1639
1640 // CEL allows validation checks using the Common Expression Language
1641 // (https://kubernetes.io/docs/reference/using-api/cel/).
1642 cel?: {
1643 // AuditAnnotations contains CEL expressions which are used to produce audit
1644 // annotations for the audit event of the API request.
1645 auditAnnotations?: [...{
1646 // key specifies the audit annotation key. The audit annotation keys of
1647 // a ValidatingAdmissionPolicy must be unique. The key must be a qualified
1648 // name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.
1649 //
1650 // The key is combined with the resource name of the
1651 // ValidatingAdmissionPolicy to construct an audit annotation key:
1652 // "{ValidatingAdmissionPolicy name}/{key}".
1653 //
1654 // If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy
1655 // and the same audit annotation key, the annotation key will be identical.
1656 // In this case, the first annotation written with the key will be included
1657 // in the audit event and all subsequent annotations with the same key
1658 // will be discarded.
1659 //
1660 // Required.
1661 key!: string
1662
1663 // valueExpression represents the expression which is evaluated by CEL to
1664 // produce an audit annotation value. The expression must evaluate to either
1665 // a string or null value. If the expression evaluates to a string, the
1666 // audit annotation is included with the string value. If the expression
1667 // evaluates to null or empty string the audit annotation will be omitted.
1668 // The valueExpression may be no longer than 5kb in length.
1669 // If the result of the valueExpression is more than 10kb in length, it
1670 // will be truncated to 10kb.
1671 //
1672 // If multiple ValidatingAdmissionPolicyBinding resources match an
1673 // API request, then the valueExpression will be evaluated for
1674 // each binding. All unique values produced by the valueExpressions
1675 // will be joined together in a comma-separated list.
1676 //
1677 // Required.
1678 valueExpression!: string
1679 }]
1680
1681 // Expressions is a list of CELExpression types.
1682 expressions?: [...{
1683 // Expression represents the expression which will be evaluated by CEL.
1684 // ref: https://github.com/google/cel-spec
1685 // CEL expressions have access to the contents of the API request/response,
1686 // organized into CEL variables as well as some other useful variables:
1687 //
1688 // - 'object' - The object from the incoming request. The value is null for DELETE requests.
1689 // - 'oldObject' - The existing object. The value is null for CREATE requests.
1690 // - 'request' - Attributes of the API
1691 // request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).
1692 // - 'params' - Parameter resource referred to by the policy binding being
1693 // evaluated. Only populated if the policy has a ParamKind.
1694 // - 'namespaceObject' - The namespace object that the incoming object belongs
1695 // to. The value is null for cluster-scoped resources.
1696 // - 'variables' - Map of composited variables, from its name to its lazily evaluated value.
1697 // For example, a variable named 'foo' can be accessed as 'variables.foo'.
1698 // - 'authorizer' - A CEL Authorizer. May be used to perform authorization
1699 // checks for the principal (user or service account) of the request.
1700 // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
1701 // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the
1702 // 'authorizer' and configured with the
1703 // request resource.
1704 //
1705 // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are
1706 // always accessible from the root of the
1707 // object. No other metadata properties are accessible.
1708 //
1709 // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
1710 // Accessible property names are escaped according to the following rules when
1711 // accessed in the expression:
1712 // - '__' escapes to '__underscores__'
1713 // - '.' escapes to '__dot__'
1714 // - '-' escapes to '__dash__'
1715 // - '/' escapes to '__slash__'
1716 // - Property names that exactly match a CEL RESERVED keyword escape to
1717 // '__{keyword}__'. The keywords are:
1718 // "true", "false", "null", "in", "as", "break", "const", "continue", "else",
1719 // "for", "function", "if",
1720 // "import", "let", "loop", "package", "namespace", "return".
1721 // Examples:
1722 // - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ > 0"}
1723 // - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop > 0"}
1724 // - Expression accessing a property named "redact__d": {"Expression":
1725 // "object.redact__underscores__d > 0"}
1726 //
1727 // Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
1728 // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
1729 // - 'set': `X + Y` performs a union where the array positions of all elements
1730 // in `X` are preserved and
1731 // non-intersecting elements in `Y` are appended, retaining their partial order.
1732 // - 'map': `X + Y` performs a merge where the array positions of all keys in
1733 // `X` are preserved but the values
1734 // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
1735 // non-intersecting keys are appended, retaining their partial order.
1736 // Required.
1737 expression!: string
1738
1739 // Message represents the message displayed when validation fails. The message
1740 // is required if the Expression contains
1741 // line breaks. The message must not contain line breaks.
1742 // If unset, the message is "failed rule: {Rule}".
1743 // e.g. "must be a URL with the host matching spec.host"
1744 // If the Expression contains line breaks. Message is required.
1745 // The message must not contain line breaks.
1746 // If unset, the message is "failed Expression: {Expression}".
1747 message?: string
1748
1749 // messageExpression declares a CEL expression that evaluates to the validation
1750 // failure message that is returned when this rule fails.
1751 // Since messageExpression is used as a failure message, it must evaluate to a string.
1752 // If both message and messageExpression are present on a validation, then
1753 // messageExpression will be used if validation fails.
1754 // If messageExpression results in a runtime error, the runtime error is logged,
1755 // and the validation failure message is produced
1756 // as if the messageExpression field were unset. If messageExpression evaluates
1757 // to an empty string, a string with only spaces, or a string
1758 // that contains line breaks, then the validation failure message will also be
1759 // produced as if the messageExpression field were unset, and
1760 // the fact that messageExpression produced an empty string/string with only
1761 // spaces/string with line breaks will be logged.
1762 // messageExpression has access to all the same variables as the `expression`
1763 // except for 'authorizer' and 'authorizer.requestResource'.
1764 // Example:
1765 // "object.x must be less than max ("+string(params.max)+")"
1766 messageExpression?: string
1767
1768 // Reason represents a machine-readable description of why this validation failed.
1769 // If this is the first validation in the list to fail, this reason, as well as the
1770 // corresponding HTTP response code, are used in the
1771 // HTTP response to the client.
1772 // The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid",
1773 // "RequestEntityTooLarge".
1774 // If not set, StatusReasonInvalid is used in the response to the client.
1775 reason?: string
1776 }]
1777
1778 // Generate specifies whether to generate a Kubernetes ValidatingAdmissionPolicy from the rule.
1779 // Optional. Defaults to "false" if not specified.
1780 generate?: bool
1781
1782 // ParamKind is a tuple of Group Kind and Version.
1783 paramKind?: {
1784 // APIVersion is the API group version the resources belong to.
1785 // In format of "group/version".
1786 // Required.
1787 apiVersion?: string
1788
1789 // Kind is the API kind the resources belong to.
1790 // Required.
1791 kind?: string
1792 }
1793
1794 // ParamRef references a parameter resource.
1795 paramRef?: {
1796 // name is the name of the resource being referenced.
1797 //
1798 // One of `name` or `selector` must be set, but `name` and `selector` are
1799 // mutually exclusive properties. If one is set, the other must be unset.
1800 //
1801 // A single parameter used for all admission requests can be configured
1802 // by setting the `name` field, leaving `selector` blank, and setting namespace
1803 // if `paramKind` is namespace-scoped.
1804 name?: string
1805
1806 // namespace is the namespace of the referenced resource. Allows limiting
1807 // the search for params to a specific namespace. Applies to both `name` and
1808 // `selector` fields.
1809 //
1810 // A per-namespace parameter may be used by specifying a namespace-scoped
1811 // `paramKind` in the policy and leaving this field empty.
1812 //
1813 // - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this
1814 // field results in a configuration error.
1815 //
1816 // - If `paramKind` is namespace-scoped, the namespace of the object being
1817 // evaluated for admission will be used when this field is left unset. Take
1818 // care that if this is left empty the binding must not match any cluster-scoped
1819 // resources, which will result in an error.
1820 namespace?: string
1821
1822 // `parameterNotFoundAction` controls the behavior of the binding when the resource
1823 // exists, and name or selector is valid, but there are no parameters
1824 // matched by the binding. If the value is set to `Allow`, then no
1825 // matched parameters will be treated as successful validation by the binding.
1826 // If set to `Deny`, then no matched parameters will be subject to the
1827 // `failurePolicy` of the policy.
1828 //
1829 // Allowed values are `Allow` or `Deny`
1830 //
1831 // Required
1832 parameterNotFoundAction?: string
1833
1834 // selector can be used to match multiple param objects based on their labels.
1835 // Supply selector: {} to match all resources of the ParamKind.
1836 //
1837 // If multiple params are found, they are all evaluated with the policy expressions
1838 // and the results are ANDed together.
1839 //
1840 // One of `name` or `selector` must be set, but `name` and `selector` are
1841 // mutually exclusive properties. If one is set, the other must be unset.
1842 selector?: {
1843 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1844 matchExpressions?: [...{
1845 // key is the label key that the selector applies to.
1846 key!: string
1847
1848 // operator represents a key's relationship to a set of values.
1849 // Valid operators are In, NotIn, Exists and DoesNotExist.
1850 operator!: string
1851
1852 // values is an array of string values. If the operator is In or NotIn,
1853 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1854 // the values array must be empty. This array is replaced during a strategic
1855 // merge patch.
1856 values?: [...string]
1857 }]
1858
1859 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1860 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1861 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1862 matchLabels?: [string]: string
1863 }
1864 }
1865
1866 // Variables contain definitions of variables that can be used in composition of other expressions.
1867 // Each variable is defined as a named CEL expression.
1868 // The variables defined here will be available under `variables` in other
1869 // expressions of the policy.
1870 variables?: [...{
1871 // Expression is the expression that will be evaluated as the value of the variable.
1872 // The CEL expression has access to the same identifiers as the CEL expressions in Validation.
1873 expression!: string
1874
1875 // Name is the name of the variable. The name must be a valid CEL identifier and
1876 // unique among all variables.
1877 // The variable can be accessed in other expressions through `variables`
1878 // For example, if name is "foo", the variable will be available as `variables.foo`
1879 name!: string
1880 }]
1881 }
1882
1883 // Deny defines conditions used to pass or fail a validation rule.
1884 deny?: {
1885 // Multiple conditions can be declared under an `any` or `all` statement.
1886 // See: https://kyverno.io/docs/writing-policies/validate/#deny-rules
1887 conditions?: {
1888 // AllConditions enable variable-based conditional rule execution. This is useful for
1889 // finer control of when an rule is applied. A condition can reference object data
1890 // using JMESPath notation.
1891 // Here, all of the conditions need to pass.
1892 all?: [...{
1893 // Key is the context entry (using JMESPath) for conditional rule evaluation.
1894 key?: null | bool | number | string | [...] | {...}
1895
1896 // Message is an optional display message
1897 message?: string
1898
1899 // Operator is the conditional operation to perform. Valid operators are:
1900 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
1901 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
1902 // DurationLessThanOrEquals, DurationLessThan
1903 operator?: "Equals" |
1904 "NotEquals" |
1905 "AnyIn" |
1906 "AllIn" |
1907 "AnyNotIn" |
1908 "AllNotIn" |
1909 "GreaterThanOrEquals" |
1910 "GreaterThan" |
1911 "LessThanOrEquals" |
1912 "LessThan" |
1913 "DurationGreaterThanOrEquals" |
1914 "DurationGreaterThan" |
1915 "DurationLessThanOrEquals" |
1916 "DurationLessThan"
1917
1918 // Value is the conditional value, or set of values. The values can be fixed set
1919 // or can be variables declared using JMESPath.
1920 value?: null | bool | number | string | [...] | {...}
1921 }]
1922
1923 // AnyConditions enable variable-based conditional rule execution. This is useful for
1924 // finer control of when an rule is applied. A condition can reference object data
1925 // using JMESPath notation.
1926 // Here, at least one of the conditions need to pass.
1927 any?: [...{
1928 // Key is the context entry (using JMESPath) for conditional rule evaluation.
1929 key?: null | bool | number | string | [...] | {...}
1930
1931 // Message is an optional display message
1932 message?: string
1933
1934 // Operator is the conditional operation to perform. Valid operators are:
1935 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
1936 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
1937 // DurationLessThanOrEquals, DurationLessThan
1938 operator?: "Equals" |
1939 "NotEquals" |
1940 "AnyIn" |
1941 "AllIn" |
1942 "AnyNotIn" |
1943 "AllNotIn" |
1944 "GreaterThanOrEquals" |
1945 "GreaterThan" |
1946 "LessThanOrEquals" |
1947 "LessThan" |
1948 "DurationGreaterThanOrEquals" |
1949 "DurationGreaterThan" |
1950 "DurationLessThanOrEquals" |
1951 "DurationLessThan"
1952
1953 // Value is the conditional value, or set of values. The values can be fixed set
1954 // or can be variables declared using JMESPath.
1955 value?: null | bool | number | string | [...] | {...}
1956 }]
1957 }
1958 }
1959
1960 // FailureAction defines if a validation policy rule violation should block
1961 // the admission review request (Enforce), or allow (Audit) the admission review request
1962 // and report an error in a policy report. Optional.
1963 // Allowed values are Audit or Enforce.
1964 failureAction?: "Audit" | "Enforce"
1965
1966 // FailureActionOverrides is a Cluster Policy attribute that specifies FailureAction
1967 // namespace-wise. It overrides FailureAction for the specified namespaces.
1968 failureActionOverrides?: [...{
1969 // ValidationFailureAction defines the policy validation failure action
1970 action?: "audit" | "enforce" | "Audit" | "Enforce"
1971
1972 // A label selector is a label query over a set of resources. The result of matchLabels and
1973 // matchExpressions are ANDed. An empty label selector matches all objects. A null
1974 // label selector matches no objects.
1975 namespaceSelector?: {
1976 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
1977 matchExpressions?: [...{
1978 // key is the label key that the selector applies to.
1979 key!: string
1980
1981 // operator represents a key's relationship to a set of values.
1982 // Valid operators are In, NotIn, Exists and DoesNotExist.
1983 operator!: string
1984
1985 // values is an array of string values. If the operator is In or NotIn,
1986 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
1987 // the values array must be empty. This array is replaced during a strategic
1988 // merge patch.
1989 values?: [...string]
1990 }]
1991
1992 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
1993 // map is equivalent to an element of matchExpressions, whose key field is "key", the
1994 // operator is "In", and the values array contains only "value". The requirements are ANDed.
1995 matchLabels?: [string]: string
1996 }
1997 namespaces?: [...string]
1998 }]
1999
2000 // ForEach applies validate rules to a list of sub-elements by creating a
2001 // context for each entry in the list and looping over it to apply the
2002 // specified logic.
2003 foreach?: [...{
2004 // AnyPattern specifies list of validation patterns. At least one of the patterns
2005 // must be satisfied for the validation rule to succeed.
2006 anyPattern?: null | bool | number | string | [...] | {...}
2007
2008 // Context defines variables and data sources that can be used during rule execution.
2009 context?: [...matchN(1, [
2010 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
2011 ]) & {
2012 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
2013 // The data returned is stored in the context with the name for the context entry.
2014 apiCall?: {
2015 // The data object specifies the POST data sent to the server.
2016 // Only applicable when the method field is set to POST.
2017 data?: [...{
2018 // Key is a unique identifier for the data value
2019 key!: string
2020
2021 // Value is the data value
2022 value!: null | bool | number | string | [...] | {...}
2023 }]
2024
2025 // Default is an optional arbitrary JSON object that the context
2026 // value is set to, if the apiCall returns error.
2027 default?: null | bool | number | string | [...] | {...}
2028
2029 // JMESPath is an optional JSON Match Expression that can be used to
2030 // transform the JSON response returned from the server. For example
2031 // a JMESPath of "items | length(@)" applied to the API server response
2032 // for the URLPath "/apis/apps/v1/deployments" will return the total count
2033 // of deployments across all namespaces.
2034 jmesPath?: string
2035
2036 // Method is the HTTP request type (GET or POST). Defaults to GET.
2037 method?: "GET" | "POST"
2038
2039 // Service is an API call to a JSON web service.
2040 // This is used for non-Kubernetes API server calls.
2041 // It's mutually exclusive with the URLPath field.
2042 service?: {
2043 // CABundle is a PEM encoded CA bundle which will be used to validate
2044 // the server certificate.
2045 caBundle?: string
2046
2047 // Headers is a list of optional HTTP headers to be included in the request.
2048 headers?: [...{
2049 // Key is the header key
2050 key!: string
2051
2052 // Value is the header value
2053 value!: string
2054 }]
2055
2056 // URL is the JSON web service URL. A typical form is
2057 // `https://{service}.{namespace}:{port}/{path}`.
2058 url!: string
2059 }
2060
2061 // URLPath is the URL path to be used in the HTTP GET or POST request to the
2062 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
2063 // The format required is the same format used by the `kubectl get --raw` command.
2064 // See
2065 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
2066 // for details.
2067 // It's mutually exclusive with the Service field.
2068 urlPath?: string
2069 }
2070
2071 // ConfigMap is the ConfigMap reference.
2072 configMap?: {
2073 // Name is the ConfigMap name.
2074 name!: string
2075
2076 // Namespace is the ConfigMap namespace.
2077 namespace?: string
2078 }
2079
2080 // GlobalContextEntryReference is a reference to a cached global context entry.
2081 globalReference?: {
2082 // JMESPath is an optional JSON Match Expression that can be used to
2083 // transform the JSON response returned from the server. For example
2084 // a JMESPath of "items | length(@)" applied to the API server response
2085 // for the URLPath "/apis/apps/v1/deployments" will return the total count
2086 // of deployments across all namespaces.
2087 jmesPath?: string
2088
2089 // Name of the global context entry
2090 name!: string
2091 }
2092
2093 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
2094 // details.
2095 imageRegistry?: {
2096 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
2097 imageRegistryCredentials?: {
2098 // AllowInsecureRegistry allows insecure access to a registry.
2099 allowInsecureRegistry?: bool
2100
2101 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
2102 // It can be of one of these values: default,google,azure,amazon,github.
2103 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
2104
2105 // Secrets specifies a list of secrets that are provided for credentials.
2106 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
2107 // imagePullSecrets from the resource namespace are also used.
2108 secrets?: [...string]
2109 }
2110
2111 // JMESPath is an optional JSON Match Expression that can be used to
2112 // transform the ImageData struct returned as a result of processing
2113 // the image reference.
2114 jmesPath?: string
2115
2116 // Reference is image reference to a container image in the registry.
2117 // Example: ghcr.io/kyverno/kyverno:latest
2118 reference!: string
2119 }
2120
2121 // Name is the variable name.
2122 name!: string
2123
2124 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
2125 variable?: {
2126 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
2127 // expression evaluates to nil
2128 default?: null | bool | number | string | [...] | {...}
2129
2130 // JMESPath is an optional JMESPath Expression that can be used to
2131 // transform the variable.
2132 jmesPath?: string
2133
2134 // Value is any arbitrary JSON object representable in YAML or JSON form.
2135 value?: null | bool | number | string | [...] | {...}
2136 }
2137 }]
2138
2139 // Deny defines conditions used to pass or fail a validation rule.
2140 deny?: {
2141 // Multiple conditions can be declared under an `any` or `all` statement. A direct list
2142 // of conditions (without `any` or `all` statements) is also supported for backwards compatibility
2143 // but will be deprecated in the next major release.
2144 // See: https://kyverno.io/docs/writing-policies/validate/#deny-rules
2145 conditions?: null | bool | number | string | [...] | {...}
2146 }
2147
2148 // ElementScope specifies whether to use the current list element as the scope
2149 // for validation. Defaults to "true" if not specified.
2150 // When set to "false", "request.object" is used as the validation scope within the foreach
2151 // block to allow referencing other elements in the subtree.
2152 elementScope?: bool
2153
2154 // Foreach declares a nested foreach iterator
2155 foreach?: null | bool | number | string | [...] | {...}
2156
2157 // List specifies a JMESPath expression that results in one or more elements
2158 // to which the validation logic is applied.
2159 list?: string
2160
2161 // Pattern specifies an overlay-style pattern used to check resources.
2162 pattern?: null | bool | number | string | [...] | {...}
2163
2164 // AnyAllConditions are used to determine if a policy rule should be applied by evaluating a
2165 // set of conditions. The declaration can contain nested `any` or `all` statements.
2166 // See: https://kyverno.io/docs/writing-policies/preconditions/
2167 preconditions?: {
2168 // AllConditions enable variable-based conditional rule execution. This is useful for
2169 // finer control of when an rule is applied. A condition can reference object data
2170 // using JMESPath notation.
2171 // Here, all of the conditions need to pass
2172 all?: [...{
2173 // Key is the context entry (using JMESPath) for conditional rule evaluation.
2174 key?: null | bool | number | string | [...] | {...}
2175
2176 // Message is an optional display message
2177 message?: string
2178
2179 // Operator is the conditional operation to perform. Valid operators are:
2180 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
2181 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
2182 // DurationLessThanOrEquals, DurationLessThan
2183 operator?: "Equals" |
2184 "NotEquals" |
2185 "In" |
2186 "AnyIn" |
2187 "AllIn" |
2188 "NotIn" |
2189 "AnyNotIn" |
2190 "AllNotIn" |
2191 "GreaterThanOrEquals" |
2192 "GreaterThan" |
2193 "LessThanOrEquals" |
2194 "LessThan" |
2195 "DurationGreaterThanOrEquals" |
2196 "DurationGreaterThan" |
2197 "DurationLessThanOrEquals" |
2198 "DurationLessThan"
2199
2200 // Value is the conditional value, or set of values. The values can be fixed set
2201 // or can be variables declared using JMESPath.
2202 value?: null | bool | number | string | [...] | {...}
2203 }]
2204
2205 // AnyConditions enable variable-based conditional rule execution. This is useful for
2206 // finer control of when an rule is applied. A condition can reference object data
2207 // using JMESPath notation.
2208 // Here, at least one of the conditions need to pass
2209 any?: [...{
2210 // Key is the context entry (using JMESPath) for conditional rule evaluation.
2211 key?: null | bool | number | string | [...] | {...}
2212
2213 // Message is an optional display message
2214 message?: string
2215
2216 // Operator is the conditional operation to perform. Valid operators are:
2217 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
2218 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
2219 // DurationLessThanOrEquals, DurationLessThan
2220 operator?: "Equals" |
2221 "NotEquals" |
2222 "In" |
2223 "AnyIn" |
2224 "AllIn" |
2225 "NotIn" |
2226 "AnyNotIn" |
2227 "AllNotIn" |
2228 "GreaterThanOrEquals" |
2229 "GreaterThan" |
2230 "LessThanOrEquals" |
2231 "LessThan" |
2232 "DurationGreaterThanOrEquals" |
2233 "DurationGreaterThan" |
2234 "DurationLessThanOrEquals" |
2235 "DurationLessThan"
2236
2237 // Value is the conditional value, or set of values. The values can be fixed set
2238 // or can be variables declared using JMESPath.
2239 value?: null | bool | number | string | [...] | {...}
2240 }]
2241 ...
2242 }
2243 }]
2244
2245 // Manifest specifies conditions for manifest verification
2246 manifests?: {
2247 // AnnotationDomain is custom domain of annotation for message and signature.
2248 // Default is "cosign.sigstore.dev".
2249 annotationDomain?: string
2250
2251 // Attestors specified the required attestors (i.e. authorities)
2252 attestors?: [...{
2253 // Count specifies the required number of entries that must match. If the count
2254 // is null, all entries must match
2255 // (a logical AND). If the count is 1, at least one entry must match (a logical
2256 // OR). If the count contains a
2257 // value N, then N must be less than or equal to the size of entries, and at
2258 // least N entries must match.
2259 count?: int & >=1
2260
2261 // Entries contains the available attestors. An attestor can be a static key,
2262 // attributes for keyless verification, or a nested attestor declaration.
2263 entries?: [...{
2264 // Annotations are used for image verification.
2265 // Every specified key-value pair must exist and match in the verified payload.
2266 // The payload may contain other key-value pairs.
2267 annotations?: [string]: string
2268
2269 // Attestor is a nested set of Attestor used to specify a more complex set of match authorities.
2270 attestor?: null | bool | number | string | [...] | {...}
2271
2272 // Certificates specifies one or more certificates.
2273 certificates?: {
2274 // Cert is an optional PEM-encoded public certificate.
2275 cert?: string
2276
2277 // CertChain is an optional PEM encoded set of certificates used to verify.
2278 certChain?: string
2279
2280 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2281 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2282 ctlog?: {
2283 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2284 // to check for a certificate
2285 // timestamp. Default is false. Set to true if this was opted out during signing.
2286 ignoreSCT?: bool
2287
2288 // PubKey, if set, is used to validate SCTs against a custom source.
2289 pubkey?: string
2290
2291 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2292 // RFC3161 timestamp authority. Must
2293 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2294 // may contain the leaf TSA certificate if not present in the timestamurce.
2295 tsaCertChain?: string
2296 }
2297
2298 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2299 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2300 rekor?: {
2301 // IgnoreTlog skips transparency log verification.
2302 ignoreTlog?: bool
2303
2304 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2305 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2306 pubkey?: string
2307
2308 // URL is the address of the transparency log. Defaults to the public Rekor log
2309 // instance https://rekor.sigstore.dev.
2310 url?: string
2311 }
2312 }
2313
2314 // Keyless is a set of attribute used to verify a Sigstore keyless attestor.
2315 // See https://github.com/sigstore/cosign/blob/main/KEYLESS.md.
2316 keyless?: {
2317 // AdditionalExtensions are certificate-extensions used for keyless signing.
2318 additionalExtensions?: [string]: string
2319
2320 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2321 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2322 ctlog?: {
2323 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2324 // to check for a certificate
2325 // timestamp. Default is false. Set to true if this was opted out during signing.
2326 ignoreSCT?: bool
2327
2328 // PubKey, if set, is used to validate SCTs against a custom source.
2329 pubkey?: string
2330
2331 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2332 // RFC3161 timestamp authority. Must
2333 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2334 // may contain the leaf TSA certificate if not present in the timestamurce.
2335 tsaCertChain?: string
2336 }
2337
2338 // Issuer is the certificate issuer used for keyless signing.
2339 issuer?: string
2340
2341 // IssuerRegExp is the regular expression to match certificate issuer used for keyless signing.
2342 issuerRegExp?: string
2343
2344 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2345 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2346 rekor?: {
2347 // IgnoreTlog skips transparency log verification.
2348 ignoreTlog?: bool
2349
2350 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2351 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2352 pubkey?: string
2353
2354 // URL is the address of the transparency log. Defaults to the public Rekor log
2355 // instance https://rekor.sigstore.dev.
2356 url?: string
2357 }
2358
2359 // Roots is an optional set of PEM encoded trusted root certificates.
2360 // If not provided, the system roots are used.
2361 roots?: string
2362
2363 // Subject is the verified identity used for keyless signing, for example the email address.
2364 subject?: string
2365
2366 // SubjectRegExp is the regular expression to match identity used for keyless
2367 // signing, for example the email address.
2368 subjectRegExp?: string
2369 }
2370
2371 // Keys specifies one or more public keys.
2372 keys?: {
2373 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2374 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2375 ctlog?: {
2376 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2377 // to check for a certificate
2378 // timestamp. Default is false. Set to true if this was opted out during signing.
2379 ignoreSCT?: bool
2380
2381 // PubKey, if set, is used to validate SCTs against a custom source.
2382 pubkey?: string
2383
2384 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2385 // RFC3161 timestamp authority. Must
2386 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2387 // may contain the leaf TSA certificate if not present in the timestamurce.
2388 tsaCertChain?: string
2389 }
2390
2391 // KMS provides the URI to the public key stored in a Key Management System. See:
2392 // https://github.com/sigstore/cosign/blob/main/KMS.md
2393 kms?: string
2394
2395 // Keys is a set of X.509 public keys used to verify image signatures. The keys can be directly
2396 // specified or can be a variable reference to a key specified in a ConfigMap (see
2397 // https://kyverno.io/docs/writing-policies/variables/), or reference a standard Kubernetes Secret
2398 // elsewhere in the cluster by specifying it in the format "k8s://<namespace>/<secret_name>".
2399 // The named Secret must specify a key `cosign.pub` containing the public key used for
2400 // verification, (see https://github.com/sigstore/cosign/blob/main/KMS.md#kubernetes-secret).
2401 // When multiple keys are specified each key is processed as a separate staticKey entry
2402 // (.attestors[*].entries.keys) within the set of attestors and the count is
2403 // applied across the keys.
2404 publicKeys?: string
2405
2406 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2407 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2408 rekor?: {
2409 // IgnoreTlog skips transparency log verification.
2410 ignoreTlog?: bool
2411
2412 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2413 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2414 pubkey?: string
2415
2416 // URL is the address of the transparency log. Defaults to the public Rekor log
2417 // instance https://rekor.sigstore.dev.
2418 url?: string
2419 }
2420
2421 // Reference to a Secret resource that contains a public key
2422 secret?: {
2423 // Name of the secret. The provided secret must contain a key named cosign.pub.
2424 name!: string
2425
2426 // Namespace name where the Secret exists.
2427 namespace!: string
2428 }
2429
2430 // Deprecated. Use attestor.signatureAlgorithm instead.
2431 signatureAlgorithm?: string
2432 }
2433
2434 // Repository is an optional alternate OCI repository to use for signatures and
2435 // attestations that match this rule.
2436 // If specified Repository will override other OCI image repository locations for this Attestor.
2437 repository?: string
2438
2439 // Specify signature algorithm for public keys. Supported values are sha224,
2440 // sha256, sha384 and sha512.
2441 signatureAlgorithm?: string
2442 }]
2443 }]
2444
2445 // DryRun configuration
2446 dryRun?: {
2447 enable?: bool
2448 namespace?: string
2449 }
2450
2451 // Fields which will be ignored while comparing manifests.
2452 ignoreFields?: [...{
2453 fields?: [...string]
2454 objects?: [...{
2455 group?: string
2456 kind?: string
2457 name?: string
2458 namespace?: string
2459 version?: string
2460 }]
2461 }]
2462
2463 // Repository is an optional alternate OCI repository to use for resource bundle reference.
2464 // The repository can be overridden per Attestor or Attestation.
2465 repository?: string
2466 }
2467
2468 // Message specifies a custom message to be displayed on failure.
2469 message?: string
2470
2471 // Pattern specifies an overlay-style pattern used to check resources.
2472 pattern?: null | bool | number | string | [...] | {...}
2473
2474 // PodSecurity applies exemptions for Kubernetes Pod Security admission
2475 // by specifying exclusions for Pod Security Standards controls.
2476 podSecurity?: {
2477 // Exclude specifies the Pod Security Standard controls to be excluded.
2478 exclude?: [...{
2479 // ControlName specifies the name of the Pod Security Standard control.
2480 // See: https://kubernetes.io/docs/concepts/security/pod-security-standards/
2481 controlName!: "HostProcess" |
2482 "Host Namespaces" |
2483 "Privileged Containers" |
2484 "Capabilities" |
2485 "HostPath Volumes" |
2486 "Host Ports" |
2487 "AppArmor" |
2488 "SELinux" |
2489 "/proc Mount Type" |
2490 "Seccomp" |
2491 "Sysctls" |
2492 "Volume Types" |
2493 "Privilege Escalation" |
2494 "Running as Non-root" |
2495 "Running as Non-root user"
2496
2497 // Images selects matching containers and applies the container level PSS.
2498 // Each image is the image name consisting of the registry address, repository, image, and tag.
2499 // Empty list matches no containers, PSS checks are applied at the pod level only.
2500 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
2501 images?: [...string]
2502
2503 // RestrictedField selects the field for the given Pod Security Standard control.
2504 // When not set, all restricted fields for the control are selected.
2505 restrictedField?: string
2506
2507 // Values defines the allowed values that can be excluded.
2508 values?: [...string]
2509 }]
2510
2511 // Level defines the Pod Security Standard level to be applied to workloads.
2512 // Allowed values are privileged, baseline, and restricted.
2513 level?: "privileged" | "baseline" | "restricted"
2514
2515 // Version defines the Pod Security Standard versions that Kubernetes supports.
2516 // Allowed values are v1.19, v1.20, v1.21, v1.22, v1.23, v1.24, v1.25, v1.26,
2517 // v1.27, v1.28, v1.29, v1.30, v1.31, v1.32, latest. Defaults to latest.
2518 version?: "v1.19" |
2519 "v1.20" |
2520 "v1.21" |
2521 "v1.22" |
2522 "v1.23" |
2523 "v1.24" |
2524 "v1.25" |
2525 "v1.26" |
2526 "v1.27" |
2527 "v1.28" |
2528 "v1.29" |
2529 "v1.30" |
2530 "v1.31" |
2531 "v1.32" |
2532 "latest"
2533 }
2534 }
2535
2536 // VerifyImages is used to verify image signatures and mutate them to add a digest
2537 verifyImages?: [...{
2538 // Attestations are optional checks for signed in-toto Statements used to verify the image.
2539 // See https://github.com/in-toto/attestation. Kyverno fetches signed attestations from the
2540 // OCI registry and decodes them into a list of Statement declarations.
2541 attestations?: [...{
2542 // Attestors specify the required attestors (i.e. authorities).
2543 attestors?: [...{
2544 // Count specifies the required number of entries that must match. If the count
2545 // is null, all entries must match
2546 // (a logical AND). If the count is 1, at least one entry must match (a logical
2547 // OR). If the count contains a
2548 // value N, then N must be less than or equal to the size of entries, and at
2549 // least N entries must match.
2550 count?: int & >=1
2551
2552 // Entries contains the available attestors. An attestor can be a static key,
2553 // attributes for keyless verification, or a nested attestor declaration.
2554 entries?: [...{
2555 // Annotations are used for image verification.
2556 // Every specified key-value pair must exist and match in the verified payload.
2557 // The payload may contain other key-value pairs.
2558 annotations?: [string]: string
2559
2560 // Attestor is a nested set of Attestor used to specify a more complex set of match authorities.
2561 attestor?: null | bool | number | string | [...] | {...}
2562
2563 // Certificates specifies one or more certificates.
2564 certificates?: {
2565 // Cert is an optional PEM-encoded public certificate.
2566 cert?: string
2567
2568 // CertChain is an optional PEM encoded set of certificates used to verify.
2569 certChain?: string
2570
2571 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2572 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2573 ctlog?: {
2574 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2575 // to check for a certificate
2576 // timestamp. Default is false. Set to true if this was opted out during signing.
2577 ignoreSCT?: bool
2578
2579 // PubKey, if set, is used to validate SCTs against a custom source.
2580 pubkey?: string
2581
2582 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2583 // RFC3161 timestamp authority. Must
2584 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2585 // may contain the leaf TSA certificate if not present in the timestamurce.
2586 tsaCertChain?: string
2587 }
2588
2589 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2590 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2591 rekor?: {
2592 // IgnoreTlog skips transparency log verification.
2593 ignoreTlog?: bool
2594
2595 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2596 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2597 pubkey?: string
2598
2599 // URL is the address of the transparency log. Defaults to the public Rekor log
2600 // instance https://rekor.sigstore.dev.
2601 url?: string
2602 }
2603 }
2604
2605 // Keyless is a set of attribute used to verify a Sigstore keyless attestor.
2606 // See https://github.com/sigstore/cosign/blob/main/KEYLESS.md.
2607 keyless?: {
2608 // AdditionalExtensions are certificate-extensions used for keyless signing.
2609 additionalExtensions?: [string]: string
2610
2611 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2612 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2613 ctlog?: {
2614 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2615 // to check for a certificate
2616 // timestamp. Default is false. Set to true if this was opted out during signing.
2617 ignoreSCT?: bool
2618
2619 // PubKey, if set, is used to validate SCTs against a custom source.
2620 pubkey?: string
2621
2622 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2623 // RFC3161 timestamp authority. Must
2624 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2625 // may contain the leaf TSA certificate if not present in the timestamurce.
2626 tsaCertChain?: string
2627 }
2628
2629 // Issuer is the certificate issuer used for keyless signing.
2630 issuer?: string
2631
2632 // IssuerRegExp is the regular expression to match certificate issuer used for keyless signing.
2633 issuerRegExp?: string
2634
2635 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2636 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2637 rekor?: {
2638 // IgnoreTlog skips transparency log verification.
2639 ignoreTlog?: bool
2640
2641 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2642 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2643 pubkey?: string
2644
2645 // URL is the address of the transparency log. Defaults to the public Rekor log
2646 // instance https://rekor.sigstore.dev.
2647 url?: string
2648 }
2649
2650 // Roots is an optional set of PEM encoded trusted root certificates.
2651 // If not provided, the system roots are used.
2652 roots?: string
2653
2654 // Subject is the verified identity used for keyless signing, for example the email address.
2655 subject?: string
2656
2657 // SubjectRegExp is the regular expression to match identity used for keyless
2658 // signing, for example the email address.
2659 subjectRegExp?: string
2660 }
2661
2662 // Keys specifies one or more public keys.
2663 keys?: {
2664 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2665 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2666 ctlog?: {
2667 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2668 // to check for a certificate
2669 // timestamp. Default is false. Set to true if this was opted out during signing.
2670 ignoreSCT?: bool
2671
2672 // PubKey, if set, is used to validate SCTs against a custom source.
2673 pubkey?: string
2674
2675 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2676 // RFC3161 timestamp authority. Must
2677 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2678 // may contain the leaf TSA certificate if not present in the timestamurce.
2679 tsaCertChain?: string
2680 }
2681
2682 // KMS provides the URI to the public key stored in a Key Management System. See:
2683 // https://github.com/sigstore/cosign/blob/main/KMS.md
2684 kms?: string
2685
2686 // Keys is a set of X.509 public keys used to verify image signatures. The keys can be directly
2687 // specified or can be a variable reference to a key specified in a ConfigMap (see
2688 // https://kyverno.io/docs/writing-policies/variables/), or reference a standard Kubernetes Secret
2689 // elsewhere in the cluster by specifying it in the format "k8s://<namespace>/<secret_name>".
2690 // The named Secret must specify a key `cosign.pub` containing the public key used for
2691 // verification, (see https://github.com/sigstore/cosign/blob/main/KMS.md#kubernetes-secret).
2692 // When multiple keys are specified each key is processed as a separate staticKey entry
2693 // (.attestors[*].entries.keys) within the set of attestors and the count is
2694 // applied across the keys.
2695 publicKeys?: string
2696
2697 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2698 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2699 rekor?: {
2700 // IgnoreTlog skips transparency log verification.
2701 ignoreTlog?: bool
2702
2703 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2704 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2705 pubkey?: string
2706
2707 // URL is the address of the transparency log. Defaults to the public Rekor log
2708 // instance https://rekor.sigstore.dev.
2709 url?: string
2710 }
2711
2712 // Reference to a Secret resource that contains a public key
2713 secret?: {
2714 // Name of the secret. The provided secret must contain a key named cosign.pub.
2715 name!: string
2716
2717 // Namespace name where the Secret exists.
2718 namespace!: string
2719 }
2720
2721 // Deprecated. Use attestor.signatureAlgorithm instead.
2722 signatureAlgorithm?: string
2723 }
2724
2725 // Repository is an optional alternate OCI repository to use for signatures and
2726 // attestations that match this rule.
2727 // If specified Repository will override other OCI image repository locations for this Attestor.
2728 repository?: string
2729
2730 // Specify signature algorithm for public keys. Supported values are sha224,
2731 // sha256, sha384 and sha512.
2732 signatureAlgorithm?: string
2733 }]
2734 }]
2735
2736 // Conditions are used to verify attributes within a Predicate. If no Conditions are specified
2737 // the attestation check is satisfied as long there are predicates that match the predicate type.
2738 conditions?: [...{
2739 // AllConditions enable variable-based conditional rule execution. This is useful for
2740 // finer control of when an rule is applied. A condition can reference object data
2741 // using JMESPath notation.
2742 // Here, all of the conditions need to pass
2743 all?: [...{
2744 // Key is the context entry (using JMESPath) for conditional rule evaluation.
2745 key?: null | bool | number | string | [...] | {...}
2746
2747 // Message is an optional display message
2748 message?: string
2749
2750 // Operator is the conditional operation to perform. Valid operators are:
2751 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
2752 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
2753 // DurationLessThanOrEquals, DurationLessThan
2754 operator?: "Equals" |
2755 "NotEquals" |
2756 "In" |
2757 "AnyIn" |
2758 "AllIn" |
2759 "NotIn" |
2760 "AnyNotIn" |
2761 "AllNotIn" |
2762 "GreaterThanOrEquals" |
2763 "GreaterThan" |
2764 "LessThanOrEquals" |
2765 "LessThan" |
2766 "DurationGreaterThanOrEquals" |
2767 "DurationGreaterThan" |
2768 "DurationLessThanOrEquals" |
2769 "DurationLessThan"
2770
2771 // Value is the conditional value, or set of values. The values can be fixed set
2772 // or can be variables declared using JMESPath.
2773 value?: null | bool | number | string | [...] | {...}
2774 }]
2775
2776 // AnyConditions enable variable-based conditional rule execution. This is useful for
2777 // finer control of when an rule is applied. A condition can reference object data
2778 // using JMESPath notation.
2779 // Here, at least one of the conditions need to pass
2780 any?: [...{
2781 // Key is the context entry (using JMESPath) for conditional rule evaluation.
2782 key?: null | bool | number | string | [...] | {...}
2783
2784 // Message is an optional display message
2785 message?: string
2786
2787 // Operator is the conditional operation to perform. Valid operators are:
2788 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
2789 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
2790 // DurationLessThanOrEquals, DurationLessThan
2791 operator?: "Equals" |
2792 "NotEquals" |
2793 "In" |
2794 "AnyIn" |
2795 "AllIn" |
2796 "NotIn" |
2797 "AnyNotIn" |
2798 "AllNotIn" |
2799 "GreaterThanOrEquals" |
2800 "GreaterThan" |
2801 "LessThanOrEquals" |
2802 "LessThan" |
2803 "DurationGreaterThanOrEquals" |
2804 "DurationGreaterThan" |
2805 "DurationLessThanOrEquals" |
2806 "DurationLessThan"
2807
2808 // Value is the conditional value, or set of values. The values can be fixed set
2809 // or can be variables declared using JMESPath.
2810 value?: null | bool | number | string | [...] | {...}
2811 }]
2812 }]
2813
2814 // Name is the variable name.
2815 name?: string
2816
2817 // Deprecated in favour of 'Type', to be removed soon
2818 predicateType?: string
2819
2820 // Type defines the type of attestation contained within the Statement.
2821 type?: string
2822 }]
2823
2824 // Attestors specified the required attestors (i.e. authorities)
2825 attestors?: [...{
2826 // Count specifies the required number of entries that must match. If the count
2827 // is null, all entries must match
2828 // (a logical AND). If the count is 1, at least one entry must match (a logical
2829 // OR). If the count contains a
2830 // value N, then N must be less than or equal to the size of entries, and at
2831 // least N entries must match.
2832 count?: int & >=1
2833
2834 // Entries contains the available attestors. An attestor can be a static key,
2835 // attributes for keyless verification, or a nested attestor declaration.
2836 entries?: [...{
2837 // Annotations are used for image verification.
2838 // Every specified key-value pair must exist and match in the verified payload.
2839 // The payload may contain other key-value pairs.
2840 annotations?: [string]: string
2841
2842 // Attestor is a nested set of Attestor used to specify a more complex set of match authorities.
2843 attestor?: null | bool | number | string | [...] | {...}
2844
2845 // Certificates specifies one or more certificates.
2846 certificates?: {
2847 // Cert is an optional PEM-encoded public certificate.
2848 cert?: string
2849
2850 // CertChain is an optional PEM encoded set of certificates used to verify.
2851 certChain?: string
2852
2853 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2854 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2855 ctlog?: {
2856 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2857 // to check for a certificate
2858 // timestamp. Default is false. Set to true if this was opted out during signing.
2859 ignoreSCT?: bool
2860
2861 // PubKey, if set, is used to validate SCTs against a custom source.
2862 pubkey?: string
2863
2864 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2865 // RFC3161 timestamp authority. Must
2866 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2867 // may contain the leaf TSA certificate if not present in the timestamurce.
2868 tsaCertChain?: string
2869 }
2870
2871 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2872 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2873 rekor?: {
2874 // IgnoreTlog skips transparency log verification.
2875 ignoreTlog?: bool
2876
2877 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2878 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2879 pubkey?: string
2880
2881 // URL is the address of the transparency log. Defaults to the public Rekor log
2882 // instance https://rekor.sigstore.dev.
2883 url?: string
2884 }
2885 }
2886
2887 // Keyless is a set of attribute used to verify a Sigstore keyless attestor.
2888 // See https://github.com/sigstore/cosign/blob/main/KEYLESS.md.
2889 keyless?: {
2890 // AdditionalExtensions are certificate-extensions used for keyless signing.
2891 additionalExtensions?: [string]: string
2892
2893 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2894 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2895 ctlog?: {
2896 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2897 // to check for a certificate
2898 // timestamp. Default is false. Set to true if this was opted out during signing.
2899 ignoreSCT?: bool
2900
2901 // PubKey, if set, is used to validate SCTs against a custom source.
2902 pubkey?: string
2903
2904 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2905 // RFC3161 timestamp authority. Must
2906 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2907 // may contain the leaf TSA certificate if not present in the timestamurce.
2908 tsaCertChain?: string
2909 }
2910
2911 // Issuer is the certificate issuer used for keyless signing.
2912 issuer?: string
2913
2914 // IssuerRegExp is the regular expression to match certificate issuer used for keyless signing.
2915 issuerRegExp?: string
2916
2917 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2918 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2919 rekor?: {
2920 // IgnoreTlog skips transparency log verification.
2921 ignoreTlog?: bool
2922
2923 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2924 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2925 pubkey?: string
2926
2927 // URL is the address of the transparency log. Defaults to the public Rekor log
2928 // instance https://rekor.sigstore.dev.
2929 url?: string
2930 }
2931
2932 // Roots is an optional set of PEM encoded trusted root certificates.
2933 // If not provided, the system roots are used.
2934 roots?: string
2935
2936 // Subject is the verified identity used for keyless signing, for example the email address.
2937 subject?: string
2938
2939 // SubjectRegExp is the regular expression to match identity used for keyless
2940 // signing, for example the email address.
2941 subjectRegExp?: string
2942 }
2943
2944 // Keys specifies one or more public keys.
2945 keys?: {
2946 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
2947 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
2948 ctlog?: {
2949 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
2950 // to check for a certificate
2951 // timestamp. Default is false. Set to true if this was opted out during signing.
2952 ignoreSCT?: bool
2953
2954 // PubKey, if set, is used to validate SCTs against a custom source.
2955 pubkey?: string
2956
2957 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
2958 // RFC3161 timestamp authority. Must
2959 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
2960 // may contain the leaf TSA certificate if not present in the timestamurce.
2961 tsaCertChain?: string
2962 }
2963
2964 // KMS provides the URI to the public key stored in a Key Management System. See:
2965 // https://github.com/sigstore/cosign/blob/main/KMS.md
2966 kms?: string
2967
2968 // Keys is a set of X.509 public keys used to verify image signatures. The keys can be directly
2969 // specified or can be a variable reference to a key specified in a ConfigMap (see
2970 // https://kyverno.io/docs/writing-policies/variables/), or reference a standard Kubernetes Secret
2971 // elsewhere in the cluster by specifying it in the format "k8s://<namespace>/<secret_name>".
2972 // The named Secret must specify a key `cosign.pub` containing the public key used for
2973 // verification, (see https://github.com/sigstore/cosign/blob/main/KMS.md#kubernetes-secret).
2974 // When multiple keys are specified each key is processed as a separate staticKey entry
2975 // (.attestors[*].entries.keys) within the set of attestors and the count is
2976 // applied across the keys.
2977 publicKeys?: string
2978
2979 // Rekor provides configuration for the Rekor transparency log service. If an empty object
2980 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
2981 rekor?: {
2982 // IgnoreTlog skips transparency log verification.
2983 ignoreTlog?: bool
2984
2985 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
2986 // If set, this will be used to validate transparency log signatures from a custom Rekor.
2987 pubkey?: string
2988
2989 // URL is the address of the transparency log. Defaults to the public Rekor log
2990 // instance https://rekor.sigstore.dev.
2991 url?: string
2992 }
2993
2994 // Reference to a Secret resource that contains a public key
2995 secret?: {
2996 // Name of the secret. The provided secret must contain a key named cosign.pub.
2997 name!: string
2998
2999 // Namespace name where the Secret exists.
3000 namespace!: string
3001 }
3002
3003 // Deprecated. Use attestor.signatureAlgorithm instead.
3004 signatureAlgorithm?: string
3005 }
3006
3007 // Repository is an optional alternate OCI repository to use for signatures and
3008 // attestations that match this rule.
3009 // If specified Repository will override other OCI image repository locations for this Attestor.
3010 repository?: string
3011
3012 // Specify signature algorithm for public keys. Supported values are sha224,
3013 // sha256, sha384 and sha512.
3014 signatureAlgorithm?: string
3015 }]
3016 }]
3017
3018 // Allowed values are Audit or Enforce.
3019 failureAction?: "Audit" | "Enforce"
3020
3021 // ImageReferences is a list of matching image reference patterns. At least one pattern in the
3022 // list must match the image for the rule to apply. Each image reference consists of a registry
3023 // address (defaults to docker.io), repository, image, and tag (defaults to latest).
3024 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
3025 imageReferences?: [...string]
3026
3027 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
3028 imageRegistryCredentials?: {
3029 // AllowInsecureRegistry allows insecure access to a registry.
3030 allowInsecureRegistry?: bool
3031
3032 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
3033 // It can be of one of these values: default,google,azure,amazon,github.
3034 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
3035
3036 // Secrets specifies a list of secrets that are provided for credentials.
3037 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
3038 // imagePullSecrets from the resource namespace are also used.
3039 secrets?: [...string]
3040 }
3041
3042 // MutateDigest enables replacement of image tags with digests.
3043 // Defaults to true.
3044 mutateDigest?: bool
3045
3046 // Repository is an optional alternate OCI repository to use for image
3047 // signatures and attestations that match this rule.
3048 // If specified Repository will override the default OCI image repository
3049 // configured for the installation.
3050 // The repository can also be overridden per Attestor or Attestation.
3051 repository?: string
3052
3053 // Required validates that images are verified i.e. have matched passed a
3054 // signature or attestation check.
3055 required?: bool
3056
3057 // SkipImageReferences is a list of matching image reference patterns that should be skipped.
3058 // At least one pattern in the list must match the image for the rule to be
3059 // skipped. Each image reference
3060 // consists of a registry address (defaults to docker.io), repository, image,
3061 // and tag (defaults to latest).
3062 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
3063 skipImageReferences?: [...string]
3064
3065 // Type specifies the method of signature validation. The allowed options
3066 // are Cosign and Notary. By default Cosign is used if a type is not specified.
3067 type?: "Cosign" | "SigstoreBundle" | "Notary"
3068
3069 // UseCache enables caching of image verify responses for this rule
3070 useCache?: bool
3071
3072 // Validation checks conditions across multiple image
3073 // verification attestations or context entries
3074 validate?: {
3075 // Deny defines conditions used to pass or fail a validation rule.
3076 deny?: {
3077 // Multiple conditions can be declared under an `any` or `all` statement. A direct list
3078 // of conditions (without `any` or `all` statements) is also supported for backwards compatibility
3079 // but will be deprecated in the next major release.
3080 // See: https://kyverno.io/docs/writing-policies/validate/#deny-rules
3081 conditions?: null | bool | number | string | [...] | {...}
3082 }
3083
3084 // Message specifies a custom message to be displayed on failure.
3085 message?: string
3086 }
3087
3088 // VerifyDigest validates that images have a digest.
3089 verifyDigest?: bool
3090 }]
3091 }]
3092
3093 // Deprecated.
3094 schemaValidation?: bool
3095
3096 // UseServerSideApply controls whether to use server-side apply for generate rules
3097 // If is set to "true" create & update for generate rules will use apply instead of create/update.
3098 // Defaults to "false" if not specified.
3099 useServerSideApply?: bool
3100
3101 // Deprecated, use validationFailureAction under the validate rule instead.
3102 validationFailureAction?: "audit" | "enforce" | "Audit" | "Enforce"
3103
3104 // Deprecated, use validationFailureActionOverrides under the validate rule instead.
3105 validationFailureActionOverrides?: [...{
3106 // ValidationFailureAction defines the policy validation failure action
3107 action?: "audit" | "enforce" | "Audit" | "Enforce"
3108
3109 // A label selector is a label query over a set of resources. The result of matchLabels and
3110 // matchExpressions are ANDed. An empty label selector matches all objects. A null
3111 // label selector matches no objects.
3112 namespaceSelector?: {
3113 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3114 matchExpressions?: [...{
3115 // key is the label key that the selector applies to.
3116 key!: string
3117
3118 // operator represents a key's relationship to a set of values.
3119 // Valid operators are In, NotIn, Exists and DoesNotExist.
3120 operator!: string
3121
3122 // values is an array of string values. If the operator is In or NotIn,
3123 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3124 // the values array must be empty. This array is replaced during a strategic
3125 // merge patch.
3126 values?: [...string]
3127 }]
3128
3129 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3130 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3131 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3132 matchLabels?: [string]: string
3133 }
3134 namespaces?: [...string]
3135 }]
3136
3137 // WebhookConfiguration specifies the custom configuration for Kubernetes
3138 // admission webhookconfiguration.
3139 webhookConfiguration?: {
3140 // FailurePolicy defines how unexpected policy errors and webhook response
3141 // timeout errors are handled.
3142 // Rules within the same policy share the same failure behavior.
3143 // This field should not be accessed directly, instead `GetFailurePolicy()` should be used.
3144 // Allowed values are Ignore or Fail. Defaults to Fail.
3145 failurePolicy?: "Ignore" | "Fail"
3146
3147 // MatchCondition configures admission webhook matchConditions.
3148 // Requires Kubernetes 1.27 or later.
3149 matchConditions?: [...{
3150 // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool.
3151 // CEL expressions have access to the contents of the AdmissionRequest and
3152 // Authorizer, organized into CEL variables:
3153 //
3154 // 'object' - The object from the incoming request. The value is null for DELETE requests.
3155 // 'oldObject' - The existing object. The value is null for CREATE requests.
3156 // 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest).
3157 // 'authorizer' - A CEL Authorizer. May be used to perform authorization checks
3158 // for the principal (user or service account) of the request.
3159 // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
3160 // 'authorizer.requestResource' - A CEL ResourceCheck constructed from the
3161 // 'authorizer' and configured with the
3162 // request resource.
3163 // Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
3164 //
3165 // Required.
3166 expression!: string
3167
3168 // Name is an identifier for this match condition, used for strategic merging of MatchConditions,
3169 // as well as providing an identifier for logging purposes. A good name should be descriptive of
3170 // the associated expression.
3171 // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and
3172 // must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or
3173 // '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an
3174 // optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')
3175 //
3176 // Required.
3177 name!: string
3178 }]
3179
3180 // TimeoutSeconds specifies the maximum time in seconds allowed to apply this policy.
3181 // After the configured time expires, the admission request may fail, or may
3182 // simply ignore the policy results,
3183 // based on the failure policy. The default timeout is 10s, the value must be
3184 // between 1 and 30 seconds.
3185 timeoutSeconds?: int32 & int
3186 }
3187
3188 // Deprecated, use webhookTimeoutSeconds under webhookConfiguration instead.
3189 webhookTimeoutSeconds?: int32 & int
3190 }
3191
3192 // Status contains policy runtime data.
3193 status?: {
3194 // AutogenStatus contains autogen status information.
3195 autogen?: {
3196 // Rules is a list of Rule instances. It contains auto generated rules added for pod controllers
3197 rules?: [...{
3198 // CELPreconditions are used to determine if a policy rule should be applied by evaluating a
3199 // set of CEL conditions. It can only be used with the validate.cel subrule
3200 celPreconditions?: [...{
3201 // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool.
3202 // CEL expressions have access to the contents of the AdmissionRequest and
3203 // Authorizer, organized into CEL variables:
3204 //
3205 // 'object' - The object from the incoming request. The value is null for DELETE requests.
3206 // 'oldObject' - The existing object. The value is null for CREATE requests.
3207 // 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest).
3208 // 'authorizer' - A CEL Authorizer. May be used to perform authorization checks
3209 // for the principal (user or service account) of the request.
3210 // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
3211 // 'authorizer.requestResource' - A CEL ResourceCheck constructed from the
3212 // 'authorizer' and configured with the
3213 // request resource.
3214 // Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
3215 //
3216 // Required.
3217 expression!: string
3218
3219 // Name is an identifier for this match condition, used for strategic merging of MatchConditions,
3220 // as well as providing an identifier for logging purposes. A good name should be descriptive of
3221 // the associated expression.
3222 // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and
3223 // must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or
3224 // '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an
3225 // optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')
3226 //
3227 // Required.
3228 name!: string
3229 }]
3230
3231 // Context defines variables and data sources that can be used during rule execution.
3232 context?: [...matchN(1, [
3233 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
3234 ]) & {
3235 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
3236 // The data returned is stored in the context with the name for the context entry.
3237 apiCall?: {
3238 // The data object specifies the POST data sent to the server.
3239 // Only applicable when the method field is set to POST.
3240 data?: [...{
3241 // Key is a unique identifier for the data value
3242 key!: string
3243
3244 // Value is the data value
3245 value!: null | bool | number | string | [...] | {...}
3246 }]
3247
3248 // Default is an optional arbitrary JSON object that the context
3249 // value is set to, if the apiCall returns error.
3250 default?: null | bool | number | string | [...] | {...}
3251
3252 // JMESPath is an optional JSON Match Expression that can be used to
3253 // transform the JSON response returned from the server. For example
3254 // a JMESPath of "items | length(@)" applied to the API server response
3255 // for the URLPath "/apis/apps/v1/deployments" will return the total count
3256 // of deployments across all namespaces.
3257 jmesPath?: string
3258
3259 // Method is the HTTP request type (GET or POST). Defaults to GET.
3260 method?: "GET" | "POST"
3261
3262 // Service is an API call to a JSON web service.
3263 // This is used for non-Kubernetes API server calls.
3264 // It's mutually exclusive with the URLPath field.
3265 service?: {
3266 // CABundle is a PEM encoded CA bundle which will be used to validate
3267 // the server certificate.
3268 caBundle?: string
3269
3270 // Headers is a list of optional HTTP headers to be included in the request.
3271 headers?: [...{
3272 // Key is the header key
3273 key!: string
3274
3275 // Value is the header value
3276 value!: string
3277 }]
3278
3279 // URL is the JSON web service URL. A typical form is
3280 // `https://{service}.{namespace}:{port}/{path}`.
3281 url!: string
3282 }
3283
3284 // URLPath is the URL path to be used in the HTTP GET or POST request to the
3285 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
3286 // The format required is the same format used by the `kubectl get --raw` command.
3287 // See
3288 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
3289 // for details.
3290 // It's mutually exclusive with the Service field.
3291 urlPath?: string
3292 }
3293
3294 // ConfigMap is the ConfigMap reference.
3295 configMap?: {
3296 // Name is the ConfigMap name.
3297 name!: string
3298
3299 // Namespace is the ConfigMap namespace.
3300 namespace?: string
3301 }
3302
3303 // GlobalContextEntryReference is a reference to a cached global context entry.
3304 globalReference?: {
3305 // JMESPath is an optional JSON Match Expression that can be used to
3306 // transform the JSON response returned from the server. For example
3307 // a JMESPath of "items | length(@)" applied to the API server response
3308 // for the URLPath "/apis/apps/v1/deployments" will return the total count
3309 // of deployments across all namespaces.
3310 jmesPath?: string
3311
3312 // Name of the global context entry
3313 name!: string
3314 }
3315
3316 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
3317 // details.
3318 imageRegistry?: {
3319 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
3320 imageRegistryCredentials?: {
3321 // AllowInsecureRegistry allows insecure access to a registry.
3322 allowInsecureRegistry?: bool
3323
3324 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
3325 // It can be of one of these values: default,google,azure,amazon,github.
3326 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
3327
3328 // Secrets specifies a list of secrets that are provided for credentials.
3329 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
3330 // imagePullSecrets from the resource namespace are also used.
3331 secrets?: [...string]
3332 }
3333
3334 // JMESPath is an optional JSON Match Expression that can be used to
3335 // transform the ImageData struct returned as a result of processing
3336 // the image reference.
3337 jmesPath?: string
3338
3339 // Reference is image reference to a container image in the registry.
3340 // Example: ghcr.io/kyverno/kyverno:latest
3341 reference!: string
3342 }
3343
3344 // Name is the variable name.
3345 name!: string
3346
3347 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
3348 variable?: {
3349 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
3350 // expression evaluates to nil
3351 default?: null | bool | number | string | [...] | {...}
3352
3353 // JMESPath is an optional JMESPath Expression that can be used to
3354 // transform the variable.
3355 jmesPath?: string
3356
3357 // Value is any arbitrary JSON object representable in YAML or JSON form.
3358 value?: null | bool | number | string | [...] | {...}
3359 }
3360 }]
3361
3362 // ExcludeResources defines when this policy rule should not be applied. The exclude
3363 // criteria can include resource information (e.g. kind, name, namespace, labels)
3364 // and admission review request information like the name or role.
3365 exclude?: matchN(0, [null | bool | number | string | [...] | {
3366 any!: _
3367 all!: _
3368 }]) & {
3369 // All allows specifying resources which will be ANDed
3370 all?: [...{
3371 // ClusterRoles is the list of cluster-wide role names for the user.
3372 clusterRoles?: [...string]
3373
3374 // ResourceDescription contains information about the resource being created or modified.
3375 resources?: matchN(0, [null | bool | number | string | [...] | {
3376 name!: _
3377 names!: _
3378 }]) & {
3379 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
3380 // and values support the wildcard characters "*" (matches zero or many characters) and
3381 // "?" (matches at least one character).
3382 annotations?: [string]: string
3383
3384 // Kinds is a list of resource kinds.
3385 kinds?: [...string]
3386
3387 // Name is the name of the resource. The name supports wildcard characters
3388 // "*" (matches zero or many characters) and "?" (at least one character).
3389 // NOTE: "Name" is being deprecated in favor of "Names".
3390 name?: string
3391
3392 // Names are the names of the resources. Each name supports wildcard characters
3393 // "*" (matches zero or many characters) and "?" (at least one character).
3394 names?: [...string]
3395
3396 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
3397 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
3398 // and `?` (matches one character).Wildcards allows writing label selectors like
3399 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
3400 // does not match an empty label set.
3401 namespaceSelector?: {
3402 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3403 matchExpressions?: [...{
3404 // key is the label key that the selector applies to.
3405 key!: string
3406
3407 // operator represents a key's relationship to a set of values.
3408 // Valid operators are In, NotIn, Exists and DoesNotExist.
3409 operator!: string
3410
3411 // values is an array of string values. If the operator is In or NotIn,
3412 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3413 // the values array must be empty. This array is replaced during a strategic
3414 // merge patch.
3415 values?: [...string]
3416 }]
3417
3418 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3419 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3420 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3421 matchLabels?: [string]: string
3422 }
3423
3424 // Namespaces is a list of namespaces names. Each name supports wildcard characters
3425 // "*" (matches zero or many characters) and "?" (at least one character).
3426 namespaces?: [...string]
3427
3428 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
3429 // are used to match a specific action.
3430 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
3431
3432 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
3433 // characters `*` (matches zero or many characters) and `?` (matches one character).
3434 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
3435 // using ["*" : "*"] matches any key and value but does not match an empty label set.
3436 selector?: {
3437 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3438 matchExpressions?: [...{
3439 // key is the label key that the selector applies to.
3440 key!: string
3441
3442 // operator represents a key's relationship to a set of values.
3443 // Valid operators are In, NotIn, Exists and DoesNotExist.
3444 operator!: string
3445
3446 // values is an array of string values. If the operator is In or NotIn,
3447 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3448 // the values array must be empty. This array is replaced during a strategic
3449 // merge patch.
3450 values?: [...string]
3451 }]
3452
3453 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3454 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3455 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3456 matchLabels?: [string]: string
3457 }
3458 }
3459
3460 // Roles is the list of namespaced role names for the user.
3461 roles?: [...string]
3462
3463 // Subjects is the list of subject names like users, user groups, and service accounts.
3464 subjects?: [...{
3465 // APIGroup holds the API group of the referenced subject.
3466 // Defaults to "" for ServiceAccount subjects.
3467 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
3468 apiGroup?: string
3469
3470 // Kind of object being referenced. Values defined by this API group are "User",
3471 // "Group", and "ServiceAccount".
3472 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
3473 kind!: string
3474
3475 // Name of the object being referenced.
3476 name!: string
3477
3478 // Namespace of the referenced object. If the object kind is non-namespace, such
3479 // as "User" or "Group", and this value is not empty
3480 // the Authorizer should report an error.
3481 namespace?: string
3482 }]
3483 }]
3484
3485 // Any allows specifying resources which will be ORed
3486 any?: [...{
3487 // ClusterRoles is the list of cluster-wide role names for the user.
3488 clusterRoles?: [...string]
3489
3490 // ResourceDescription contains information about the resource being created or modified.
3491 resources?: matchN(0, [null | bool | number | string | [...] | {
3492 name!: _
3493 names!: _
3494 }]) & {
3495 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
3496 // and values support the wildcard characters "*" (matches zero or many characters) and
3497 // "?" (matches at least one character).
3498 annotations?: [string]: string
3499
3500 // Kinds is a list of resource kinds.
3501 kinds?: [...string]
3502
3503 // Name is the name of the resource. The name supports wildcard characters
3504 // "*" (matches zero or many characters) and "?" (at least one character).
3505 // NOTE: "Name" is being deprecated in favor of "Names".
3506 name?: string
3507
3508 // Names are the names of the resources. Each name supports wildcard characters
3509 // "*" (matches zero or many characters) and "?" (at least one character).
3510 names?: [...string]
3511
3512 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
3513 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
3514 // and `?` (matches one character).Wildcards allows writing label selectors like
3515 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
3516 // does not match an empty label set.
3517 namespaceSelector?: {
3518 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3519 matchExpressions?: [...{
3520 // key is the label key that the selector applies to.
3521 key!: string
3522
3523 // operator represents a key's relationship to a set of values.
3524 // Valid operators are In, NotIn, Exists and DoesNotExist.
3525 operator!: string
3526
3527 // values is an array of string values. If the operator is In or NotIn,
3528 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3529 // the values array must be empty. This array is replaced during a strategic
3530 // merge patch.
3531 values?: [...string]
3532 }]
3533
3534 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3535 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3536 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3537 matchLabels?: [string]: string
3538 }
3539
3540 // Namespaces is a list of namespaces names. Each name supports wildcard characters
3541 // "*" (matches zero or many characters) and "?" (at least one character).
3542 namespaces?: [...string]
3543
3544 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
3545 // are used to match a specific action.
3546 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
3547
3548 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
3549 // characters `*` (matches zero or many characters) and `?` (matches one character).
3550 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
3551 // using ["*" : "*"] matches any key and value but does not match an empty label set.
3552 selector?: {
3553 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3554 matchExpressions?: [...{
3555 // key is the label key that the selector applies to.
3556 key!: string
3557
3558 // operator represents a key's relationship to a set of values.
3559 // Valid operators are In, NotIn, Exists and DoesNotExist.
3560 operator!: string
3561
3562 // values is an array of string values. If the operator is In or NotIn,
3563 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3564 // the values array must be empty. This array is replaced during a strategic
3565 // merge patch.
3566 values?: [...string]
3567 }]
3568
3569 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3570 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3571 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3572 matchLabels?: [string]: string
3573 }
3574 }
3575
3576 // Roles is the list of namespaced role names for the user.
3577 roles?: [...string]
3578
3579 // Subjects is the list of subject names like users, user groups, and service accounts.
3580 subjects?: [...{
3581 // APIGroup holds the API group of the referenced subject.
3582 // Defaults to "" for ServiceAccount subjects.
3583 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
3584 apiGroup?: string
3585
3586 // Kind of object being referenced. Values defined by this API group are "User",
3587 // "Group", and "ServiceAccount".
3588 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
3589 kind!: string
3590
3591 // Name of the object being referenced.
3592 name!: string
3593
3594 // Namespace of the referenced object. If the object kind is non-namespace, such
3595 // as "User" or "Group", and this value is not empty
3596 // the Authorizer should report an error.
3597 namespace?: string
3598 }]
3599 }]
3600
3601 // ClusterRoles is the list of cluster-wide role names for the user.
3602 clusterRoles?: [...string]
3603
3604 // ResourceDescription contains information about the resource being created or modified.
3605 // Requires at least one tag to be specified when under MatchResources.
3606 // Specifying ResourceDescription directly under match is being deprecated.
3607 // Please specify under "any" or "all" instead.
3608 resources?: matchN(0, [null | bool | number | string | [...] | {
3609 name!: _
3610 names!: _
3611 }]) & {
3612 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
3613 // and values support the wildcard characters "*" (matches zero or many characters) and
3614 // "?" (matches at least one character).
3615 annotations?: [string]: string
3616
3617 // Kinds is a list of resource kinds.
3618 kinds?: [...string]
3619
3620 // Name is the name of the resource. The name supports wildcard characters
3621 // "*" (matches zero or many characters) and "?" (at least one character).
3622 // NOTE: "Name" is being deprecated in favor of "Names".
3623 name?: string
3624
3625 // Names are the names of the resources. Each name supports wildcard characters
3626 // "*" (matches zero or many characters) and "?" (at least one character).
3627 names?: [...string]
3628
3629 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
3630 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
3631 // and `?` (matches one character).Wildcards allows writing label selectors like
3632 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
3633 // does not match an empty label set.
3634 namespaceSelector?: {
3635 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3636 matchExpressions?: [...{
3637 // key is the label key that the selector applies to.
3638 key!: string
3639
3640 // operator represents a key's relationship to a set of values.
3641 // Valid operators are In, NotIn, Exists and DoesNotExist.
3642 operator!: string
3643
3644 // values is an array of string values. If the operator is In or NotIn,
3645 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3646 // the values array must be empty. This array is replaced during a strategic
3647 // merge patch.
3648 values?: [...string]
3649 }]
3650
3651 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3652 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3653 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3654 matchLabels?: [string]: string
3655 }
3656
3657 // Namespaces is a list of namespaces names. Each name supports wildcard characters
3658 // "*" (matches zero or many characters) and "?" (at least one character).
3659 namespaces?: [...string]
3660
3661 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
3662 // are used to match a specific action.
3663 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
3664
3665 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
3666 // characters `*` (matches zero or many characters) and `?` (matches one character).
3667 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
3668 // using ["*" : "*"] matches any key and value but does not match an empty label set.
3669 selector?: {
3670 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3671 matchExpressions?: [...{
3672 // key is the label key that the selector applies to.
3673 key!: string
3674
3675 // operator represents a key's relationship to a set of values.
3676 // Valid operators are In, NotIn, Exists and DoesNotExist.
3677 operator!: string
3678
3679 // values is an array of string values. If the operator is In or NotIn,
3680 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3681 // the values array must be empty. This array is replaced during a strategic
3682 // merge patch.
3683 values?: [...string]
3684 }]
3685
3686 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3687 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3688 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3689 matchLabels?: [string]: string
3690 }
3691 }
3692
3693 // Roles is the list of namespaced role names for the user.
3694 roles?: [...string]
3695
3696 // Subjects is the list of subject names like users, user groups, and service accounts.
3697 subjects?: [...{
3698 // APIGroup holds the API group of the referenced subject.
3699 // Defaults to "" for ServiceAccount subjects.
3700 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
3701 apiGroup?: string
3702
3703 // Kind of object being referenced. Values defined by this API group are "User",
3704 // "Group", and "ServiceAccount".
3705 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
3706 kind!: string
3707
3708 // Name of the object being referenced.
3709 name!: string
3710
3711 // Namespace of the referenced object. If the object kind is non-namespace, such
3712 // as "User" or "Group", and this value is not empty
3713 // the Authorizer should report an error.
3714 namespace?: string
3715 }]
3716 }
3717
3718 // Generation is used to create new resources.
3719 generate?: {
3720 // APIVersion specifies resource apiVersion.
3721 apiVersion?: string
3722
3723 // Clone specifies the source resource used to populate each generated resource.
3724 // At most one of Data or Clone can be specified. If neither are provided, the generated
3725 // resource will be created with default data only.
3726 clone?: {
3727 // Name specifies name of the resource.
3728 name?: string
3729
3730 // Namespace specifies source resource namespace.
3731 namespace?: string
3732 }
3733
3734 // CloneList specifies the list of source resource used to populate each generated resource.
3735 cloneList?: {
3736 // Kinds is a list of resource kinds.
3737 kinds?: [...string]
3738
3739 // Namespace specifies source resource namespace.
3740 namespace?: string
3741
3742 // Selector is a label selector. Label keys and values in `matchLabels`.
3743 // wildcard characters are not supported.
3744 selector?: {
3745 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3746 matchExpressions?: [...{
3747 // key is the label key that the selector applies to.
3748 key!: string
3749
3750 // operator represents a key's relationship to a set of values.
3751 // Valid operators are In, NotIn, Exists and DoesNotExist.
3752 operator!: string
3753
3754 // values is an array of string values. If the operator is In or NotIn,
3755 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3756 // the values array must be empty. This array is replaced during a strategic
3757 // merge patch.
3758 values?: [...string]
3759 }]
3760
3761 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3762 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3763 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3764 matchLabels?: [string]: string
3765 }
3766 }
3767
3768 // Data provides the resource declaration used to populate each generated resource.
3769 // At most one of Data or Clone must be specified. If neither are provided, the generated
3770 // resource will be created with default data only.
3771 data?: null | bool | number | string | [...] | {...}
3772
3773 // ForEach applies generate rules to a list of sub-elements by creating a
3774 // context for each entry in the list and looping over it to apply the
3775 // specified logic.
3776 foreach?: [...{
3777 // APIVersion specifies resource apiVersion.
3778 apiVersion?: string
3779
3780 // Clone specifies the source resource used to populate each generated resource.
3781 // At most one of Data or Clone can be specified. If neither are provided, the generated
3782 // resource will be created with default data only.
3783 clone?: {
3784 // Name specifies name of the resource.
3785 name?: string
3786
3787 // Namespace specifies source resource namespace.
3788 namespace?: string
3789 }
3790
3791 // CloneList specifies the list of source resource used to populate each generated resource.
3792 cloneList?: {
3793 // Kinds is a list of resource kinds.
3794 kinds?: [...string]
3795
3796 // Namespace specifies source resource namespace.
3797 namespace?: string
3798
3799 // Selector is a label selector. Label keys and values in `matchLabels`.
3800 // wildcard characters are not supported.
3801 selector?: {
3802 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
3803 matchExpressions?: [...{
3804 // key is the label key that the selector applies to.
3805 key!: string
3806
3807 // operator represents a key's relationship to a set of values.
3808 // Valid operators are In, NotIn, Exists and DoesNotExist.
3809 operator!: string
3810
3811 // values is an array of string values. If the operator is In or NotIn,
3812 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
3813 // the values array must be empty. This array is replaced during a strategic
3814 // merge patch.
3815 values?: [...string]
3816 }]
3817
3818 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
3819 // map is equivalent to an element of matchExpressions, whose key field is "key", the
3820 // operator is "In", and the values array contains only "value". The requirements are ANDed.
3821 matchLabels?: [string]: string
3822 }
3823 }
3824
3825 // Context defines variables and data sources that can be used during rule execution.
3826 context?: [...matchN(1, [
3827 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
3828 ]) & {
3829 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
3830 // The data returned is stored in the context with the name for the context entry.
3831 apiCall?: {
3832 // The data object specifies the POST data sent to the server.
3833 // Only applicable when the method field is set to POST.
3834 data?: [...{
3835 // Key is a unique identifier for the data value
3836 key!: string
3837
3838 // Value is the data value
3839 value!: null | bool | number | string | [...] | {...}
3840 }]
3841
3842 // Default is an optional arbitrary JSON object that the context
3843 // value is set to, if the apiCall returns error.
3844 default?: null | bool | number | string | [...] | {...}
3845
3846 // JMESPath is an optional JSON Match Expression that can be used to
3847 // transform the JSON response returned from the server. For example
3848 // a JMESPath of "items | length(@)" applied to the API server response
3849 // for the URLPath "/apis/apps/v1/deployments" will return the total count
3850 // of deployments across all namespaces.
3851 jmesPath?: string
3852
3853 // Method is the HTTP request type (GET or POST). Defaults to GET.
3854 method?: "GET" | "POST"
3855
3856 // Service is an API call to a JSON web service.
3857 // This is used for non-Kubernetes API server calls.
3858 // It's mutually exclusive with the URLPath field.
3859 service?: {
3860 // CABundle is a PEM encoded CA bundle which will be used to validate
3861 // the server certificate.
3862 caBundle?: string
3863
3864 // Headers is a list of optional HTTP headers to be included in the request.
3865 headers?: [...{
3866 // Key is the header key
3867 key!: string
3868
3869 // Value is the header value
3870 value!: string
3871 }]
3872
3873 // URL is the JSON web service URL. A typical form is
3874 // `https://{service}.{namespace}:{port}/{path}`.
3875 url!: string
3876 }
3877
3878 // URLPath is the URL path to be used in the HTTP GET or POST request to the
3879 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
3880 // The format required is the same format used by the `kubectl get --raw` command.
3881 // See
3882 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
3883 // for details.
3884 // It's mutually exclusive with the Service field.
3885 urlPath?: string
3886 }
3887
3888 // ConfigMap is the ConfigMap reference.
3889 configMap?: {
3890 // Name is the ConfigMap name.
3891 name!: string
3892
3893 // Namespace is the ConfigMap namespace.
3894 namespace?: string
3895 }
3896
3897 // GlobalContextEntryReference is a reference to a cached global context entry.
3898 globalReference?: {
3899 // JMESPath is an optional JSON Match Expression that can be used to
3900 // transform the JSON response returned from the server. For example
3901 // a JMESPath of "items | length(@)" applied to the API server response
3902 // for the URLPath "/apis/apps/v1/deployments" will return the total count
3903 // of deployments across all namespaces.
3904 jmesPath?: string
3905
3906 // Name of the global context entry
3907 name!: string
3908 }
3909
3910 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
3911 // details.
3912 imageRegistry?: {
3913 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
3914 imageRegistryCredentials?: {
3915 // AllowInsecureRegistry allows insecure access to a registry.
3916 allowInsecureRegistry?: bool
3917
3918 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
3919 // It can be of one of these values: default,google,azure,amazon,github.
3920 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
3921
3922 // Secrets specifies a list of secrets that are provided for credentials.
3923 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
3924 // imagePullSecrets from the resource namespace are also used.
3925 secrets?: [...string]
3926 }
3927
3928 // JMESPath is an optional JSON Match Expression that can be used to
3929 // transform the ImageData struct returned as a result of processing
3930 // the image reference.
3931 jmesPath?: string
3932
3933 // Reference is image reference to a container image in the registry.
3934 // Example: ghcr.io/kyverno/kyverno:latest
3935 reference!: string
3936 }
3937
3938 // Name is the variable name.
3939 name!: string
3940
3941 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
3942 variable?: {
3943 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
3944 // expression evaluates to nil
3945 default?: null | bool | number | string | [...] | {...}
3946
3947 // JMESPath is an optional JMESPath Expression that can be used to
3948 // transform the variable.
3949 jmesPath?: string
3950
3951 // Value is any arbitrary JSON object representable in YAML or JSON form.
3952 value?: null | bool | number | string | [...] | {...}
3953 }
3954 }]
3955
3956 // Data provides the resource declaration used to populate each generated resource.
3957 // At most one of Data or Clone must be specified. If neither are provided, the generated
3958 // resource will be created with default data only.
3959 data?: null | bool | number | string | [...] | {...}
3960
3961 // Kind specifies resource kind.
3962 kind?: string
3963
3964 // List specifies a JMESPath expression that results in one or more elements
3965 // to which the validation logic is applied.
3966 list?: string
3967
3968 // Name specifies the resource name.
3969 name?: string
3970
3971 // Namespace specifies resource namespace.
3972 namespace?: string
3973
3974 // AnyAllConditions are used to determine if a policy rule should be applied by evaluating a
3975 // set of conditions. The declaration can contain nested `any` or `all` statements.
3976 // See: https://kyverno.io/docs/writing-policies/preconditions/
3977 preconditions?: {
3978 // AllConditions enable variable-based conditional rule execution. This is useful for
3979 // finer control of when an rule is applied. A condition can reference object data
3980 // using JMESPath notation.
3981 // Here, all of the conditions need to pass
3982 all?: [...{
3983 // Key is the context entry (using JMESPath) for conditional rule evaluation.
3984 key?: null | bool | number | string | [...] | {...}
3985
3986 // Message is an optional display message
3987 message?: string
3988
3989 // Operator is the conditional operation to perform. Valid operators are:
3990 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
3991 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
3992 // DurationLessThanOrEquals, DurationLessThan
3993 operator?: "Equals" |
3994 "NotEquals" |
3995 "In" |
3996 "AnyIn" |
3997 "AllIn" |
3998 "NotIn" |
3999 "AnyNotIn" |
4000 "AllNotIn" |
4001 "GreaterThanOrEquals" |
4002 "GreaterThan" |
4003 "LessThanOrEquals" |
4004 "LessThan" |
4005 "DurationGreaterThanOrEquals" |
4006 "DurationGreaterThan" |
4007 "DurationLessThanOrEquals" |
4008 "DurationLessThan"
4009
4010 // Value is the conditional value, or set of values. The values can be fixed set
4011 // or can be variables declared using JMESPath.
4012 value?: null | bool | number | string | [...] | {...}
4013 }]
4014
4015 // AnyConditions enable variable-based conditional rule execution. This is useful for
4016 // finer control of when an rule is applied. A condition can reference object data
4017 // using JMESPath notation.
4018 // Here, at least one of the conditions need to pass
4019 any?: [...{
4020 // Key is the context entry (using JMESPath) for conditional rule evaluation.
4021 key?: null | bool | number | string | [...] | {...}
4022
4023 // Message is an optional display message
4024 message?: string
4025
4026 // Operator is the conditional operation to perform. Valid operators are:
4027 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
4028 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
4029 // DurationLessThanOrEquals, DurationLessThan
4030 operator?: "Equals" |
4031 "NotEquals" |
4032 "In" |
4033 "AnyIn" |
4034 "AllIn" |
4035 "NotIn" |
4036 "AnyNotIn" |
4037 "AllNotIn" |
4038 "GreaterThanOrEquals" |
4039 "GreaterThan" |
4040 "LessThanOrEquals" |
4041 "LessThan" |
4042 "DurationGreaterThanOrEquals" |
4043 "DurationGreaterThan" |
4044 "DurationLessThanOrEquals" |
4045 "DurationLessThan"
4046
4047 // Value is the conditional value, or set of values. The values can be fixed set
4048 // or can be variables declared using JMESPath.
4049 value?: null | bool | number | string | [...] | {...}
4050 }]
4051 ...
4052 }
4053
4054 // UID specifies the resource uid.
4055 uid?: string
4056 }]
4057
4058 // GenerateExisting controls whether to trigger the rule in existing resources
4059 // If is set to "true" the rule will be triggered and applied to existing matched resources.
4060 generateExisting?: bool
4061
4062 // Kind specifies resource kind.
4063 kind?: string
4064
4065 // Name specifies the resource name.
4066 name?: string
4067
4068 // Namespace specifies resource namespace.
4069 namespace?: string
4070
4071 // OrphanDownstreamOnPolicyDelete controls whether generated resources should be
4072 // deleted when the rule that generated
4073 // them is deleted with synchronization enabled. This option is only applicable
4074 // to generate rules of the data type.
4075 // See https://kyverno.io/docs/writing-policies/generate/#data-examples.
4076 // Defaults to "false" if not specified.
4077 orphanDownstreamOnPolicyDelete?: bool
4078
4079 // Synchronize controls if generated resources should be kept in-sync with their source resource.
4080 // If Synchronize is set to "true" changes to generated resources will be overwritten with resource
4081 // data from Data or the resource specified in the Clone declaration.
4082 // Optional. Defaults to "false" if not specified.
4083 synchronize?: bool
4084
4085 // UID specifies the resource uid.
4086 uid?: string
4087 }
4088
4089 // ImageExtractors defines a mapping from kinds to ImageExtractorConfigs.
4090 // This config is only valid for verifyImages rules.
4091 imageExtractors?: [string]: [...{
4092 // JMESPath is an optional JMESPath expression to apply to the image value.
4093 // This is useful when the extracted image begins with a prefix like 'docker://'.
4094 // The 'trim_prefix' function may be used to trim the prefix: trim_prefix(@, 'docker://').
4095 // Note - Image digest mutation may not be used when applying a JMESPAth to an image.
4096 jmesPath?: string
4097
4098 // Key is an optional name of the field within 'path' that will be used to
4099 // uniquely identify an image.
4100 // Note - this field MUST be unique.
4101 key?: string
4102
4103 // Name is the entry the image will be available under 'images.<name>' in the context.
4104 // If this field is not defined, image entries will appear under 'images.custom'.
4105 name?: string
4106
4107 // Path is the path to the object containing the image field in a custom resource.
4108 // It should be slash-separated. Each slash-separated key must be a valid YAML
4109 // key or a wildcard '*'.
4110 // Wildcard keys are expanded in case of arrays or objects.
4111 path!: string
4112
4113 // Value is an optional name of the field within 'path' that points to the image URI.
4114 // This is useful when a custom 'key' is also defined.
4115 value?: string
4116 }]
4117
4118 // MatchResources defines when this policy rule should be applied. The match
4119 // criteria can include resource information (e.g. kind, name, namespace, labels)
4120 // and admission review request information like the user name or role.
4121 // At least one kind is required.
4122 match!: matchN(0, [null | bool | number | string | [...] | {
4123 any!: _
4124 all!: _
4125 }]) & {
4126 // All allows specifying resources which will be ANDed
4127 all?: [...{
4128 // ClusterRoles is the list of cluster-wide role names for the user.
4129 clusterRoles?: [...string]
4130
4131 // ResourceDescription contains information about the resource being created or modified.
4132 resources?: matchN(0, [null | bool | number | string | [...] | {
4133 name!: _
4134 names!: _
4135 }]) & {
4136 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
4137 // and values support the wildcard characters "*" (matches zero or many characters) and
4138 // "?" (matches at least one character).
4139 annotations?: [string]: string
4140
4141 // Kinds is a list of resource kinds.
4142 kinds?: [...string]
4143
4144 // Name is the name of the resource. The name supports wildcard characters
4145 // "*" (matches zero or many characters) and "?" (at least one character).
4146 // NOTE: "Name" is being deprecated in favor of "Names".
4147 name?: string
4148
4149 // Names are the names of the resources. Each name supports wildcard characters
4150 // "*" (matches zero or many characters) and "?" (at least one character).
4151 names?: [...string]
4152
4153 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
4154 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
4155 // and `?` (matches one character).Wildcards allows writing label selectors like
4156 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
4157 // does not match an empty label set.
4158 namespaceSelector?: {
4159 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4160 matchExpressions?: [...{
4161 // key is the label key that the selector applies to.
4162 key!: string
4163
4164 // operator represents a key's relationship to a set of values.
4165 // Valid operators are In, NotIn, Exists and DoesNotExist.
4166 operator!: string
4167
4168 // values is an array of string values. If the operator is In or NotIn,
4169 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4170 // the values array must be empty. This array is replaced during a strategic
4171 // merge patch.
4172 values?: [...string]
4173 }]
4174
4175 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4176 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4177 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4178 matchLabels?: [string]: string
4179 }
4180
4181 // Namespaces is a list of namespaces names. Each name supports wildcard characters
4182 // "*" (matches zero or many characters) and "?" (at least one character).
4183 namespaces?: [...string]
4184
4185 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
4186 // are used to match a specific action.
4187 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
4188
4189 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
4190 // characters `*` (matches zero or many characters) and `?` (matches one character).
4191 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
4192 // using ["*" : "*"] matches any key and value but does not match an empty label set.
4193 selector?: {
4194 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4195 matchExpressions?: [...{
4196 // key is the label key that the selector applies to.
4197 key!: string
4198
4199 // operator represents a key's relationship to a set of values.
4200 // Valid operators are In, NotIn, Exists and DoesNotExist.
4201 operator!: string
4202
4203 // values is an array of string values. If the operator is In or NotIn,
4204 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4205 // the values array must be empty. This array is replaced during a strategic
4206 // merge patch.
4207 values?: [...string]
4208 }]
4209
4210 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4211 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4212 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4213 matchLabels?: [string]: string
4214 }
4215 }
4216
4217 // Roles is the list of namespaced role names for the user.
4218 roles?: [...string]
4219
4220 // Subjects is the list of subject names like users, user groups, and service accounts.
4221 subjects?: [...{
4222 // APIGroup holds the API group of the referenced subject.
4223 // Defaults to "" for ServiceAccount subjects.
4224 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
4225 apiGroup?: string
4226
4227 // Kind of object being referenced. Values defined by this API group are "User",
4228 // "Group", and "ServiceAccount".
4229 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
4230 kind!: string
4231
4232 // Name of the object being referenced.
4233 name!: string
4234
4235 // Namespace of the referenced object. If the object kind is non-namespace, such
4236 // as "User" or "Group", and this value is not empty
4237 // the Authorizer should report an error.
4238 namespace?: string
4239 }]
4240 }]
4241
4242 // Any allows specifying resources which will be ORed
4243 any?: [...{
4244 // ClusterRoles is the list of cluster-wide role names for the user.
4245 clusterRoles?: [...string]
4246
4247 // ResourceDescription contains information about the resource being created or modified.
4248 resources?: matchN(0, [null | bool | number | string | [...] | {
4249 name!: _
4250 names!: _
4251 }]) & {
4252 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
4253 // and values support the wildcard characters "*" (matches zero or many characters) and
4254 // "?" (matches at least one character).
4255 annotations?: [string]: string
4256
4257 // Kinds is a list of resource kinds.
4258 kinds?: [...string]
4259
4260 // Name is the name of the resource. The name supports wildcard characters
4261 // "*" (matches zero or many characters) and "?" (at least one character).
4262 // NOTE: "Name" is being deprecated in favor of "Names".
4263 name?: string
4264
4265 // Names are the names of the resources. Each name supports wildcard characters
4266 // "*" (matches zero or many characters) and "?" (at least one character).
4267 names?: [...string]
4268
4269 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
4270 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
4271 // and `?` (matches one character).Wildcards allows writing label selectors like
4272 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
4273 // does not match an empty label set.
4274 namespaceSelector?: {
4275 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4276 matchExpressions?: [...{
4277 // key is the label key that the selector applies to.
4278 key!: string
4279
4280 // operator represents a key's relationship to a set of values.
4281 // Valid operators are In, NotIn, Exists and DoesNotExist.
4282 operator!: string
4283
4284 // values is an array of string values. If the operator is In or NotIn,
4285 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4286 // the values array must be empty. This array is replaced during a strategic
4287 // merge patch.
4288 values?: [...string]
4289 }]
4290
4291 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4292 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4293 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4294 matchLabels?: [string]: string
4295 }
4296
4297 // Namespaces is a list of namespaces names. Each name supports wildcard characters
4298 // "*" (matches zero or many characters) and "?" (at least one character).
4299 namespaces?: [...string]
4300
4301 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
4302 // are used to match a specific action.
4303 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
4304
4305 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
4306 // characters `*` (matches zero or many characters) and `?` (matches one character).
4307 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
4308 // using ["*" : "*"] matches any key and value but does not match an empty label set.
4309 selector?: {
4310 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4311 matchExpressions?: [...{
4312 // key is the label key that the selector applies to.
4313 key!: string
4314
4315 // operator represents a key's relationship to a set of values.
4316 // Valid operators are In, NotIn, Exists and DoesNotExist.
4317 operator!: string
4318
4319 // values is an array of string values. If the operator is In or NotIn,
4320 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4321 // the values array must be empty. This array is replaced during a strategic
4322 // merge patch.
4323 values?: [...string]
4324 }]
4325
4326 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4327 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4328 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4329 matchLabels?: [string]: string
4330 }
4331 }
4332
4333 // Roles is the list of namespaced role names for the user.
4334 roles?: [...string]
4335
4336 // Subjects is the list of subject names like users, user groups, and service accounts.
4337 subjects?: [...{
4338 // APIGroup holds the API group of the referenced subject.
4339 // Defaults to "" for ServiceAccount subjects.
4340 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
4341 apiGroup?: string
4342
4343 // Kind of object being referenced. Values defined by this API group are "User",
4344 // "Group", and "ServiceAccount".
4345 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
4346 kind!: string
4347
4348 // Name of the object being referenced.
4349 name!: string
4350
4351 // Namespace of the referenced object. If the object kind is non-namespace, such
4352 // as "User" or "Group", and this value is not empty
4353 // the Authorizer should report an error.
4354 namespace?: string
4355 }]
4356 }]
4357
4358 // ClusterRoles is the list of cluster-wide role names for the user.
4359 clusterRoles?: [...string]
4360
4361 // ResourceDescription contains information about the resource being created or modified.
4362 // Requires at least one tag to be specified when under MatchResources.
4363 // Specifying ResourceDescription directly under match is being deprecated.
4364 // Please specify under "any" or "all" instead.
4365 resources?: matchN(0, [null | bool | number | string | [...] | {
4366 name!: _
4367 names!: _
4368 }]) & {
4369 // Annotations is a map of annotations (key-value pairs of type string). Annotation keys
4370 // and values support the wildcard characters "*" (matches zero or many characters) and
4371 // "?" (matches at least one character).
4372 annotations?: [string]: string
4373
4374 // Kinds is a list of resource kinds.
4375 kinds?: [...string]
4376
4377 // Name is the name of the resource. The name supports wildcard characters
4378 // "*" (matches zero or many characters) and "?" (at least one character).
4379 // NOTE: "Name" is being deprecated in favor of "Names".
4380 name?: string
4381
4382 // Names are the names of the resources. Each name supports wildcard characters
4383 // "*" (matches zero or many characters) and "?" (at least one character).
4384 names?: [...string]
4385
4386 // NamespaceSelector is a label selector for the resource namespace. Label keys and values
4387 // in `matchLabels` support the wildcard characters `*` (matches zero or many characters)
4388 // and `?` (matches one character).Wildcards allows writing label selectors like
4389 // ["storage.k8s.io/*": "*"]. Note that using ["*" : "*"] matches any key and value but
4390 // does not match an empty label set.
4391 namespaceSelector?: {
4392 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4393 matchExpressions?: [...{
4394 // key is the label key that the selector applies to.
4395 key!: string
4396
4397 // operator represents a key's relationship to a set of values.
4398 // Valid operators are In, NotIn, Exists and DoesNotExist.
4399 operator!: string
4400
4401 // values is an array of string values. If the operator is In or NotIn,
4402 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4403 // the values array must be empty. This array is replaced during a strategic
4404 // merge patch.
4405 values?: [...string]
4406 }]
4407
4408 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4409 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4410 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4411 matchLabels?: [string]: string
4412 }
4413
4414 // Namespaces is a list of namespaces names. Each name supports wildcard characters
4415 // "*" (matches zero or many characters) and "?" (at least one character).
4416 namespaces?: [...string]
4417
4418 // Operations can contain values ["CREATE, "UPDATE", "CONNECT", "DELETE"], which
4419 // are used to match a specific action.
4420 operations?: [..."CREATE" | "CONNECT" | "UPDATE" | "DELETE"]
4421
4422 // Selector is a label selector. Label keys and values in `matchLabels` support the wildcard
4423 // characters `*` (matches zero or many characters) and `?` (matches one character).
4424 // Wildcards allows writing label selectors like ["storage.k8s.io/*": "*"]. Note that
4425 // using ["*" : "*"] matches any key and value but does not match an empty label set.
4426 selector?: {
4427 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4428 matchExpressions?: [...{
4429 // key is the label key that the selector applies to.
4430 key!: string
4431
4432 // operator represents a key's relationship to a set of values.
4433 // Valid operators are In, NotIn, Exists and DoesNotExist.
4434 operator!: string
4435
4436 // values is an array of string values. If the operator is In or NotIn,
4437 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4438 // the values array must be empty. This array is replaced during a strategic
4439 // merge patch.
4440 values?: [...string]
4441 }]
4442
4443 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4444 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4445 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4446 matchLabels?: [string]: string
4447 }
4448 }
4449
4450 // Roles is the list of namespaced role names for the user.
4451 roles?: [...string]
4452
4453 // Subjects is the list of subject names like users, user groups, and service accounts.
4454 subjects?: [...{
4455 // APIGroup holds the API group of the referenced subject.
4456 // Defaults to "" for ServiceAccount subjects.
4457 // Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
4458 apiGroup?: string
4459
4460 // Kind of object being referenced. Values defined by this API group are "User",
4461 // "Group", and "ServiceAccount".
4462 // If the Authorizer does not recognized the kind value, the Authorizer should report an error.
4463 kind!: string
4464
4465 // Name of the object being referenced.
4466 name!: string
4467
4468 // Namespace of the referenced object. If the object kind is non-namespace, such
4469 // as "User" or "Group", and this value is not empty
4470 // the Authorizer should report an error.
4471 namespace?: string
4472 }]
4473 }
4474
4475 // Mutation is used to modify matching resources.
4476 mutate?: {
4477 // ForEach applies mutation rules to a list of sub-elements by creating a
4478 // context for each entry in the list and looping over it to apply the
4479 // specified logic.
4480 foreach?: [...{
4481 // Context defines variables and data sources that can be used during rule execution.
4482 context?: [...matchN(1, [
4483 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
4484 ]) & {
4485 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
4486 // The data returned is stored in the context with the name for the context entry.
4487 apiCall?: {
4488 // The data object specifies the POST data sent to the server.
4489 // Only applicable when the method field is set to POST.
4490 data?: [...{
4491 // Key is a unique identifier for the data value
4492 key!: string
4493
4494 // Value is the data value
4495 value!: null | bool | number | string | [...] | {...}
4496 }]
4497
4498 // Default is an optional arbitrary JSON object that the context
4499 // value is set to, if the apiCall returns error.
4500 default?: null | bool | number | string | [...] | {...}
4501
4502 // JMESPath is an optional JSON Match Expression that can be used to
4503 // transform the JSON response returned from the server. For example
4504 // a JMESPath of "items | length(@)" applied to the API server response
4505 // for the URLPath "/apis/apps/v1/deployments" will return the total count
4506 // of deployments across all namespaces.
4507 jmesPath?: string
4508
4509 // Method is the HTTP request type (GET or POST). Defaults to GET.
4510 method?: "GET" | "POST"
4511
4512 // Service is an API call to a JSON web service.
4513 // This is used for non-Kubernetes API server calls.
4514 // It's mutually exclusive with the URLPath field.
4515 service?: {
4516 // CABundle is a PEM encoded CA bundle which will be used to validate
4517 // the server certificate.
4518 caBundle?: string
4519
4520 // Headers is a list of optional HTTP headers to be included in the request.
4521 headers?: [...{
4522 // Key is the header key
4523 key!: string
4524
4525 // Value is the header value
4526 value!: string
4527 }]
4528
4529 // URL is the JSON web service URL. A typical form is
4530 // `https://{service}.{namespace}:{port}/{path}`.
4531 url!: string
4532 }
4533
4534 // URLPath is the URL path to be used in the HTTP GET or POST request to the
4535 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
4536 // The format required is the same format used by the `kubectl get --raw` command.
4537 // See
4538 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
4539 // for details.
4540 // It's mutually exclusive with the Service field.
4541 urlPath?: string
4542 }
4543
4544 // ConfigMap is the ConfigMap reference.
4545 configMap?: {
4546 // Name is the ConfigMap name.
4547 name!: string
4548
4549 // Namespace is the ConfigMap namespace.
4550 namespace?: string
4551 }
4552
4553 // GlobalContextEntryReference is a reference to a cached global context entry.
4554 globalReference?: {
4555 // JMESPath is an optional JSON Match Expression that can be used to
4556 // transform the JSON response returned from the server. For example
4557 // a JMESPath of "items | length(@)" applied to the API server response
4558 // for the URLPath "/apis/apps/v1/deployments" will return the total count
4559 // of deployments across all namespaces.
4560 jmesPath?: string
4561
4562 // Name of the global context entry
4563 name!: string
4564 }
4565
4566 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
4567 // details.
4568 imageRegistry?: {
4569 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
4570 imageRegistryCredentials?: {
4571 // AllowInsecureRegistry allows insecure access to a registry.
4572 allowInsecureRegistry?: bool
4573
4574 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
4575 // It can be of one of these values: default,google,azure,amazon,github.
4576 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
4577
4578 // Secrets specifies a list of secrets that are provided for credentials.
4579 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
4580 // imagePullSecrets from the resource namespace are also used.
4581 secrets?: [...string]
4582 }
4583
4584 // JMESPath is an optional JSON Match Expression that can be used to
4585 // transform the ImageData struct returned as a result of processing
4586 // the image reference.
4587 jmesPath?: string
4588
4589 // Reference is image reference to a container image in the registry.
4590 // Example: ghcr.io/kyverno/kyverno:latest
4591 reference!: string
4592 }
4593
4594 // Name is the variable name.
4595 name!: string
4596
4597 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
4598 variable?: {
4599 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
4600 // expression evaluates to nil
4601 default?: null | bool | number | string | [...] | {...}
4602
4603 // JMESPath is an optional JMESPath Expression that can be used to
4604 // transform the variable.
4605 jmesPath?: string
4606
4607 // Value is any arbitrary JSON object representable in YAML or JSON form.
4608 value?: null | bool | number | string | [...] | {...}
4609 }
4610 }]
4611
4612 // Foreach declares a nested foreach iterator
4613 foreach?: null | bool | number | string | [...] | {...}
4614
4615 // List specifies a JMESPath expression that results in one or more elements
4616 // to which the validation logic is applied.
4617 list?: string
4618
4619 // Order defines the iteration order on the list.
4620 // Can be Ascending to iterate from first to last element or Descending to
4621 // iterate in from last to first element.
4622 order?: "Ascending" | "Descending"
4623
4624 // PatchStrategicMerge is a strategic merge patch used to modify resources.
4625 // See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
4626 // and https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesstrategicmerge/.
4627 patchStrategicMerge?: null | bool | number | string | [...] | {...}
4628
4629 // PatchesJSON6902 is a list of RFC 6902 JSON Patch declarations used to modify resources.
4630 // See https://tools.ietf.org/html/rfc6902 and
4631 // https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesjson6902/.
4632 patchesJson6902?: string
4633
4634 // AnyAllConditions are used to determine if a policy rule should be applied by evaluating a
4635 // set of conditions. The declaration can contain nested `any` or `all` statements.
4636 // See: https://kyverno.io/docs/writing-policies/preconditions/
4637 preconditions?: {
4638 // AllConditions enable variable-based conditional rule execution. This is useful for
4639 // finer control of when an rule is applied. A condition can reference object data
4640 // using JMESPath notation.
4641 // Here, all of the conditions need to pass
4642 all?: [...{
4643 // Key is the context entry (using JMESPath) for conditional rule evaluation.
4644 key?: null | bool | number | string | [...] | {...}
4645
4646 // Message is an optional display message
4647 message?: string
4648
4649 // Operator is the conditional operation to perform. Valid operators are:
4650 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
4651 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
4652 // DurationLessThanOrEquals, DurationLessThan
4653 operator?: "Equals" |
4654 "NotEquals" |
4655 "In" |
4656 "AnyIn" |
4657 "AllIn" |
4658 "NotIn" |
4659 "AnyNotIn" |
4660 "AllNotIn" |
4661 "GreaterThanOrEquals" |
4662 "GreaterThan" |
4663 "LessThanOrEquals" |
4664 "LessThan" |
4665 "DurationGreaterThanOrEquals" |
4666 "DurationGreaterThan" |
4667 "DurationLessThanOrEquals" |
4668 "DurationLessThan"
4669
4670 // Value is the conditional value, or set of values. The values can be fixed set
4671 // or can be variables declared using JMESPath.
4672 value?: null | bool | number | string | [...] | {...}
4673 }]
4674
4675 // AnyConditions enable variable-based conditional rule execution. This is useful for
4676 // finer control of when an rule is applied. A condition can reference object data
4677 // using JMESPath notation.
4678 // Here, at least one of the conditions need to pass
4679 any?: [...{
4680 // Key is the context entry (using JMESPath) for conditional rule evaluation.
4681 key?: null | bool | number | string | [...] | {...}
4682
4683 // Message is an optional display message
4684 message?: string
4685
4686 // Operator is the conditional operation to perform. Valid operators are:
4687 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
4688 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
4689 // DurationLessThanOrEquals, DurationLessThan
4690 operator?: "Equals" |
4691 "NotEquals" |
4692 "In" |
4693 "AnyIn" |
4694 "AllIn" |
4695 "NotIn" |
4696 "AnyNotIn" |
4697 "AllNotIn" |
4698 "GreaterThanOrEquals" |
4699 "GreaterThan" |
4700 "LessThanOrEquals" |
4701 "LessThan" |
4702 "DurationGreaterThanOrEquals" |
4703 "DurationGreaterThan" |
4704 "DurationLessThanOrEquals" |
4705 "DurationLessThan"
4706
4707 // Value is the conditional value, or set of values. The values can be fixed set
4708 // or can be variables declared using JMESPath.
4709 value?: null | bool | number | string | [...] | {...}
4710 }]
4711 ...
4712 }
4713 }]
4714
4715 // MutateExistingOnPolicyUpdate controls if the mutateExisting rule will be
4716 // applied on policy events.
4717 mutateExistingOnPolicyUpdate?: bool
4718
4719 // PatchStrategicMerge is a strategic merge patch used to modify resources.
4720 // See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
4721 // and https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesstrategicmerge/.
4722 patchStrategicMerge?: null | bool | number | string | [...] | {...}
4723
4724 // PatchesJSON6902 is a list of RFC 6902 JSON Patch declarations used to modify resources.
4725 // See https://tools.ietf.org/html/rfc6902 and
4726 // https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patchesjson6902/.
4727 patchesJson6902?: string
4728
4729 // Targets defines the target resources to be mutated.
4730 targets?: [...{
4731 // APIVersion specifies resource apiVersion.
4732 apiVersion?: string
4733
4734 // Context defines variables and data sources that can be used during rule execution.
4735 context?: [...matchN(1, [
4736 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
4737 ]) & {
4738 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
4739 // The data returned is stored in the context with the name for the context entry.
4740 apiCall?: {
4741 // The data object specifies the POST data sent to the server.
4742 // Only applicable when the method field is set to POST.
4743 data?: [...{
4744 // Key is a unique identifier for the data value
4745 key!: string
4746
4747 // Value is the data value
4748 value!: null | bool | number | string | [...] | {...}
4749 }]
4750
4751 // Default is an optional arbitrary JSON object that the context
4752 // value is set to, if the apiCall returns error.
4753 default?: null | bool | number | string | [...] | {...}
4754
4755 // JMESPath is an optional JSON Match Expression that can be used to
4756 // transform the JSON response returned from the server. For example
4757 // a JMESPath of "items | length(@)" applied to the API server response
4758 // for the URLPath "/apis/apps/v1/deployments" will return the total count
4759 // of deployments across all namespaces.
4760 jmesPath?: string
4761
4762 // Method is the HTTP request type (GET or POST). Defaults to GET.
4763 method?: "GET" | "POST"
4764
4765 // Service is an API call to a JSON web service.
4766 // This is used for non-Kubernetes API server calls.
4767 // It's mutually exclusive with the URLPath field.
4768 service?: {
4769 // CABundle is a PEM encoded CA bundle which will be used to validate
4770 // the server certificate.
4771 caBundle?: string
4772
4773 // Headers is a list of optional HTTP headers to be included in the request.
4774 headers?: [...{
4775 // Key is the header key
4776 key!: string
4777
4778 // Value is the header value
4779 value!: string
4780 }]
4781
4782 // URL is the JSON web service URL. A typical form is
4783 // `https://{service}.{namespace}:{port}/{path}`.
4784 url!: string
4785 }
4786
4787 // URLPath is the URL path to be used in the HTTP GET or POST request to the
4788 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
4789 // The format required is the same format used by the `kubectl get --raw` command.
4790 // See
4791 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
4792 // for details.
4793 // It's mutually exclusive with the Service field.
4794 urlPath?: string
4795 }
4796
4797 // ConfigMap is the ConfigMap reference.
4798 configMap?: {
4799 // Name is the ConfigMap name.
4800 name!: string
4801
4802 // Namespace is the ConfigMap namespace.
4803 namespace?: string
4804 }
4805
4806 // GlobalContextEntryReference is a reference to a cached global context entry.
4807 globalReference?: {
4808 // JMESPath is an optional JSON Match Expression that can be used to
4809 // transform the JSON response returned from the server. For example
4810 // a JMESPath of "items | length(@)" applied to the API server response
4811 // for the URLPath "/apis/apps/v1/deployments" will return the total count
4812 // of deployments across all namespaces.
4813 jmesPath?: string
4814
4815 // Name of the global context entry
4816 name!: string
4817 }
4818
4819 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
4820 // details.
4821 imageRegistry?: {
4822 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
4823 imageRegistryCredentials?: {
4824 // AllowInsecureRegistry allows insecure access to a registry.
4825 allowInsecureRegistry?: bool
4826
4827 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
4828 // It can be of one of these values: default,google,azure,amazon,github.
4829 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
4830
4831 // Secrets specifies a list of secrets that are provided for credentials.
4832 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
4833 // imagePullSecrets from the resource namespace are also used.
4834 secrets?: [...string]
4835 }
4836
4837 // JMESPath is an optional JSON Match Expression that can be used to
4838 // transform the ImageData struct returned as a result of processing
4839 // the image reference.
4840 jmesPath?: string
4841
4842 // Reference is image reference to a container image in the registry.
4843 // Example: ghcr.io/kyverno/kyverno:latest
4844 reference!: string
4845 }
4846
4847 // Name is the variable name.
4848 name!: string
4849
4850 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
4851 variable?: {
4852 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
4853 // expression evaluates to nil
4854 default?: null | bool | number | string | [...] | {...}
4855
4856 // JMESPath is an optional JMESPath Expression that can be used to
4857 // transform the variable.
4858 jmesPath?: string
4859
4860 // Value is any arbitrary JSON object representable in YAML or JSON form.
4861 value?: null | bool | number | string | [...] | {...}
4862 }
4863 }]
4864
4865 // Kind specifies resource kind.
4866 kind?: string
4867
4868 // Name specifies the resource name.
4869 name?: string
4870
4871 // Namespace specifies resource namespace.
4872 namespace?: string
4873
4874 // Preconditions are used to determine if a policy rule should be applied by evaluating a
4875 // set of conditions. The declaration can contain nested `any` or `all` statements. A direct list
4876 // of conditions (without `any` or `all` statements is supported for backwards compatibility but
4877 // will be deprecated in the next major release.
4878 // See: https://kyverno.io/docs/writing-policies/preconditions/
4879 preconditions?: null | bool | number | string | [...] | {...}
4880
4881 // Selector allows you to select target resources with their labels.
4882 selector?: {
4883 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
4884 matchExpressions?: [...{
4885 // key is the label key that the selector applies to.
4886 key!: string
4887
4888 // operator represents a key's relationship to a set of values.
4889 // Valid operators are In, NotIn, Exists and DoesNotExist.
4890 operator!: string
4891
4892 // values is an array of string values. If the operator is In or NotIn,
4893 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
4894 // the values array must be empty. This array is replaced during a strategic
4895 // merge patch.
4896 values?: [...string]
4897 }]
4898
4899 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
4900 // map is equivalent to an element of matchExpressions, whose key field is "key", the
4901 // operator is "In", and the values array contains only "value". The requirements are ANDed.
4902 matchLabels?: [string]: string
4903 }
4904
4905 // UID specifies the resource uid.
4906 uid?: string
4907 }]
4908 }
4909
4910 // Name is a label to identify the rule, It must be unique within the policy.
4911 name!: strings.MaxRunes(
4912 63,
4913 )
4914
4915 // Preconditions are used to determine if a policy rule should be applied by evaluating a
4916 // set of conditions. The declaration can contain nested `any` or `all` statements. A direct list
4917 // of conditions (without `any` or `all` statements is supported for backwards compatibility but
4918 // will be deprecated in the next major release.
4919 // See: https://kyverno.io/docs/writing-policies/preconditions/
4920 preconditions?: null | bool | number | string | [...] | {...}
4921
4922 // ReportProperties are the additional properties from the rule that will be
4923 // added to the policy report result
4924 reportProperties?: [string]: string
4925
4926 // SkipBackgroundRequests bypasses admission requests that are sent by the background controller.
4927 // The default value is set to "true", it must be set to "false" to apply
4928 // generate and mutateExisting rules to those requests.
4929 skipBackgroundRequests?: bool
4930
4931 // Validation is used to validate matching resources.
4932 validate?: {
4933 // AllowExistingViolations allows prexisting violating resources to continue violating a policy.
4934 allowExistingViolations?: bool
4935
4936 // AnyPattern specifies list of validation patterns. At least one of the patterns
4937 // must be satisfied for the validation rule to succeed.
4938 anyPattern?: null | bool | number | string | [...] | {...}
4939
4940 // Assert defines a kyverno-json assertion tree.
4941 assert?: {...}
4942
4943 // CEL allows validation checks using the Common Expression Language
4944 // (https://kubernetes.io/docs/reference/using-api/cel/).
4945 cel?: {
4946 // AuditAnnotations contains CEL expressions which are used to produce audit
4947 // annotations for the audit event of the API request.
4948 auditAnnotations?: [...{
4949 // key specifies the audit annotation key. The audit annotation keys of
4950 // a ValidatingAdmissionPolicy must be unique. The key must be a qualified
4951 // name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.
4952 //
4953 // The key is combined with the resource name of the
4954 // ValidatingAdmissionPolicy to construct an audit annotation key:
4955 // "{ValidatingAdmissionPolicy name}/{key}".
4956 //
4957 // If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy
4958 // and the same audit annotation key, the annotation key will be identical.
4959 // In this case, the first annotation written with the key will be included
4960 // in the audit event and all subsequent annotations with the same key
4961 // will be discarded.
4962 //
4963 // Required.
4964 key!: string
4965
4966 // valueExpression represents the expression which is evaluated by CEL to
4967 // produce an audit annotation value. The expression must evaluate to either
4968 // a string or null value. If the expression evaluates to a string, the
4969 // audit annotation is included with the string value. If the expression
4970 // evaluates to null or empty string the audit annotation will be omitted.
4971 // The valueExpression may be no longer than 5kb in length.
4972 // If the result of the valueExpression is more than 10kb in length, it
4973 // will be truncated to 10kb.
4974 //
4975 // If multiple ValidatingAdmissionPolicyBinding resources match an
4976 // API request, then the valueExpression will be evaluated for
4977 // each binding. All unique values produced by the valueExpressions
4978 // will be joined together in a comma-separated list.
4979 //
4980 // Required.
4981 valueExpression!: string
4982 }]
4983
4984 // Expressions is a list of CELExpression types.
4985 expressions?: [...{
4986 // Expression represents the expression which will be evaluated by CEL.
4987 // ref: https://github.com/google/cel-spec
4988 // CEL expressions have access to the contents of the API request/response,
4989 // organized into CEL variables as well as some other useful variables:
4990 //
4991 // - 'object' - The object from the incoming request. The value is null for DELETE requests.
4992 // - 'oldObject' - The existing object. The value is null for CREATE requests.
4993 // - 'request' - Attributes of the API
4994 // request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).
4995 // - 'params' - Parameter resource referred to by the policy binding being
4996 // evaluated. Only populated if the policy has a ParamKind.
4997 // - 'namespaceObject' - The namespace object that the incoming object belongs
4998 // to. The value is null for cluster-scoped resources.
4999 // - 'variables' - Map of composited variables, from its name to its lazily evaluated value.
5000 // For example, a variable named 'foo' can be accessed as 'variables.foo'.
5001 // - 'authorizer' - A CEL Authorizer. May be used to perform authorization
5002 // checks for the principal (user or service account) of the request.
5003 // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
5004 // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the
5005 // 'authorizer' and configured with the
5006 // request resource.
5007 //
5008 // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are
5009 // always accessible from the root of the
5010 // object. No other metadata properties are accessible.
5011 //
5012 // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
5013 // Accessible property names are escaped according to the following rules when
5014 // accessed in the expression:
5015 // - '__' escapes to '__underscores__'
5016 // - '.' escapes to '__dot__'
5017 // - '-' escapes to '__dash__'
5018 // - '/' escapes to '__slash__'
5019 // - Property names that exactly match a CEL RESERVED keyword escape to
5020 // '__{keyword}__'. The keywords are:
5021 // "true", "false", "null", "in", "as", "break", "const", "continue", "else",
5022 // "for", "function", "if",
5023 // "import", "let", "loop", "package", "namespace", "return".
5024 // Examples:
5025 // - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ > 0"}
5026 // - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop > 0"}
5027 // - Expression accessing a property named "redact__d": {"Expression":
5028 // "object.redact__underscores__d > 0"}
5029 //
5030 // Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
5031 // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
5032 // - 'set': `X + Y` performs a union where the array positions of all elements
5033 // in `X` are preserved and
5034 // non-intersecting elements in `Y` are appended, retaining their partial order.
5035 // - 'map': `X + Y` performs a merge where the array positions of all keys in
5036 // `X` are preserved but the values
5037 // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
5038 // non-intersecting keys are appended, retaining their partial order.
5039 // Required.
5040 expression!: string
5041
5042 // Message represents the message displayed when validation fails. The message
5043 // is required if the Expression contains
5044 // line breaks. The message must not contain line breaks.
5045 // If unset, the message is "failed rule: {Rule}".
5046 // e.g. "must be a URL with the host matching spec.host"
5047 // If the Expression contains line breaks. Message is required.
5048 // The message must not contain line breaks.
5049 // If unset, the message is "failed Expression: {Expression}".
5050 message?: string
5051
5052 // messageExpression declares a CEL expression that evaluates to the validation
5053 // failure message that is returned when this rule fails.
5054 // Since messageExpression is used as a failure message, it must evaluate to a string.
5055 // If both message and messageExpression are present on a validation, then
5056 // messageExpression will be used if validation fails.
5057 // If messageExpression results in a runtime error, the runtime error is logged,
5058 // and the validation failure message is produced
5059 // as if the messageExpression field were unset. If messageExpression evaluates
5060 // to an empty string, a string with only spaces, or a string
5061 // that contains line breaks, then the validation failure message will also be
5062 // produced as if the messageExpression field were unset, and
5063 // the fact that messageExpression produced an empty string/string with only
5064 // spaces/string with line breaks will be logged.
5065 // messageExpression has access to all the same variables as the `expression`
5066 // except for 'authorizer' and 'authorizer.requestResource'.
5067 // Example:
5068 // "object.x must be less than max ("+string(params.max)+")"
5069 messageExpression?: string
5070
5071 // Reason represents a machine-readable description of why this validation failed.
5072 // If this is the first validation in the list to fail, this reason, as well as the
5073 // corresponding HTTP response code, are used in the
5074 // HTTP response to the client.
5075 // The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid",
5076 // "RequestEntityTooLarge".
5077 // If not set, StatusReasonInvalid is used in the response to the client.
5078 reason?: string
5079 }]
5080
5081 // Generate specifies whether to generate a Kubernetes ValidatingAdmissionPolicy from the rule.
5082 // Optional. Defaults to "false" if not specified.
5083 generate?: bool
5084
5085 // ParamKind is a tuple of Group Kind and Version.
5086 paramKind?: {
5087 // APIVersion is the API group version the resources belong to.
5088 // In format of "group/version".
5089 // Required.
5090 apiVersion?: string
5091
5092 // Kind is the API kind the resources belong to.
5093 // Required.
5094 kind?: string
5095 }
5096
5097 // ParamRef references a parameter resource.
5098 paramRef?: {
5099 // name is the name of the resource being referenced.
5100 //
5101 // One of `name` or `selector` must be set, but `name` and `selector` are
5102 // mutually exclusive properties. If one is set, the other must be unset.
5103 //
5104 // A single parameter used for all admission requests can be configured
5105 // by setting the `name` field, leaving `selector` blank, and setting namespace
5106 // if `paramKind` is namespace-scoped.
5107 name?: string
5108
5109 // namespace is the namespace of the referenced resource. Allows limiting
5110 // the search for params to a specific namespace. Applies to both `name` and
5111 // `selector` fields.
5112 //
5113 // A per-namespace parameter may be used by specifying a namespace-scoped
5114 // `paramKind` in the policy and leaving this field empty.
5115 //
5116 // - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this
5117 // field results in a configuration error.
5118 //
5119 // - If `paramKind` is namespace-scoped, the namespace of the object being
5120 // evaluated for admission will be used when this field is left unset. Take
5121 // care that if this is left empty the binding must not match any cluster-scoped
5122 // resources, which will result in an error.
5123 namespace?: string
5124
5125 // `parameterNotFoundAction` controls the behavior of the binding when the resource
5126 // exists, and name or selector is valid, but there are no parameters
5127 // matched by the binding. If the value is set to `Allow`, then no
5128 // matched parameters will be treated as successful validation by the binding.
5129 // If set to `Deny`, then no matched parameters will be subject to the
5130 // `failurePolicy` of the policy.
5131 //
5132 // Allowed values are `Allow` or `Deny`
5133 //
5134 // Required
5135 parameterNotFoundAction?: string
5136
5137 // selector can be used to match multiple param objects based on their labels.
5138 // Supply selector: {} to match all resources of the ParamKind.
5139 //
5140 // If multiple params are found, they are all evaluated with the policy expressions
5141 // and the results are ANDed together.
5142 //
5143 // One of `name` or `selector` must be set, but `name` and `selector` are
5144 // mutually exclusive properties. If one is set, the other must be unset.
5145 selector?: {
5146 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
5147 matchExpressions?: [...{
5148 // key is the label key that the selector applies to.
5149 key!: string
5150
5151 // operator represents a key's relationship to a set of values.
5152 // Valid operators are In, NotIn, Exists and DoesNotExist.
5153 operator!: string
5154
5155 // values is an array of string values. If the operator is In or NotIn,
5156 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
5157 // the values array must be empty. This array is replaced during a strategic
5158 // merge patch.
5159 values?: [...string]
5160 }]
5161
5162 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
5163 // map is equivalent to an element of matchExpressions, whose key field is "key", the
5164 // operator is "In", and the values array contains only "value". The requirements are ANDed.
5165 matchLabels?: [string]: string
5166 }
5167 }
5168
5169 // Variables contain definitions of variables that can be used in composition of other expressions.
5170 // Each variable is defined as a named CEL expression.
5171 // The variables defined here will be available under `variables` in other
5172 // expressions of the policy.
5173 variables?: [...{
5174 // Expression is the expression that will be evaluated as the value of the variable.
5175 // The CEL expression has access to the same identifiers as the CEL expressions in Validation.
5176 expression!: string
5177
5178 // Name is the name of the variable. The name must be a valid CEL identifier and
5179 // unique among all variables.
5180 // The variable can be accessed in other expressions through `variables`
5181 // For example, if name is "foo", the variable will be available as `variables.foo`
5182 name!: string
5183 }]
5184 }
5185
5186 // Deny defines conditions used to pass or fail a validation rule.
5187 deny?: {
5188 // Multiple conditions can be declared under an `any` or `all` statement. A direct list
5189 // of conditions (without `any` or `all` statements) is also supported for backwards compatibility
5190 // but will be deprecated in the next major release.
5191 // See: https://kyverno.io/docs/writing-policies/validate/#deny-rules
5192 conditions?: null | bool | number | string | [...] | {...}
5193 }
5194
5195 // FailureAction defines if a validation policy rule violation should block
5196 // the admission review request (Enforce), or allow (Audit) the admission review request
5197 // and report an error in a policy report. Optional.
5198 // Allowed values are Audit or Enforce.
5199 failureAction?: "Audit" | "Enforce"
5200
5201 // FailureActionOverrides is a Cluster Policy attribute that specifies FailureAction
5202 // namespace-wise. It overrides FailureAction for the specified namespaces.
5203 failureActionOverrides?: [...{
5204 // ValidationFailureAction defines the policy validation failure action
5205 action?: "audit" | "enforce" | "Audit" | "Enforce"
5206
5207 // A label selector is a label query over a set of resources. The result of matchLabels and
5208 // matchExpressions are ANDed. An empty label selector matches all objects. A null
5209 // label selector matches no objects.
5210 namespaceSelector?: {
5211 // matchExpressions is a list of label selector requirements. The requirements are ANDed.
5212 matchExpressions?: [...{
5213 // key is the label key that the selector applies to.
5214 key!: string
5215
5216 // operator represents a key's relationship to a set of values.
5217 // Valid operators are In, NotIn, Exists and DoesNotExist.
5218 operator!: string
5219
5220 // values is an array of string values. If the operator is In or NotIn,
5221 // the values array must be non-empty. If the operator is Exists or DoesNotExist,
5222 // the values array must be empty. This array is replaced during a strategic
5223 // merge patch.
5224 values?: [...string]
5225 }]
5226
5227 // matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
5228 // map is equivalent to an element of matchExpressions, whose key field is "key", the
5229 // operator is "In", and the values array contains only "value". The requirements are ANDed.
5230 matchLabels?: [string]: string
5231 }
5232 namespaces?: [...string]
5233 }]
5234
5235 // ForEach applies validate rules to a list of sub-elements by creating a
5236 // context for each entry in the list and looping over it to apply the
5237 // specified logic.
5238 foreach?: [...{
5239 // AnyPattern specifies list of validation patterns. At least one of the patterns
5240 // must be satisfied for the validation rule to succeed.
5241 anyPattern?: null | bool | number | string | [...] | {...}
5242
5243 // Context defines variables and data sources that can be used during rule execution.
5244 context?: [...matchN(1, [
5245 {configMap!: _}, {apiCall!: _}, {imageRegistry!: _}, {variable!: _}, {globalReference!: _},
5246 ]) & {
5247 // APICall is an HTTP request to the Kubernetes API server, or other JSON web service.
5248 // The data returned is stored in the context with the name for the context entry.
5249 apiCall?: {
5250 // The data object specifies the POST data sent to the server.
5251 // Only applicable when the method field is set to POST.
5252 data?: [...{
5253 // Key is a unique identifier for the data value
5254 key!: string
5255
5256 // Value is the data value
5257 value!: null | bool | number | string | [...] | {...}
5258 }]
5259
5260 // Default is an optional arbitrary JSON object that the context
5261 // value is set to, if the apiCall returns error.
5262 default?: null | bool | number | string | [...] | {...}
5263
5264 // JMESPath is an optional JSON Match Expression that can be used to
5265 // transform the JSON response returned from the server. For example
5266 // a JMESPath of "items | length(@)" applied to the API server response
5267 // for the URLPath "/apis/apps/v1/deployments" will return the total count
5268 // of deployments across all namespaces.
5269 jmesPath?: string
5270
5271 // Method is the HTTP request type (GET or POST). Defaults to GET.
5272 method?: "GET" | "POST"
5273
5274 // Service is an API call to a JSON web service.
5275 // This is used for non-Kubernetes API server calls.
5276 // It's mutually exclusive with the URLPath field.
5277 service?: {
5278 // CABundle is a PEM encoded CA bundle which will be used to validate
5279 // the server certificate.
5280 caBundle?: string
5281
5282 // Headers is a list of optional HTTP headers to be included in the request.
5283 headers?: [...{
5284 // Key is the header key
5285 key!: string
5286
5287 // Value is the header value
5288 value!: string
5289 }]
5290
5291 // URL is the JSON web service URL. A typical form is
5292 // `https://{service}.{namespace}:{port}/{path}`.
5293 url!: string
5294 }
5295
5296 // URLPath is the URL path to be used in the HTTP GET or POST request to the
5297 // Kubernetes API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
5298 // The format required is the same format used by the `kubectl get --raw` command.
5299 // See
5300 // https://kyverno.io/docs/writing-policies/external-data-sources/#variables-from-kubernetes-api-server-calls
5301 // for details.
5302 // It's mutually exclusive with the Service field.
5303 urlPath?: string
5304 }
5305
5306 // ConfigMap is the ConfigMap reference.
5307 configMap?: {
5308 // Name is the ConfigMap name.
5309 name!: string
5310
5311 // Namespace is the ConfigMap namespace.
5312 namespace?: string
5313 }
5314
5315 // GlobalContextEntryReference is a reference to a cached global context entry.
5316 globalReference?: {
5317 // JMESPath is an optional JSON Match Expression that can be used to
5318 // transform the JSON response returned from the server. For example
5319 // a JMESPath of "items | length(@)" applied to the API server response
5320 // for the URLPath "/apis/apps/v1/deployments" will return the total count
5321 // of deployments across all namespaces.
5322 jmesPath?: string
5323
5324 // Name of the global context entry
5325 name!: string
5326 }
5327
5328 // ImageRegistry defines requests to an OCI/Docker V2 registry to fetch image
5329 // details.
5330 imageRegistry?: {
5331 // ImageRegistryCredentials provides credentials that will be used for authentication with registry
5332 imageRegistryCredentials?: {
5333 // AllowInsecureRegistry allows insecure access to a registry.
5334 allowInsecureRegistry?: bool
5335
5336 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
5337 // It can be of one of these values: default,google,azure,amazon,github.
5338 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
5339
5340 // Secrets specifies a list of secrets that are provided for credentials.
5341 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
5342 // imagePullSecrets from the resource namespace are also used.
5343 secrets?: [...string]
5344 }
5345
5346 // JMESPath is an optional JSON Match Expression that can be used to
5347 // transform the ImageData struct returned as a result of processing
5348 // the image reference.
5349 jmesPath?: string
5350
5351 // Reference is image reference to a container image in the registry.
5352 // Example: ghcr.io/kyverno/kyverno:latest
5353 reference!: string
5354 }
5355
5356 // Name is the variable name.
5357 name!: string
5358
5359 // Variable defines an arbitrary JMESPath context variable that can be defined inline.
5360 variable?: {
5361 // Default is an optional arbitrary JSON object that the variable may take if the JMESPath
5362 // expression evaluates to nil
5363 default?: null | bool | number | string | [...] | {...}
5364
5365 // JMESPath is an optional JMESPath Expression that can be used to
5366 // transform the variable.
5367 jmesPath?: string
5368
5369 // Value is any arbitrary JSON object representable in YAML or JSON form.
5370 value?: null | bool | number | string | [...] | {...}
5371 }
5372 }]
5373
5374 // Deny defines conditions used to pass or fail a validation rule.
5375 deny?: {
5376 // Multiple conditions can be declared under an `any` or `all` statement. A direct list
5377 // of conditions (without `any` or `all` statements) is also supported for backwards compatibility
5378 // but will be deprecated in the next major release.
5379 // See: https://kyverno.io/docs/writing-policies/validate/#deny-rules
5380 conditions?: null | bool | number | string | [...] | {...}
5381 }
5382
5383 // ElementScope specifies whether to use the current list element as the scope
5384 // for validation. Defaults to "true" if not specified.
5385 // When set to "false", "request.object" is used as the validation scope within the foreach
5386 // block to allow referencing other elements in the subtree.
5387 elementScope?: bool
5388
5389 // Foreach declares a nested foreach iterator
5390 foreach?: null | bool | number | string | [...] | {...}
5391
5392 // List specifies a JMESPath expression that results in one or more elements
5393 // to which the validation logic is applied.
5394 list?: string
5395
5396 // Pattern specifies an overlay-style pattern used to check resources.
5397 pattern?: null | bool | number | string | [...] | {...}
5398
5399 // AnyAllConditions are used to determine if a policy rule should be applied by evaluating a
5400 // set of conditions. The declaration can contain nested `any` or `all` statements.
5401 // See: https://kyverno.io/docs/writing-policies/preconditions/
5402 preconditions?: {
5403 // AllConditions enable variable-based conditional rule execution. This is useful for
5404 // finer control of when an rule is applied. A condition can reference object data
5405 // using JMESPath notation.
5406 // Here, all of the conditions need to pass
5407 all?: [...{
5408 // Key is the context entry (using JMESPath) for conditional rule evaluation.
5409 key?: null | bool | number | string | [...] | {...}
5410
5411 // Message is an optional display message
5412 message?: string
5413
5414 // Operator is the conditional operation to perform. Valid operators are:
5415 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
5416 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
5417 // DurationLessThanOrEquals, DurationLessThan
5418 operator?: "Equals" |
5419 "NotEquals" |
5420 "In" |
5421 "AnyIn" |
5422 "AllIn" |
5423 "NotIn" |
5424 "AnyNotIn" |
5425 "AllNotIn" |
5426 "GreaterThanOrEquals" |
5427 "GreaterThan" |
5428 "LessThanOrEquals" |
5429 "LessThan" |
5430 "DurationGreaterThanOrEquals" |
5431 "DurationGreaterThan" |
5432 "DurationLessThanOrEquals" |
5433 "DurationLessThan"
5434
5435 // Value is the conditional value, or set of values. The values can be fixed set
5436 // or can be variables declared using JMESPath.
5437 value?: null | bool | number | string | [...] | {...}
5438 }]
5439
5440 // AnyConditions enable variable-based conditional rule execution. This is useful for
5441 // finer control of when an rule is applied. A condition can reference object data
5442 // using JMESPath notation.
5443 // Here, at least one of the conditions need to pass
5444 any?: [...{
5445 // Key is the context entry (using JMESPath) for conditional rule evaluation.
5446 key?: null | bool | number | string | [...] | {...}
5447
5448 // Message is an optional display message
5449 message?: string
5450
5451 // Operator is the conditional operation to perform. Valid operators are:
5452 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
5453 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
5454 // DurationLessThanOrEquals, DurationLessThan
5455 operator?: "Equals" |
5456 "NotEquals" |
5457 "In" |
5458 "AnyIn" |
5459 "AllIn" |
5460 "NotIn" |
5461 "AnyNotIn" |
5462 "AllNotIn" |
5463 "GreaterThanOrEquals" |
5464 "GreaterThan" |
5465 "LessThanOrEquals" |
5466 "LessThan" |
5467 "DurationGreaterThanOrEquals" |
5468 "DurationGreaterThan" |
5469 "DurationLessThanOrEquals" |
5470 "DurationLessThan"
5471
5472 // Value is the conditional value, or set of values. The values can be fixed set
5473 // or can be variables declared using JMESPath.
5474 value?: null | bool | number | string | [...] | {...}
5475 }]
5476 ...
5477 }
5478 }]
5479
5480 // Manifest specifies conditions for manifest verification
5481 manifests?: {
5482 // AnnotationDomain is custom domain of annotation for message and signature.
5483 // Default is "cosign.sigstore.dev".
5484 annotationDomain?: string
5485
5486 // Attestors specified the required attestors (i.e. authorities)
5487 attestors?: [...{
5488 // Count specifies the required number of entries that must match. If the count
5489 // is null, all entries must match
5490 // (a logical AND). If the count is 1, at least one entry must match (a logical
5491 // OR). If the count contains a
5492 // value N, then N must be less than or equal to the size of entries, and at
5493 // least N entries must match.
5494 count?: int & >=1
5495
5496 // Entries contains the available attestors. An attestor can be a static key,
5497 // attributes for keyless verification, or a nested attestor declaration.
5498 entries?: [...{
5499 // Annotations are used for image verification.
5500 // Every specified key-value pair must exist and match in the verified payload.
5501 // The payload may contain other key-value pairs.
5502 annotations?: [string]: string
5503
5504 // Attestor is a nested set of Attestor used to specify a more complex set of match authorities.
5505 attestor?: null | bool | number | string | [...] | {...}
5506
5507 // Certificates specifies one or more certificates.
5508 certificates?: {
5509 // Cert is an optional PEM-encoded public certificate.
5510 cert?: string
5511
5512 // CertChain is an optional PEM encoded set of certificates used to verify.
5513 certChain?: string
5514
5515 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
5516 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
5517 ctlog?: {
5518 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
5519 // to check for a certificate
5520 // timestamp. Default is false. Set to true if this was opted out during signing.
5521 ignoreSCT?: bool
5522
5523 // PubKey, if set, is used to validate SCTs against a custom source.
5524 pubkey?: string
5525
5526 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
5527 // RFC3161 timestamp authority. Must
5528 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
5529 // may contain the leaf TSA certificate if not present in the timestamurce.
5530 tsaCertChain?: string
5531 }
5532
5533 // Rekor provides configuration for the Rekor transparency log service. If an empty object
5534 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
5535 rekor?: {
5536 // IgnoreTlog skips transparency log verification.
5537 ignoreTlog?: bool
5538
5539 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
5540 // If set, this will be used to validate transparency log signatures from a custom Rekor.
5541 pubkey?: string
5542
5543 // URL is the address of the transparency log. Defaults to the public Rekor log
5544 // instance https://rekor.sigstore.dev.
5545 url?: string
5546 }
5547 }
5548
5549 // Keyless is a set of attribute used to verify a Sigstore keyless attestor.
5550 // See https://github.com/sigstore/cosign/blob/main/KEYLESS.md.
5551 keyless?: {
5552 // AdditionalExtensions are certificate-extensions used for keyless signing.
5553 additionalExtensions?: [string]: string
5554
5555 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
5556 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
5557 ctlog?: {
5558 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
5559 // to check for a certificate
5560 // timestamp. Default is false. Set to true if this was opted out during signing.
5561 ignoreSCT?: bool
5562
5563 // PubKey, if set, is used to validate SCTs against a custom source.
5564 pubkey?: string
5565
5566 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
5567 // RFC3161 timestamp authority. Must
5568 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
5569 // may contain the leaf TSA certificate if not present in the timestamurce.
5570 tsaCertChain?: string
5571 }
5572
5573 // Issuer is the certificate issuer used for keyless signing.
5574 issuer?: string
5575
5576 // IssuerRegExp is the regular expression to match certificate issuer used for keyless signing.
5577 issuerRegExp?: string
5578
5579 // Rekor provides configuration for the Rekor transparency log service. If an empty object
5580 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
5581 rekor?: {
5582 // IgnoreTlog skips transparency log verification.
5583 ignoreTlog?: bool
5584
5585 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
5586 // If set, this will be used to validate transparency log signatures from a custom Rekor.
5587 pubkey?: string
5588
5589 // URL is the address of the transparency log. Defaults to the public Rekor log
5590 // instance https://rekor.sigstore.dev.
5591 url?: string
5592 }
5593
5594 // Roots is an optional set of PEM encoded trusted root certificates.
5595 // If not provided, the system roots are used.
5596 roots?: string
5597
5598 // Subject is the verified identity used for keyless signing, for example the email address.
5599 subject?: string
5600
5601 // SubjectRegExp is the regular expression to match identity used for keyless
5602 // signing, for example the email address.
5603 subjectRegExp?: string
5604 }
5605
5606 // Keys specifies one or more public keys.
5607 keys?: {
5608 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
5609 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
5610 ctlog?: {
5611 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
5612 // to check for a certificate
5613 // timestamp. Default is false. Set to true if this was opted out during signing.
5614 ignoreSCT?: bool
5615
5616 // PubKey, if set, is used to validate SCTs against a custom source.
5617 pubkey?: string
5618
5619 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
5620 // RFC3161 timestamp authority. Must
5621 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
5622 // may contain the leaf TSA certificate if not present in the timestamurce.
5623 tsaCertChain?: string
5624 }
5625
5626 // KMS provides the URI to the public key stored in a Key Management System. See:
5627 // https://github.com/sigstore/cosign/blob/main/KMS.md
5628 kms?: string
5629
5630 // Keys is a set of X.509 public keys used to verify image signatures. The keys can be directly
5631 // specified or can be a variable reference to a key specified in a ConfigMap (see
5632 // https://kyverno.io/docs/writing-policies/variables/), or reference a standard Kubernetes Secret
5633 // elsewhere in the cluster by specifying it in the format "k8s://<namespace>/<secret_name>".
5634 // The named Secret must specify a key `cosign.pub` containing the public key used for
5635 // verification, (see https://github.com/sigstore/cosign/blob/main/KMS.md#kubernetes-secret).
5636 // When multiple keys are specified each key is processed as a separate staticKey entry
5637 // (.attestors[*].entries.keys) within the set of attestors and the count is
5638 // applied across the keys.
5639 publicKeys?: string
5640
5641 // Rekor provides configuration for the Rekor transparency log service. If an empty object
5642 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
5643 rekor?: {
5644 // IgnoreTlog skips transparency log verification.
5645 ignoreTlog?: bool
5646
5647 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
5648 // If set, this will be used to validate transparency log signatures from a custom Rekor.
5649 pubkey?: string
5650
5651 // URL is the address of the transparency log. Defaults to the public Rekor log
5652 // instance https://rekor.sigstore.dev.
5653 url?: string
5654 }
5655
5656 // Reference to a Secret resource that contains a public key
5657 secret?: {
5658 // Name of the secret. The provided secret must contain a key named cosign.pub.
5659 name!: string
5660
5661 // Namespace name where the Secret exists.
5662 namespace!: string
5663 }
5664
5665 // Deprecated. Use attestor.signatureAlgorithm instead.
5666 signatureAlgorithm?: string
5667 }
5668
5669 // Repository is an optional alternate OCI repository to use for signatures and
5670 // attestations that match this rule.
5671 // If specified Repository will override other OCI image repository locations for this Attestor.
5672 repository?: string
5673
5674 // Specify signature algorithm for public keys. Supported values are sha224,
5675 // sha256, sha384 and sha512.
5676 signatureAlgorithm?: string
5677 }]
5678 }]
5679
5680 // DryRun configuration
5681 dryRun?: {
5682 enable?: bool
5683 namespace?: string
5684 }
5685
5686 // Fields which will be ignored while comparing manifests.
5687 ignoreFields?: [...{
5688 fields?: [...string]
5689 objects?: [...{
5690 group?: string
5691 kind?: string
5692 name?: string
5693 namespace?: string
5694 version?: string
5695 }]
5696 }]
5697
5698 // Repository is an optional alternate OCI repository to use for resource bundle reference.
5699 // The repository can be overridden per Attestor or Attestation.
5700 repository?: string
5701 }
5702
5703 // Message specifies a custom message to be displayed on failure.
5704 message?: string
5705
5706 // Pattern specifies an overlay-style pattern used to check resources.
5707 pattern?: null | bool | number | string | [...] | {...}
5708
5709 // PodSecurity applies exemptions for Kubernetes Pod Security admission
5710 // by specifying exclusions for Pod Security Standards controls.
5711 podSecurity?: {
5712 // Exclude specifies the Pod Security Standard controls to be excluded.
5713 exclude?: [...{
5714 // ControlName specifies the name of the Pod Security Standard control.
5715 // See: https://kubernetes.io/docs/concepts/security/pod-security-standards/
5716 controlName!: "HostProcess" |
5717 "Host Namespaces" |
5718 "Privileged Containers" |
5719 "Capabilities" |
5720 "HostPath Volumes" |
5721 "Host Ports" |
5722 "AppArmor" |
5723 "SELinux" |
5724 "/proc Mount Type" |
5725 "Seccomp" |
5726 "Sysctls" |
5727 "Volume Types" |
5728 "Privilege Escalation" |
5729 "Running as Non-root" |
5730 "Running as Non-root user"
5731
5732 // Images selects matching containers and applies the container level PSS.
5733 // Each image is the image name consisting of the registry address, repository, image, and tag.
5734 // Empty list matches no containers, PSS checks are applied at the pod level only.
5735 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
5736 images?: [...string]
5737
5738 // RestrictedField selects the field for the given Pod Security Standard control.
5739 // When not set, all restricted fields for the control are selected.
5740 restrictedField?: string
5741
5742 // Values defines the allowed values that can be excluded.
5743 values?: [...string]
5744 }]
5745
5746 // Level defines the Pod Security Standard level to be applied to workloads.
5747 // Allowed values are privileged, baseline, and restricted.
5748 level?: "privileged" | "baseline" | "restricted"
5749
5750 // Version defines the Pod Security Standard versions that Kubernetes supports.
5751 // Allowed values are v1.19, v1.20, v1.21, v1.22, v1.23, v1.24, v1.25, v1.26,
5752 // v1.27, v1.28, v1.29, v1.30, v1.31, v1.32, latest. Defaults to latest.
5753 version?: "v1.19" |
5754 "v1.20" |
5755 "v1.21" |
5756 "v1.22" |
5757 "v1.23" |
5758 "v1.24" |
5759 "v1.25" |
5760 "v1.26" |
5761 "v1.27" |
5762 "v1.28" |
5763 "v1.29" |
5764 "v1.30" |
5765 "v1.31" |
5766 "v1.32" |
5767 "latest"
5768 }
5769 }
5770
5771 // VerifyImages is used to verify image signatures and mutate them to add a digest
5772 verifyImages?: [...{
5773 // Deprecated.
5774 additionalExtensions?: [string]: string
5775
5776 // Deprecated. Use annotations per Attestor instead.
5777 annotations?: [string]: string
5778
5779 // Attestations are optional checks for signed in-toto Statements used to verify the image.
5780 // See https://github.com/in-toto/attestation. Kyverno fetches signed attestations from the
5781 // OCI registry and decodes them into a list of Statement declarations.
5782 attestations?: [...{
5783 // Attestors specify the required attestors (i.e. authorities).
5784 attestors?: [...{
5785 // Count specifies the required number of entries that must match. If the count
5786 // is null, all entries must match
5787 // (a logical AND). If the count is 1, at least one entry must match (a logical
5788 // OR). If the count contains a
5789 // value N, then N must be less than or equal to the size of entries, and at
5790 // least N entries must match.
5791 count?: int & >=1
5792
5793 // Entries contains the available attestors. An attestor can be a static key,
5794 // attributes for keyless verification, or a nested attestor declaration.
5795 entries?: [...{
5796 // Annotations are used for image verification.
5797 // Every specified key-value pair must exist and match in the verified payload.
5798 // The payload may contain other key-value pairs.
5799 annotations?: [string]: string
5800
5801 // Attestor is a nested set of Attestor used to specify a more complex set of match authorities.
5802 attestor?: null | bool | number | string | [...] | {...}
5803
5804 // Certificates specifies one or more certificates.
5805 certificates?: {
5806 // Cert is an optional PEM-encoded public certificate.
5807 cert?: string
5808
5809 // CertChain is an optional PEM encoded set of certificates used to verify.
5810 certChain?: string
5811
5812 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
5813 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
5814 ctlog?: {
5815 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
5816 // to check for a certificate
5817 // timestamp. Default is false. Set to true if this was opted out during signing.
5818 ignoreSCT?: bool
5819
5820 // PubKey, if set, is used to validate SCTs against a custom source.
5821 pubkey?: string
5822
5823 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
5824 // RFC3161 timestamp authority. Must
5825 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
5826 // may contain the leaf TSA certificate if not present in the timestamurce.
5827 tsaCertChain?: string
5828 }
5829
5830 // Rekor provides configuration for the Rekor transparency log service. If an empty object
5831 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
5832 rekor?: {
5833 // IgnoreTlog skips transparency log verification.
5834 ignoreTlog?: bool
5835
5836 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
5837 // If set, this will be used to validate transparency log signatures from a custom Rekor.
5838 pubkey?: string
5839
5840 // URL is the address of the transparency log. Defaults to the public Rekor log
5841 // instance https://rekor.sigstore.dev.
5842 url?: string
5843 }
5844 }
5845
5846 // Keyless is a set of attribute used to verify a Sigstore keyless attestor.
5847 // See https://github.com/sigstore/cosign/blob/main/KEYLESS.md.
5848 keyless?: {
5849 // AdditionalExtensions are certificate-extensions used for keyless signing.
5850 additionalExtensions?: [string]: string
5851
5852 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
5853 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
5854 ctlog?: {
5855 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
5856 // to check for a certificate
5857 // timestamp. Default is false. Set to true if this was opted out during signing.
5858 ignoreSCT?: bool
5859
5860 // PubKey, if set, is used to validate SCTs against a custom source.
5861 pubkey?: string
5862
5863 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
5864 // RFC3161 timestamp authority. Must
5865 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
5866 // may contain the leaf TSA certificate if not present in the timestamurce.
5867 tsaCertChain?: string
5868 }
5869
5870 // Issuer is the certificate issuer used for keyless signing.
5871 issuer?: string
5872
5873 // IssuerRegExp is the regular expression to match certificate issuer used for keyless signing.
5874 issuerRegExp?: string
5875
5876 // Rekor provides configuration for the Rekor transparency log service. If an empty object
5877 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
5878 rekor?: {
5879 // IgnoreTlog skips transparency log verification.
5880 ignoreTlog?: bool
5881
5882 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
5883 // If set, this will be used to validate transparency log signatures from a custom Rekor.
5884 pubkey?: string
5885
5886 // URL is the address of the transparency log. Defaults to the public Rekor log
5887 // instance https://rekor.sigstore.dev.
5888 url?: string
5889 }
5890
5891 // Roots is an optional set of PEM encoded trusted root certificates.
5892 // If not provided, the system roots are used.
5893 roots?: string
5894
5895 // Subject is the verified identity used for keyless signing, for example the email address.
5896 subject?: string
5897
5898 // SubjectRegExp is the regular expression to match identity used for keyless
5899 // signing, for example the email address.
5900 subjectRegExp?: string
5901 }
5902
5903 // Keys specifies one or more public keys.
5904 keys?: {
5905 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
5906 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
5907 ctlog?: {
5908 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
5909 // to check for a certificate
5910 // timestamp. Default is false. Set to true if this was opted out during signing.
5911 ignoreSCT?: bool
5912
5913 // PubKey, if set, is used to validate SCTs against a custom source.
5914 pubkey?: string
5915
5916 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
5917 // RFC3161 timestamp authority. Must
5918 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
5919 // may contain the leaf TSA certificate if not present in the timestamurce.
5920 tsaCertChain?: string
5921 }
5922
5923 // KMS provides the URI to the public key stored in a Key Management System. See:
5924 // https://github.com/sigstore/cosign/blob/main/KMS.md
5925 kms?: string
5926
5927 // Keys is a set of X.509 public keys used to verify image signatures. The keys can be directly
5928 // specified or can be a variable reference to a key specified in a ConfigMap (see
5929 // https://kyverno.io/docs/writing-policies/variables/), or reference a standard Kubernetes Secret
5930 // elsewhere in the cluster by specifying it in the format "k8s://<namespace>/<secret_name>".
5931 // The named Secret must specify a key `cosign.pub` containing the public key used for
5932 // verification, (see https://github.com/sigstore/cosign/blob/main/KMS.md#kubernetes-secret).
5933 // When multiple keys are specified each key is processed as a separate staticKey entry
5934 // (.attestors[*].entries.keys) within the set of attestors and the count is
5935 // applied across the keys.
5936 publicKeys?: string
5937
5938 // Rekor provides configuration for the Rekor transparency log service. If an empty object
5939 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
5940 rekor?: {
5941 // IgnoreTlog skips transparency log verification.
5942 ignoreTlog?: bool
5943
5944 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
5945 // If set, this will be used to validate transparency log signatures from a custom Rekor.
5946 pubkey?: string
5947
5948 // URL is the address of the transparency log. Defaults to the public Rekor log
5949 // instance https://rekor.sigstore.dev.
5950 url?: string
5951 }
5952
5953 // Reference to a Secret resource that contains a public key
5954 secret?: {
5955 // Name of the secret. The provided secret must contain a key named cosign.pub.
5956 name!: string
5957
5958 // Namespace name where the Secret exists.
5959 namespace!: string
5960 }
5961
5962 // Deprecated. Use attestor.signatureAlgorithm instead.
5963 signatureAlgorithm?: string
5964 }
5965
5966 // Repository is an optional alternate OCI repository to use for signatures and
5967 // attestations that match this rule.
5968 // If specified Repository will override other OCI image repository locations for this Attestor.
5969 repository?: string
5970
5971 // Specify signature algorithm for public keys. Supported values are sha224,
5972 // sha256, sha384 and sha512.
5973 signatureAlgorithm?: string
5974 }]
5975 }]
5976
5977 // Conditions are used to verify attributes within a Predicate. If no Conditions are specified
5978 // the attestation check is satisfied as long there are predicates that match the predicate type.
5979 conditions?: [...{
5980 // AllConditions enable variable-based conditional rule execution. This is useful for
5981 // finer control of when an rule is applied. A condition can reference object data
5982 // using JMESPath notation.
5983 // Here, all of the conditions need to pass
5984 all?: [...{
5985 // Key is the context entry (using JMESPath) for conditional rule evaluation.
5986 key?: null | bool | number | string | [...] | {...}
5987
5988 // Message is an optional display message
5989 message?: string
5990
5991 // Operator is the conditional operation to perform. Valid operators are:
5992 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
5993 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
5994 // DurationLessThanOrEquals, DurationLessThan
5995 operator?: "Equals" |
5996 "NotEquals" |
5997 "In" |
5998 "AnyIn" |
5999 "AllIn" |
6000 "NotIn" |
6001 "AnyNotIn" |
6002 "AllNotIn" |
6003 "GreaterThanOrEquals" |
6004 "GreaterThan" |
6005 "LessThanOrEquals" |
6006 "LessThan" |
6007 "DurationGreaterThanOrEquals" |
6008 "DurationGreaterThan" |
6009 "DurationLessThanOrEquals" |
6010 "DurationLessThan"
6011
6012 // Value is the conditional value, or set of values. The values can be fixed set
6013 // or can be variables declared using JMESPath.
6014 value?: null | bool | number | string | [...] | {...}
6015 }]
6016
6017 // AnyConditions enable variable-based conditional rule execution. This is useful for
6018 // finer control of when an rule is applied. A condition can reference object data
6019 // using JMESPath notation.
6020 // Here, at least one of the conditions need to pass
6021 any?: [...{
6022 // Key is the context entry (using JMESPath) for conditional rule evaluation.
6023 key?: null | bool | number | string | [...] | {...}
6024
6025 // Message is an optional display message
6026 message?: string
6027
6028 // Operator is the conditional operation to perform. Valid operators are:
6029 // Equals, NotEquals, In, AnyIn, AllIn, NotIn, AnyNotIn, AllNotIn, GreaterThanOrEquals,
6030 // GreaterThan, LessThanOrEquals, LessThan, DurationGreaterThanOrEquals, DurationGreaterThan,
6031 // DurationLessThanOrEquals, DurationLessThan
6032 operator?: "Equals" |
6033 "NotEquals" |
6034 "In" |
6035 "AnyIn" |
6036 "AllIn" |
6037 "NotIn" |
6038 "AnyNotIn" |
6039 "AllNotIn" |
6040 "GreaterThanOrEquals" |
6041 "GreaterThan" |
6042 "LessThanOrEquals" |
6043 "LessThan" |
6044 "DurationGreaterThanOrEquals" |
6045 "DurationGreaterThan" |
6046 "DurationLessThanOrEquals" |
6047 "DurationLessThan"
6048
6049 // Value is the conditional value, or set of values. The values can be fixed set
6050 // or can be variables declared using JMESPath.
6051 value?: null | bool | number | string | [...] | {...}
6052 }]
6053 }]
6054
6055 // Name is the variable name.
6056 name?: string
6057
6058 // Deprecated in favour of 'Type', to be removed soon
6059 predicateType?: string
6060
6061 // Type defines the type of attestation contained within the Statement.
6062 type?: string
6063 }]
6064
6065 // Attestors specified the required attestors (i.e. authorities)
6066 attestors?: [...{
6067 // Count specifies the required number of entries that must match. If the count
6068 // is null, all entries must match
6069 // (a logical AND). If the count is 1, at least one entry must match (a logical
6070 // OR). If the count contains a
6071 // value N, then N must be less than or equal to the size of entries, and at
6072 // least N entries must match.
6073 count?: int & >=1
6074
6075 // Entries contains the available attestors. An attestor can be a static key,
6076 // attributes for keyless verification, or a nested attestor declaration.
6077 entries?: [...{
6078 // Annotations are used for image verification.
6079 // Every specified key-value pair must exist and match in the verified payload.
6080 // The payload may contain other key-value pairs.
6081 annotations?: [string]: string
6082
6083 // Attestor is a nested set of Attestor used to specify a more complex set of match authorities.
6084 attestor?: null | bool | number | string | [...] | {...}
6085
6086 // Certificates specifies one or more certificates.
6087 certificates?: {
6088 // Cert is an optional PEM-encoded public certificate.
6089 cert?: string
6090
6091 // CertChain is an optional PEM encoded set of certificates used to verify.
6092 certChain?: string
6093
6094 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
6095 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
6096 ctlog?: {
6097 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
6098 // to check for a certificate
6099 // timestamp. Default is false. Set to true if this was opted out during signing.
6100 ignoreSCT?: bool
6101
6102 // PubKey, if set, is used to validate SCTs against a custom source.
6103 pubkey?: string
6104
6105 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
6106 // RFC3161 timestamp authority. Must
6107 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
6108 // may contain the leaf TSA certificate if not present in the timestamurce.
6109 tsaCertChain?: string
6110 }
6111
6112 // Rekor provides configuration for the Rekor transparency log service. If an empty object
6113 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
6114 rekor?: {
6115 // IgnoreTlog skips transparency log verification.
6116 ignoreTlog?: bool
6117
6118 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
6119 // If set, this will be used to validate transparency log signatures from a custom Rekor.
6120 pubkey?: string
6121
6122 // URL is the address of the transparency log. Defaults to the public Rekor log
6123 // instance https://rekor.sigstore.dev.
6124 url?: string
6125 }
6126 }
6127
6128 // Keyless is a set of attribute used to verify a Sigstore keyless attestor.
6129 // See https://github.com/sigstore/cosign/blob/main/KEYLESS.md.
6130 keyless?: {
6131 // AdditionalExtensions are certificate-extensions used for keyless signing.
6132 additionalExtensions?: [string]: string
6133
6134 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
6135 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
6136 ctlog?: {
6137 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
6138 // to check for a certificate
6139 // timestamp. Default is false. Set to true if this was opted out during signing.
6140 ignoreSCT?: bool
6141
6142 // PubKey, if set, is used to validate SCTs against a custom source.
6143 pubkey?: string
6144
6145 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
6146 // RFC3161 timestamp authority. Must
6147 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
6148 // may contain the leaf TSA certificate if not present in the timestamurce.
6149 tsaCertChain?: string
6150 }
6151
6152 // Issuer is the certificate issuer used for keyless signing.
6153 issuer?: string
6154
6155 // IssuerRegExp is the regular expression to match certificate issuer used for keyless signing.
6156 issuerRegExp?: string
6157
6158 // Rekor provides configuration for the Rekor transparency log service. If an empty object
6159 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
6160 rekor?: {
6161 // IgnoreTlog skips transparency log verification.
6162 ignoreTlog?: bool
6163
6164 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
6165 // If set, this will be used to validate transparency log signatures from a custom Rekor.
6166 pubkey?: string
6167
6168 // URL is the address of the transparency log. Defaults to the public Rekor log
6169 // instance https://rekor.sigstore.dev.
6170 url?: string
6171 }
6172
6173 // Roots is an optional set of PEM encoded trusted root certificates.
6174 // If not provided, the system roots are used.
6175 roots?: string
6176
6177 // Subject is the verified identity used for keyless signing, for example the email address.
6178 subject?: string
6179
6180 // SubjectRegExp is the regular expression to match identity used for keyless
6181 // signing, for example the email address.
6182 subjectRegExp?: string
6183 }
6184
6185 // Keys specifies one or more public keys.
6186 keys?: {
6187 // CTLog (certificate timestamp log) provides a configuration for validation of Signed Certificate
6188 // Timestamps (SCTs). If the value is unset, the default behavior by Cosign is used.
6189 ctlog?: {
6190 // IgnoreSCT defines whether to use the Signed Certificate Timestamp (SCT) log
6191 // to check for a certificate
6192 // timestamp. Default is false. Set to true if this was opted out during signing.
6193 ignoreSCT?: bool
6194
6195 // PubKey, if set, is used to validate SCTs against a custom source.
6196 pubkey?: string
6197
6198 // TSACertChain, if set, is the PEM-encoded certificate chain file for the
6199 // RFC3161 timestamp authority. Must
6200 // contain the root CA certificate. Optionally may contain intermediate CA certificates, and
6201 // may contain the leaf TSA certificate if not present in the timestamurce.
6202 tsaCertChain?: string
6203 }
6204
6205 // KMS provides the URI to the public key stored in a Key Management System. See:
6206 // https://github.com/sigstore/cosign/blob/main/KMS.md
6207 kms?: string
6208
6209 // Keys is a set of X.509 public keys used to verify image signatures. The keys can be directly
6210 // specified or can be a variable reference to a key specified in a ConfigMap (see
6211 // https://kyverno.io/docs/writing-policies/variables/), or reference a standard Kubernetes Secret
6212 // elsewhere in the cluster by specifying it in the format "k8s://<namespace>/<secret_name>".
6213 // The named Secret must specify a key `cosign.pub` containing the public key used for
6214 // verification, (see https://github.com/sigstore/cosign/blob/main/KMS.md#kubernetes-secret).
6215 // When multiple keys are specified each key is processed as a separate staticKey entry
6216 // (.attestors[*].entries.keys) within the set of attestors and the count is
6217 // applied across the keys.
6218 publicKeys?: string
6219
6220 // Rekor provides configuration for the Rekor transparency log service. If an empty object
6221 // is provided the public instance of Rekor (https://rekor.sigstore.dev) is used.
6222 rekor?: {
6223 // IgnoreTlog skips transparency log verification.
6224 ignoreTlog?: bool
6225
6226 // RekorPubKey is an optional PEM-encoded public key to use for a custom Rekor.
6227 // If set, this will be used to validate transparency log signatures from a custom Rekor.
6228 pubkey?: string
6229
6230 // URL is the address of the transparency log. Defaults to the public Rekor log
6231 // instance https://rekor.sigstore.dev.
6232 url?: string
6233 }
6234
6235 // Reference to a Secret resource that contains a public key
6236 secret?: {
6237 // Name of the secret. The provided secret must contain a key named cosign.pub.
6238 name!: string
6239
6240 // Namespace name where the Secret exists.
6241 namespace!: string
6242 }
6243
6244 // Deprecated. Use attestor.signatureAlgorithm instead.
6245 signatureAlgorithm?: string
6246 }
6247
6248 // Repository is an optional alternate OCI repository to use for signatures and
6249 // attestations that match this rule.
6250 // If specified Repository will override other OCI image repository locations for this Attestor.
6251 repository?: string
6252
6253 // Specify signature algorithm for public keys. Supported values are sha224,
6254 // sha256, sha384 and sha512.
6255 signatureAlgorithm?: string
6256 }]
6257 }]
6258
6259 // CosignOCI11 enables the experimental OCI 1.1 behaviour in cosign image verification.
6260 // Defaults to false.
6261 cosignOCI11?: bool
6262
6263 // Allowed values are Audit or Enforce.
6264 failureAction?: "Audit" | "Enforce"
6265
6266 // Deprecated. Use ImageReferences instead.
6267 image?: string
6268
6269 // ImageReferences is a list of matching image reference patterns. At least one pattern in the
6270 // list must match the image for the rule to apply. Each image reference consists of a registry
6271 // address (defaults to docker.io), repository, image, and tag (defaults to latest).
6272 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
6273 imageReferences?: [...string]
6274
6275 // ImageRegistryCredentials provides credentials that will be used for authentication with registry.
6276 imageRegistryCredentials?: {
6277 // AllowInsecureRegistry allows insecure access to a registry.
6278 allowInsecureRegistry?: bool
6279
6280 // Providers specifies a list of OCI Registry names, whose authentication providers are provided.
6281 // It can be of one of these values: default,google,azure,amazon,github.
6282 providers?: [..."default" | "amazon" | "azure" | "google" | "github"]
6283
6284 // Secrets specifies a list of secrets that are provided for credentials.
6285 // Secrets can be specified as a name (Kyverno namespace) or namespace/name.
6286 // imagePullSecrets from the resource namespace are also used.
6287 secrets?: [...string]
6288 }
6289
6290 // Deprecated. Use KeylessAttestor instead.
6291 issuer?: string
6292
6293 // Deprecated. Use StaticKeyAttestor instead.
6294 key?: string
6295
6296 // MutateDigest enables replacement of image tags with digests.
6297 // Defaults to true.
6298 mutateDigest?: bool
6299
6300 // Repository is an optional alternate OCI repository to use for image
6301 // signatures and attestations that match this rule.
6302 // If specified Repository will override the default OCI image repository
6303 // configured for the installation.
6304 // The repository can also be overridden per Attestor or Attestation.
6305 repository?: string
6306
6307 // Required validates that images are verified i.e. have matched passed a
6308 // signature or attestation check.
6309 required?: bool
6310
6311 // Deprecated. Use KeylessAttestor instead.
6312 roots?: string
6313
6314 // SkipImageReferences is a list of matching image reference patterns that should be skipped.
6315 // At least one pattern in the list must match the image for the rule to be
6316 // skipped. Each image reference
6317 // consists of a registry address (defaults to docker.io), repository, image,
6318 // and tag (defaults to latest).
6319 // Wildcards ('*' and '?') are allowed. See: https://kubernetes.io/docs/concepts/containers/images.
6320 skipImageReferences?: [...string]
6321
6322 // Deprecated. Use KeylessAttestor instead.
6323 subject?: string
6324
6325 // Type specifies the method of signature validation. The allowed options
6326 // are Cosign, Sigstore Bundle and Notary. By default Cosign is used if a type is not specified.
6327 type?: "Cosign" | "SigstoreBundle" | "Notary"
6328
6329 // UseCache enables caching of image verify responses for this rule.
6330 useCache?: bool
6331
6332 // Validation checks conditions across multiple image
6333 // verification attestations or context entries
6334 validate?: {
6335 // Deny defines conditions used to pass or fail a validation rule.
6336 deny?: {
6337 // Multiple conditions can be declared under an `any` or `all` statement. A direct list
6338 // of conditions (without `any` or `all` statements) is also supported for backwards compatibility
6339 // but will be deprecated in the next major release.
6340 // See: https://kyverno.io/docs/writing-policies/validate/#deny-rules
6341 conditions?: null | bool | number | string | [...] | {...}
6342 }
6343
6344 // Message specifies a custom message to be displayed on failure.
6345 message?: string
6346 }
6347
6348 // VerifyDigest validates that images have a digest.
6349 verifyDigest?: bool
6350 }]
6351 }]
6352 }
6353 conditions?: [...{
6354 // lastTransitionTime is the last time the condition transitioned from one status to another.
6355 // This should be when the underlying condition changed. If that is not known,
6356 // then using the time when the API field changed is acceptable.
6357 lastTransitionTime!: time.Time
6358
6359 // message is a human readable message indicating details about the transition.
6360 // This may be an empty string.
6361 message!: strings.MaxRunes(
6362 32768,
6363 )
6364
6365 // observedGeneration represents the .metadata.generation that the condition was set based upon.
6366 // For instance, if .metadata.generation is currently 12, but the
6367 // .status.conditions[x].observedGeneration is 9, the condition is out of date
6368 // with respect to the current state of the instance.
6369 observedGeneration?: int64 & int & >=0
6370
6371 // reason contains a programmatic identifier indicating the reason for the
6372 // condition's last transition.
6373 // Producers of specific condition types may define expected values and meanings for this field,
6374 // and whether the values are considered a guaranteed API.
6375 // The value should be a CamelCase string.
6376 // This field may not be empty.
6377 reason!: strings.MaxRunes(
6378 1024,
6379 ) &
6380 strings.MinRunes(
6381 1,
6382 ) &
6383 =~"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$"
6384
6385 // status of the condition, one of True, False, Unknown.
6386 status!: "True" | "False" | "Unknown"
6387
6388 // type of condition in CamelCase or in foo.example.com/CamelCase.
6389 type!: strings.MaxRunes(
6390 316,
6391 ) &
6392 =~"^([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])$"
6393 }]
6394
6395 // Deprecated in favor of Conditions
6396 ready?: bool
6397
6398 // RuleCountStatus contains four variables which describes counts for
6399 // validate, generate, mutate and verify images rules
6400 rulecount?: {
6401 // Count for generate rules in policy
6402 generate!: int
6403
6404 // Count for mutate rules in policy
6405 mutate!: int
6406
6407 // Count for validate rules in policy
6408 validate!: int
6409
6410 // Count for verify image rules in policy
6411 verifyimages!: int
6412 }
6413
6414 // ValidatingAdmissionPolicy contains status information
6415 validatingadmissionpolicy?: {
6416 // Generated indicates whether a validating admission policy is generated from the policy or not
6417 generated!: bool
6418
6419 // Message is a human readable message indicating details about the generation
6420 // of validating admission policy
6421 // It is an empty string when validating admission policy is successfully generated.
6422 message!: string
6423 }
6424 }
6425
6426 _embeddedResource: {
6427 apiVersion!: string
6428 kind!: string
6429 metadata?: {...}
6430 }
6431 apiVersion: "kyverno.io/v2beta1"
6432 kind: "ClusterPolicy"
6433 metadata!: {
6434 name!: string
6435 namespace?: string
6436 labels?: [string]: string
6437 annotations?: [string]: string
6438 ...
6439 }
6440}