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