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