...

Text file src/k8s.io/api/admissionregistration/v1/generated.proto

Documentation: k8s.io/api/admissionregistration/v1

     1/*
     2Copyright The Kubernetes Authors.
     3
     4Licensed under the Apache License, Version 2.0 (the "License");
     5you may not use this file except in compliance with the License.
     6You may obtain a copy of the License at
     7
     8    http://www.apache.org/licenses/LICENSE-2.0
     9
    10Unless required by applicable law or agreed to in writing, software
    11distributed under the License is distributed on an "AS IS" BASIS,
    12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13See the License for the specific language governing permissions and
    14limitations under the License.
    15*/
    16
    17
    18// This file was autogenerated by go-to-protobuf. Do not edit it manually!
    19
    20syntax = "proto2";
    21
    22package k8s.io.api.admissionregistration.v1;
    23
    24import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
    25import "k8s.io/apimachinery/pkg/runtime/generated.proto";
    26import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
    27
    28// Package-wide variables from generator "generated".
    29option go_package = "k8s.io/api/admissionregistration/v1";
    30
    31// AuditAnnotation describes how to produce an audit annotation for an API request.
    32message AuditAnnotation {
    33  // key specifies the audit annotation key. The audit annotation keys of
    34  // a ValidatingAdmissionPolicy must be unique. The key must be a qualified
    35  // name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.
    36  //
    37  // The key is combined with the resource name of the
    38  // ValidatingAdmissionPolicy to construct an audit annotation key:
    39  // "{ValidatingAdmissionPolicy name}/{key}".
    40  //
    41  // If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy
    42  // and the same audit annotation key, the annotation key will be identical.
    43  // In this case, the first annotation written with the key will be included
    44  // in the audit event and all subsequent annotations with the same key
    45  // will be discarded.
    46  //
    47  // Required.
    48  optional string key = 1;
    49
    50  // valueExpression represents the expression which is evaluated by CEL to
    51  // produce an audit annotation value. The expression must evaluate to either
    52  // a string or null value. If the expression evaluates to a string, the
    53  // audit annotation is included with the string value. If the expression
    54  // evaluates to null or empty string the audit annotation will be omitted.
    55  // The valueExpression may be no longer than 5kb in length.
    56  // If the result of the valueExpression is more than 10kb in length, it
    57  // will be truncated to 10kb.
    58  //
    59  // If multiple ValidatingAdmissionPolicyBinding resources match an
    60  // API request, then the valueExpression will be evaluated for
    61  // each binding. All unique values produced by the valueExpressions
    62  // will be joined together in a comma-separated list.
    63  //
    64  // Required.
    65  optional string valueExpression = 2;
    66}
    67
    68// ExpressionWarning is a warning information that targets a specific expression.
    69message ExpressionWarning {
    70  // The path to the field that refers the expression.
    71  // For example, the reference to the expression of the first item of
    72  // validations is "spec.validations[0].expression"
    73  optional string fieldRef = 2;
    74
    75  // The content of type checking information in a human-readable form.
    76  // Each line of the warning contains the type that the expression is checked
    77  // against, followed by the type check error from the compiler.
    78  optional string warning = 3;
    79}
    80
    81// MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook.
    82message MatchCondition {
    83  // Name is an identifier for this match condition, used for strategic merging of MatchConditions,
    84  // as well as providing an identifier for logging purposes. A good name should be descriptive of
    85  // the associated expression.
    86  // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and
    87  // must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or
    88  // '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an
    89  // optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')
    90  //
    91  // Required.
    92  optional string name = 1;
    93
    94  // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool.
    95  // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:
    96  //
    97  // 'object' - The object from the incoming request. The value is null for DELETE requests.
    98  // 'oldObject' - The existing object. The value is null for CREATE requests.
    99  // 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest).
   100  // 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
   101  //   See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
   102  // 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the
   103  //   request resource.
   104  // Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
   105  //
   106  // Required.
   107  optional string expression = 2;
   108}
   109
   110// MatchResources decides whether to run the admission control policy on an object based
   111// on whether it meets the match criteria.
   112// The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
   113// +structType=atomic
   114message MatchResources {
   115  // NamespaceSelector decides whether to run the admission control policy on an object based
   116  // on whether the namespace for that object matches the selector. If the
   117  // object itself is a namespace, the matching is performed on
   118  // object.metadata.labels. If the object is another cluster scoped resource,
   119  // it never skips the policy.
   120  //
   121  // For example, to run the webhook on any objects whose namespace is not
   122  // associated with "runlevel" of "0" or "1";  you will set the selector as
   123  // follows:
   124  // "namespaceSelector": {
   125  //   "matchExpressions": [
   126  //     {
   127  //       "key": "runlevel",
   128  //       "operator": "NotIn",
   129  //       "values": [
   130  //         "0",
   131  //         "1"
   132  //       ]
   133  //     }
   134  //   ]
   135  // }
   136  //
   137  // If instead you want to only run the policy on any objects whose
   138  // namespace is associated with the "environment" of "prod" or "staging";
   139  // you will set the selector as follows:
   140  // "namespaceSelector": {
   141  //   "matchExpressions": [
   142  //     {
   143  //       "key": "environment",
   144  //       "operator": "In",
   145  //       "values": [
   146  //         "prod",
   147  //         "staging"
   148  //       ]
   149  //     }
   150  //   ]
   151  // }
   152  //
   153  // See
   154  // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
   155  // for more examples of label selectors.
   156  //
   157  // Default to the empty LabelSelector, which matches everything.
   158  // +optional
   159  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 1;
   160
   161  // ObjectSelector decides whether to run the validation based on if the
   162  // object has matching labels. objectSelector is evaluated against both
   163  // the oldObject and newObject that would be sent to the cel validation, and
   164  // is considered to match if either object matches the selector. A null
   165  // object (oldObject in the case of create, or newObject in the case of
   166  // delete) or an object that cannot have labels (like a
   167  // DeploymentRollback or a PodProxyOptions object) is not considered to
   168  // match.
   169  // Use the object selector only if the webhook is opt-in, because end
   170  // users may skip the admission webhook by setting the labels.
   171  // Default to the empty LabelSelector, which matches everything.
   172  // +optional
   173  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 2;
   174
   175  // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches.
   176  // The policy cares about an operation if it matches _any_ Rule.
   177  // +listType=atomic
   178  // +optional
   179  repeated NamedRuleWithOperations resourceRules = 3;
   180
   181  // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about.
   182  // The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
   183  // +listType=atomic
   184  // +optional
   185  repeated NamedRuleWithOperations excludeResourceRules = 4;
   186
   187  // matchPolicy defines how the "MatchResources" list is used to match incoming requests.
   188  // Allowed values are "Exact" or "Equivalent".
   189  //
   190  // - Exact: match a request only if it exactly matches a specified rule.
   191  // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
   192  // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
   193  // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.
   194  //
   195  // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
   196  // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
   197  // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
   198  // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.
   199  //
   200  // Defaults to "Equivalent"
   201  // +optional
   202  optional string matchPolicy = 7;
   203}
   204
   205// MutatingWebhook describes an admission webhook and the resources and operations it applies to.
   206message MutatingWebhook {
   207  // The name of the admission webhook.
   208  // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
   209  // "imagepolicy" is the name of the webhook, and kubernetes.io is the name
   210  // of the organization.
   211  // Required.
   212  optional string name = 1;
   213
   214  // ClientConfig defines how to communicate with the hook.
   215  // Required
   216  optional WebhookClientConfig clientConfig = 2;
   217
   218  // Rules describes what operations on what resources/subresources the webhook cares about.
   219  // The webhook cares about an operation if it matches _any_ Rule.
   220  // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks
   221  // from putting the cluster in a state which cannot be recovered from without completely
   222  // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called
   223  // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.
   224  // +listType=atomic
   225  repeated RuleWithOperations rules = 3;
   226
   227  // FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
   228  // allowed values are Ignore or Fail. Defaults to Fail.
   229  // +optional
   230  optional string failurePolicy = 4;
   231
   232  // matchPolicy defines how the "rules" list is used to match incoming requests.
   233  // Allowed values are "Exact" or "Equivalent".
   234  //
   235  // - Exact: match a request only if it exactly matches a specified rule.
   236  // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
   237  // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
   238  // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.
   239  //
   240  // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
   241  // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
   242  // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
   243  // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.
   244  //
   245  // Defaults to "Equivalent"
   246  // +optional
   247  optional string matchPolicy = 9;
   248
   249  // NamespaceSelector decides whether to run the webhook on an object based
   250  // on whether the namespace for that object matches the selector. If the
   251  // object itself is a namespace, the matching is performed on
   252  // object.metadata.labels. If the object is another cluster scoped resource,
   253  // it never skips the webhook.
   254  //
   255  // For example, to run the webhook on any objects whose namespace is not
   256  // associated with "runlevel" of "0" or "1";  you will set the selector as
   257  // follows:
   258  // "namespaceSelector": {
   259  //   "matchExpressions": [
   260  //     {
   261  //       "key": "runlevel",
   262  //       "operator": "NotIn",
   263  //       "values": [
   264  //         "0",
   265  //         "1"
   266  //       ]
   267  //     }
   268  //   ]
   269  // }
   270  //
   271  // If instead you want to only run the webhook on any objects whose
   272  // namespace is associated with the "environment" of "prod" or "staging";
   273  // you will set the selector as follows:
   274  // "namespaceSelector": {
   275  //   "matchExpressions": [
   276  //     {
   277  //       "key": "environment",
   278  //       "operator": "In",
   279  //       "values": [
   280  //         "prod",
   281  //         "staging"
   282  //       ]
   283  //     }
   284  //   ]
   285  // }
   286  //
   287  // See
   288  // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
   289  // for more examples of label selectors.
   290  //
   291  // Default to the empty LabelSelector, which matches everything.
   292  // +optional
   293  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5;
   294
   295  // ObjectSelector decides whether to run the webhook based on if the
   296  // object has matching labels. objectSelector is evaluated against both
   297  // the oldObject and newObject that would be sent to the webhook, and
   298  // is considered to match if either object matches the selector. A null
   299  // object (oldObject in the case of create, or newObject in the case of
   300  // delete) or an object that cannot have labels (like a
   301  // DeploymentRollback or a PodProxyOptions object) is not considered to
   302  // match.
   303  // Use the object selector only if the webhook is opt-in, because end
   304  // users may skip the admission webhook by setting the labels.
   305  // Default to the empty LabelSelector, which matches everything.
   306  // +optional
   307  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 11;
   308
   309  // SideEffects states whether this webhook has side effects.
   310  // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown).
   311  // Webhooks with side effects MUST implement a reconciliation system, since a request may be
   312  // rejected by a future step in the admission chain and the side effects therefore need to be undone.
   313  // Requests with the dryRun attribute will be auto-rejected if they match a webhook with
   314  // sideEffects == Unknown or Some.
   315  optional string sideEffects = 6;
   316
   317  // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
   318  // the webhook call will be ignored or the API call will fail based on the
   319  // failure policy.
   320  // The timeout value must be between 1 and 30 seconds.
   321  // Default to 10 seconds.
   322  // +optional
   323  optional int32 timeoutSeconds = 7;
   324
   325  // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`
   326  // versions the Webhook expects. API server will try to use first version in
   327  // the list which it supports. If none of the versions specified in this list
   328  // supported by API server, validation will fail for this object.
   329  // If a persisted webhook configuration specifies allowed versions and does not
   330  // include any versions known to the API Server, calls to the webhook will fail
   331  // and be subject to the failure policy.
   332  // +listType=atomic
   333  repeated string admissionReviewVersions = 8;
   334
   335  // reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation.
   336  // Allowed values are "Never" and "IfNeeded".
   337  //
   338  // Never: the webhook will not be called more than once in a single admission evaluation.
   339  //
   340  // IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation
   341  // if the object being admitted is modified by other admission plugins after the initial webhook call.
   342  // Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted.
   343  // Note:
   344  // * the number of additional invocations is not guaranteed to be exactly one.
   345  // * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again.
   346  // * webhooks that use this option may be reordered to minimize the number of additional invocations.
   347  // * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.
   348  //
   349  // Defaults to "Never".
   350  // +optional
   351  optional string reinvocationPolicy = 10;
   352
   353  // MatchConditions is a list of conditions that must be met for a request to be sent to this
   354  // webhook. Match conditions filter requests that have already been matched by the rules,
   355  // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.
   356  // There are a maximum of 64 match conditions allowed.
   357  //
   358  // The exact matching logic is (in order):
   359  //   1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.
   360  //   2. If ALL matchConditions evaluate to TRUE, the webhook is called.
   361  //   3. If any matchCondition evaluates to an error (but none are FALSE):
   362  //      - If failurePolicy=Fail, reject the request
   363  //      - If failurePolicy=Ignore, the error is ignored and the webhook is skipped
   364  //
   365  // +patchMergeKey=name
   366  // +patchStrategy=merge
   367  // +listType=map
   368  // +listMapKey=name
   369  // +optional
   370  repeated MatchCondition matchConditions = 12;
   371}
   372
   373// MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.
   374message MutatingWebhookConfiguration {
   375  // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
   376  // +optional
   377  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
   378
   379  // Webhooks is a list of webhooks and the affected resources and operations.
   380  // +optional
   381  // +patchMergeKey=name
   382  // +patchStrategy=merge
   383  // +listType=map
   384  // +listMapKey=name
   385  repeated MutatingWebhook Webhooks = 2;
   386}
   387
   388// MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.
   389message MutatingWebhookConfigurationList {
   390  // Standard list metadata.
   391  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
   392  // +optional
   393  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
   394
   395  // List of MutatingWebhookConfiguration.
   396  repeated MutatingWebhookConfiguration items = 2;
   397}
   398
   399// NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.
   400// +structType=atomic
   401message NamedRuleWithOperations {
   402  // ResourceNames is an optional white list of names that the rule applies to.  An empty set means that everything is allowed.
   403  // +listType=atomic
   404  // +optional
   405  repeated string resourceNames = 1;
   406
   407  // RuleWithOperations is a tuple of Operations and Resources.
   408  optional RuleWithOperations ruleWithOperations = 2;
   409}
   410
   411// ParamKind is a tuple of Group Kind and Version.
   412// +structType=atomic
   413message ParamKind {
   414  // APIVersion is the API group version the resources belong to.
   415  // In format of "group/version".
   416  // Required.
   417  optional string apiVersion = 1;
   418
   419  // Kind is the API kind the resources belong to.
   420  // Required.
   421  optional string kind = 2;
   422}
   423
   424// ParamRef describes how to locate the params to be used as input to
   425// expressions of rules applied by a policy binding.
   426// +structType=atomic
   427message ParamRef {
   428  // name is the name of the resource being referenced.
   429  //
   430  // One of `name` or `selector` must be set, but `name` and `selector` are
   431  // mutually exclusive properties. If one is set, the other must be unset.
   432  //
   433  // A single parameter used for all admission requests can be configured
   434  // by setting the `name` field, leaving `selector` blank, and setting namespace
   435  // if `paramKind` is namespace-scoped.
   436  optional string name = 1;
   437
   438  // namespace is the namespace of the referenced resource. Allows limiting
   439  // the search for params to a specific namespace. Applies to both `name` and
   440  // `selector` fields.
   441  //
   442  // A per-namespace parameter may be used by specifying a namespace-scoped
   443  // `paramKind` in the policy and leaving this field empty.
   444  //
   445  // - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this
   446  // field results in a configuration error.
   447  //
   448  // - If `paramKind` is namespace-scoped, the namespace of the object being
   449  // evaluated for admission will be used when this field is left unset. Take
   450  // care that if this is left empty the binding must not match any cluster-scoped
   451  // resources, which will result in an error.
   452  //
   453  // +optional
   454  optional string namespace = 2;
   455
   456  // selector can be used to match multiple param objects based on their labels.
   457  // Supply selector: {} to match all resources of the ParamKind.
   458  //
   459  // If multiple params are found, they are all evaluated with the policy expressions
   460  // and the results are ANDed together.
   461  //
   462  // One of `name` or `selector` must be set, but `name` and `selector` are
   463  // mutually exclusive properties. If one is set, the other must be unset.
   464  //
   465  // +optional
   466  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3;
   467
   468  // `parameterNotFoundAction` controls the behavior of the binding when the resource
   469  // exists, and name or selector is valid, but there are no parameters
   470  // matched by the binding. If the value is set to `Allow`, then no
   471  // matched parameters will be treated as successful validation by the binding.
   472  // If set to `Deny`, then no matched parameters will be subject to the
   473  // `failurePolicy` of the policy.
   474  //
   475  // Allowed values are `Allow` or `Deny`
   476  //
   477  // Required
   478  optional string parameterNotFoundAction = 4;
   479}
   480
   481// Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended
   482// to make sure that all the tuple expansions are valid.
   483message Rule {
   484  // APIGroups is the API groups the resources belong to. '*' is all groups.
   485  // If '*' is present, the length of the slice must be one.
   486  // Required.
   487  // +listType=atomic
   488  repeated string apiGroups = 1;
   489
   490  // APIVersions is the API versions the resources belong to. '*' is all versions.
   491  // If '*' is present, the length of the slice must be one.
   492  // Required.
   493  // +listType=atomic
   494  repeated string apiVersions = 2;
   495
   496  // Resources is a list of resources this rule applies to.
   497  //
   498  // For example:
   499  // 'pods' means pods.
   500  // 'pods/log' means the log subresource of pods.
   501  // '*' means all resources, but not subresources.
   502  // 'pods/*' means all subresources of pods.
   503  // '*/scale' means all scale subresources.
   504  // '*/*' means all resources and their subresources.
   505  //
   506  // If wildcard is present, the validation rule will ensure resources do not
   507  // overlap with each other.
   508  //
   509  // Depending on the enclosing object, subresources might not be allowed.
   510  // Required.
   511  // +listType=atomic
   512  repeated string resources = 3;
   513
   514  // scope specifies the scope of this rule.
   515  // Valid values are "Cluster", "Namespaced", and "*"
   516  // "Cluster" means that only cluster-scoped resources will match this rule.
   517  // Namespace API objects are cluster-scoped.
   518  // "Namespaced" means that only namespaced resources will match this rule.
   519  // "*" means that there are no scope restrictions.
   520  // Subresources match the scope of their parent resource.
   521  // Default is "*".
   522  //
   523  // +optional
   524  optional string scope = 4;
   525}
   526
   527// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
   528// sure that all the tuple expansions are valid.
   529message RuleWithOperations {
   530  // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or *
   531  // for all of those operations and any future admission operations that are added.
   532  // If '*' is present, the length of the slice must be one.
   533  // Required.
   534  // +listType=atomic
   535  repeated string operations = 1;
   536
   537  // Rule is embedded, it describes other criteria of the rule, like
   538  // APIGroups, APIVersions, Resources, etc.
   539  optional Rule rule = 2;
   540}
   541
   542// ServiceReference holds a reference to Service.legacy.k8s.io
   543message ServiceReference {
   544  // `namespace` is the namespace of the service.
   545  // Required
   546  optional string namespace = 1;
   547
   548  // `name` is the name of the service.
   549  // Required
   550  optional string name = 2;
   551
   552  // `path` is an optional URL path which will be sent in any request to
   553  // this service.
   554  // +optional
   555  optional string path = 3;
   556
   557  // If specified, the port on the service that hosting webhook.
   558  // Default to 443 for backward compatibility.
   559  // `port` should be a valid port number (1-65535, inclusive).
   560  // +optional
   561  optional int32 port = 4;
   562}
   563
   564// TypeChecking contains results of type checking the expressions in the
   565// ValidatingAdmissionPolicy
   566message TypeChecking {
   567  // The type checking warnings for each expression.
   568  // +optional
   569  // +listType=atomic
   570  repeated ExpressionWarning expressionWarnings = 1;
   571}
   572
   573// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   574// +genclient
   575// +genclient:nonNamespaced
   576// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   577// +k8s:prerelease-lifecycle-gen:introduced=1.30
   578// ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.
   579message ValidatingAdmissionPolicy {
   580  // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
   581  // +optional
   582  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
   583
   584  // Specification of the desired behavior of the ValidatingAdmissionPolicy.
   585  optional ValidatingAdmissionPolicySpec spec = 2;
   586
   587  // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy
   588  // behaves in the expected way.
   589  // Populated by the system.
   590  // Read-only.
   591  // +optional
   592  optional ValidatingAdmissionPolicyStatus status = 3;
   593}
   594
   595// ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources.
   596// ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.
   597//
   598// For a given admission request, each binding will cause its policy to be
   599// evaluated N times, where N is 1 for policies/bindings that don't use
   600// params, otherwise N is the number of parameters selected by the binding.
   601//
   602// The CEL expressions of a policy must have a computed CEL cost below the maximum
   603// CEL budget. Each evaluation of the policy is given an independent CEL cost budget.
   604// Adding/removing policies, bindings, or params can not affect whether a
   605// given (policy, binding, param) combination is within its own CEL budget.
   606message ValidatingAdmissionPolicyBinding {
   607  // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
   608  // +optional
   609  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
   610
   611  // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.
   612  optional ValidatingAdmissionPolicyBindingSpec spec = 2;
   613}
   614
   615// ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding.
   616message ValidatingAdmissionPolicyBindingList {
   617  // Standard list metadata.
   618  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
   619  // +optional
   620  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
   621
   622  // List of PolicyBinding.
   623  repeated ValidatingAdmissionPolicyBinding items = 2;
   624}
   625
   626// ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.
   627message ValidatingAdmissionPolicyBindingSpec {
   628  // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to.
   629  // If the referenced resource does not exist, this binding is considered invalid and will be ignored
   630  // Required.
   631  optional string policyName = 1;
   632
   633  // paramRef specifies the parameter resource used to configure the admission control policy.
   634  // It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy.
   635  // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied.
   636  // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.
   637  // +optional
   638  optional ParamRef paramRef = 2;
   639
   640  // MatchResources declares what resources match this binding and will be validated by it.
   641  // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this.
   642  // If this is unset, all resources matched by the policy are validated by this binding
   643  // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated.
   644  // Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.
   645  // +optional
   646  optional MatchResources matchResources = 3;
   647
   648  // validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced.
   649  // If a validation evaluates to false it is always enforced according to these actions.
   650  //
   651  // Failures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according
   652  // to these actions only if the FailurePolicy is set to Fail, otherwise the failures are
   653  // ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.
   654  //
   655  // validationActions is declared as a set of action values. Order does
   656  // not matter. validationActions may not contain duplicates of the same action.
   657  //
   658  // The supported actions values are:
   659  //
   660  // "Deny" specifies that a validation failure results in a denied request.
   661  //
   662  // "Warn" specifies that a validation failure is reported to the request client
   663  // in HTTP Warning headers, with a warning code of 299. Warnings can be sent
   664  // both for allowed or denied admission responses.
   665  //
   666  // "Audit" specifies that a validation failure is included in the published
   667  // audit event for the request. The audit event will contain a
   668  // `validation.policy.admission.k8s.io/validation_failure` audit annotation
   669  // with a value containing the details of the validation failures, formatted as
   670  // a JSON list of objects, each with the following fields:
   671  // - message: The validation failure message string
   672  // - policy: The resource name of the ValidatingAdmissionPolicy
   673  // - binding: The resource name of the ValidatingAdmissionPolicyBinding
   674  // - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy
   675  // - validationActions: The enforcement actions enacted for the validation failure
   676  // Example audit annotation:
   677  // `"validation.policy.admission.k8s.io/validation_failure": "[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]"`
   678  //
   679  // Clients should expect to handle additional values by ignoring
   680  // any values not recognized.
   681  //
   682  // "Deny" and "Warn" may not be used together since this combination
   683  // needlessly duplicates the validation failure both in the
   684  // API response body and the HTTP warning headers.
   685  //
   686  // Required.
   687  // +listType=set
   688  repeated string validationActions = 4;
   689}
   690
   691// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   692// +k8s:prerelease-lifecycle-gen:introduced=1.30
   693// ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy.
   694message ValidatingAdmissionPolicyList {
   695  // Standard list metadata.
   696  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
   697  // +optional
   698  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
   699
   700  // List of ValidatingAdmissionPolicy.
   701  repeated ValidatingAdmissionPolicy items = 2;
   702}
   703
   704// ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.
   705message ValidatingAdmissionPolicySpec {
   706  // ParamKind specifies the kind of resources used to parameterize this policy.
   707  // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions.
   708  // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied.
   709  // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.
   710  // +optional
   711  optional ParamKind paramKind = 1;
   712
   713  // MatchConstraints specifies what resources this policy is designed to validate.
   714  // The AdmissionPolicy cares about a request if it matches _all_ Constraints.
   715  // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API
   716  // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding.
   717  // Required.
   718  optional MatchResources matchConstraints = 2;
   719
   720  // Validations contain CEL expressions which is used to apply the validation.
   721  // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is
   722  // required.
   723  // +listType=atomic
   724  // +optional
   725  repeated Validation validations = 3;
   726
   727  // failurePolicy defines how to handle failures for the admission policy. Failures can
   728  // occur from CEL expression parse errors, type check errors, runtime errors and invalid
   729  // or mis-configured policy definitions or bindings.
   730  //
   731  // A policy is invalid if spec.paramKind refers to a non-existent Kind.
   732  // A binding is invalid if spec.paramRef.name refers to a non-existent resource.
   733  //
   734  // failurePolicy does not define how validations that evaluate to false are handled.
   735  //
   736  // When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions
   737  // define how failures are enforced.
   738  //
   739  // Allowed values are Ignore or Fail. Defaults to Fail.
   740  // +optional
   741  optional string failurePolicy = 4;
   742
   743  // auditAnnotations contains CEL expressions which are used to produce audit
   744  // annotations for the audit event of the API request.
   745  // validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is
   746  // required.
   747  // +listType=atomic
   748  // +optional
   749  repeated AuditAnnotation auditAnnotations = 5;
   750
   751  // MatchConditions is a list of conditions that must be met for a request to be validated.
   752  // Match conditions filter requests that have already been matched by the rules,
   753  // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.
   754  // There are a maximum of 64 match conditions allowed.
   755  //
   756  // If a parameter object is provided, it can be accessed via the `params` handle in the same
   757  // manner as validation expressions.
   758  //
   759  // The exact matching logic is (in order):
   760  //   1. If ANY matchCondition evaluates to FALSE, the policy is skipped.
   761  //   2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
   762  //   3. If any matchCondition evaluates to an error (but none are FALSE):
   763  //      - If failurePolicy=Fail, reject the request
   764  //      - If failurePolicy=Ignore, the policy is skipped
   765  //
   766  // +patchMergeKey=name
   767  // +patchStrategy=merge
   768  // +listType=map
   769  // +listMapKey=name
   770  // +optional
   771  repeated MatchCondition matchConditions = 6;
   772
   773  // Variables contain definitions of variables that can be used in composition of other expressions.
   774  // Each variable is defined as a named CEL expression.
   775  // The variables defined here will be available under `variables` in other expressions of the policy
   776  // except MatchConditions because MatchConditions are evaluated before the rest of the policy.
   777  //
   778  // The expression of a variable can refer to other variables defined earlier in the list but not those after.
   779  // Thus, Variables must be sorted by the order of first appearance and acyclic.
   780  // +patchMergeKey=name
   781  // +patchStrategy=merge
   782  // +listType=map
   783  // +listMapKey=name
   784  // +optional
   785  repeated Variable variables = 7;
   786}
   787
   788// ValidatingAdmissionPolicyStatus represents the status of an admission validation policy.
   789message ValidatingAdmissionPolicyStatus {
   790  // The generation observed by the controller.
   791  // +optional
   792  optional int64 observedGeneration = 1;
   793
   794  // The results of type checking for each expression.
   795  // Presence of this field indicates the completion of the type checking.
   796  // +optional
   797  optional TypeChecking typeChecking = 2;
   798
   799  // The conditions represent the latest available observations of a policy's current state.
   800  // +optional
   801  // +listType=map
   802  // +listMapKey=type
   803  repeated k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3;
   804}
   805
   806// ValidatingWebhook describes an admission webhook and the resources and operations it applies to.
   807message ValidatingWebhook {
   808  // The name of the admission webhook.
   809  // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
   810  // "imagepolicy" is the name of the webhook, and kubernetes.io is the name
   811  // of the organization.
   812  // Required.
   813  optional string name = 1;
   814
   815  // ClientConfig defines how to communicate with the hook.
   816  // Required
   817  optional WebhookClientConfig clientConfig = 2;
   818
   819  // Rules describes what operations on what resources/subresources the webhook cares about.
   820  // The webhook cares about an operation if it matches _any_ Rule.
   821  // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks
   822  // from putting the cluster in a state which cannot be recovered from without completely
   823  // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called
   824  // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.
   825  // +listType=atomic
   826  repeated RuleWithOperations rules = 3;
   827
   828  // FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
   829  // allowed values are Ignore or Fail. Defaults to Fail.
   830  // +optional
   831  optional string failurePolicy = 4;
   832
   833  // matchPolicy defines how the "rules" list is used to match incoming requests.
   834  // Allowed values are "Exact" or "Equivalent".
   835  //
   836  // - Exact: match a request only if it exactly matches a specified rule.
   837  // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
   838  // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
   839  // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.
   840  //
   841  // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
   842  // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
   843  // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
   844  // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.
   845  //
   846  // Defaults to "Equivalent"
   847  // +optional
   848  optional string matchPolicy = 9;
   849
   850  // NamespaceSelector decides whether to run the webhook on an object based
   851  // on whether the namespace for that object matches the selector. If the
   852  // object itself is a namespace, the matching is performed on
   853  // object.metadata.labels. If the object is another cluster scoped resource,
   854  // it never skips the webhook.
   855  //
   856  // For example, to run the webhook on any objects whose namespace is not
   857  // associated with "runlevel" of "0" or "1";  you will set the selector as
   858  // follows:
   859  // "namespaceSelector": {
   860  //   "matchExpressions": [
   861  //     {
   862  //       "key": "runlevel",
   863  //       "operator": "NotIn",
   864  //       "values": [
   865  //         "0",
   866  //         "1"
   867  //       ]
   868  //     }
   869  //   ]
   870  // }
   871  //
   872  // If instead you want to only run the webhook on any objects whose
   873  // namespace is associated with the "environment" of "prod" or "staging";
   874  // you will set the selector as follows:
   875  // "namespaceSelector": {
   876  //   "matchExpressions": [
   877  //     {
   878  //       "key": "environment",
   879  //       "operator": "In",
   880  //       "values": [
   881  //         "prod",
   882  //         "staging"
   883  //       ]
   884  //     }
   885  //   ]
   886  // }
   887  //
   888  // See
   889  // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
   890  // for more examples of label selectors.
   891  //
   892  // Default to the empty LabelSelector, which matches everything.
   893  // +optional
   894  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5;
   895
   896  // ObjectSelector decides whether to run the webhook based on if the
   897  // object has matching labels. objectSelector is evaluated against both
   898  // the oldObject and newObject that would be sent to the webhook, and
   899  // is considered to match if either object matches the selector. A null
   900  // object (oldObject in the case of create, or newObject in the case of
   901  // delete) or an object that cannot have labels (like a
   902  // DeploymentRollback or a PodProxyOptions object) is not considered to
   903  // match.
   904  // Use the object selector only if the webhook is opt-in, because end
   905  // users may skip the admission webhook by setting the labels.
   906  // Default to the empty LabelSelector, which matches everything.
   907  // +optional
   908  optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 10;
   909
   910  // SideEffects states whether this webhook has side effects.
   911  // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown).
   912  // Webhooks with side effects MUST implement a reconciliation system, since a request may be
   913  // rejected by a future step in the admission chain and the side effects therefore need to be undone.
   914  // Requests with the dryRun attribute will be auto-rejected if they match a webhook with
   915  // sideEffects == Unknown or Some.
   916  optional string sideEffects = 6;
   917
   918  // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
   919  // the webhook call will be ignored or the API call will fail based on the
   920  // failure policy.
   921  // The timeout value must be between 1 and 30 seconds.
   922  // Default to 10 seconds.
   923  // +optional
   924  optional int32 timeoutSeconds = 7;
   925
   926  // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`
   927  // versions the Webhook expects. API server will try to use first version in
   928  // the list which it supports. If none of the versions specified in this list
   929  // supported by API server, validation will fail for this object.
   930  // If a persisted webhook configuration specifies allowed versions and does not
   931  // include any versions known to the API Server, calls to the webhook will fail
   932  // and be subject to the failure policy.
   933  // +listType=atomic
   934  repeated string admissionReviewVersions = 8;
   935
   936  // MatchConditions is a list of conditions that must be met for a request to be sent to this
   937  // webhook. Match conditions filter requests that have already been matched by the rules,
   938  // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.
   939  // There are a maximum of 64 match conditions allowed.
   940  //
   941  // The exact matching logic is (in order):
   942  //   1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.
   943  //   2. If ALL matchConditions evaluate to TRUE, the webhook is called.
   944  //   3. If any matchCondition evaluates to an error (but none are FALSE):
   945  //      - If failurePolicy=Fail, reject the request
   946  //      - If failurePolicy=Ignore, the error is ignored and the webhook is skipped
   947  //
   948  // +patchMergeKey=name
   949  // +patchStrategy=merge
   950  // +listType=map
   951  // +listMapKey=name
   952  // +optional
   953  repeated MatchCondition matchConditions = 11;
   954}
   955
   956// ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.
   957message ValidatingWebhookConfiguration {
   958  // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
   959  // +optional
   960  optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
   961
   962  // Webhooks is a list of webhooks and the affected resources and operations.
   963  // +optional
   964  // +patchMergeKey=name
   965  // +patchStrategy=merge
   966  // +listType=map
   967  // +listMapKey=name
   968  repeated ValidatingWebhook Webhooks = 2;
   969}
   970
   971// ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.
   972message ValidatingWebhookConfigurationList {
   973  // Standard list metadata.
   974  // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
   975  // +optional
   976  optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
   977
   978  // List of ValidatingWebhookConfiguration.
   979  repeated ValidatingWebhookConfiguration items = 2;
   980}
   981
   982// Validation specifies the CEL expression which is used to apply the validation.
   983message Validation {
   984  // Expression represents the expression which will be evaluated by CEL.
   985  // ref: https://github.com/google/cel-spec
   986  // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:
   987  //
   988  // - 'object' - The object from the incoming request. The value is null for DELETE requests.
   989  // - 'oldObject' - The existing object. The value is null for CREATE requests.
   990  // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).
   991  // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.
   992  // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.
   993  // - 'variables' - Map of composited variables, from its name to its lazily evaluated value.
   994  //   For example, a variable named 'foo' can be accessed as 'variables.foo'.
   995  // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
   996  //   See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
   997  // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the
   998  //   request resource.
   999  //
  1000  // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the
  1001  // object. No other metadata properties are accessible.
  1002  //
  1003  // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
  1004  // Accessible property names are escaped according to the following rules when accessed in the expression:
  1005  // - '__' escapes to '__underscores__'
  1006  // - '.' escapes to '__dot__'
  1007  // - '-' escapes to '__dash__'
  1008  // - '/' escapes to '__slash__'
  1009  // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:
  1010  // 	  "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if",
  1011  // 	  "import", "let", "loop", "package", "namespace", "return".
  1012  // Examples:
  1013  //   - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ > 0"}
  1014  //   - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop > 0"}
  1015  //   - Expression accessing a property named "redact__d": {"Expression": "object.redact__underscores__d > 0"}
  1016  //
  1017  // Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
  1018  // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
  1019  //   - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
  1020  //     non-intersecting elements in `Y` are appended, retaining their partial order.
  1021  //   - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
  1022  //     are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
  1023  //     non-intersecting keys are appended, retaining their partial order.
  1024  // Required.
  1025  optional string Expression = 1;
  1026
  1027  // Message represents the message displayed when validation fails. The message is required if the Expression contains
  1028  // line breaks. The message must not contain line breaks.
  1029  // If unset, the message is "failed rule: {Rule}".
  1030  // e.g. "must be a URL with the host matching spec.host"
  1031  // If the Expression contains line breaks. Message is required.
  1032  // The message must not contain line breaks.
  1033  // If unset, the message is "failed Expression: {Expression}".
  1034  // +optional
  1035  optional string message = 2;
  1036
  1037  // Reason represents a machine-readable description of why this validation failed.
  1038  // If this is the first validation in the list to fail, this reason, as well as the
  1039  // corresponding HTTP response code, are used in the
  1040  // HTTP response to the client.
  1041  // The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid", "RequestEntityTooLarge".
  1042  // If not set, StatusReasonInvalid is used in the response to the client.
  1043  // +optional
  1044  optional string reason = 3;
  1045
  1046  // messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
  1047  // Since messageExpression is used as a failure message, it must evaluate to a string.
  1048  // If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails.
  1049  // If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced
  1050  // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
  1051  // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and
  1052  // the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged.
  1053  // messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'.
  1054  // Example:
  1055  // "object.x must be less than max ("+string(params.max)+")"
  1056  // +optional
  1057  optional string messageExpression = 4;
  1058}
  1059
  1060// Variable is the definition of a variable that is used for composition. A variable is defined as a named expression.
  1061// +structType=atomic
  1062message Variable {
  1063  // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables.
  1064  // The variable can be accessed in other expressions through `variables`
  1065  // For example, if name is "foo", the variable will be available as `variables.foo`
  1066  optional string Name = 1;
  1067
  1068  // Expression is the expression that will be evaluated as the value of the variable.
  1069  // The CEL expression has access to the same identifiers as the CEL expressions in Validation.
  1070  optional string Expression = 2;
  1071}
  1072
  1073// WebhookClientConfig contains the information to make a TLS
  1074// connection with the webhook
  1075message WebhookClientConfig {
  1076  // `url` gives the location of the webhook, in standard URL form
  1077  // (`scheme://host:port/path`). Exactly one of `url` or `service`
  1078  // must be specified.
  1079  //
  1080  // The `host` should not refer to a service running in the cluster; use
  1081  // the `service` field instead. The host might be resolved via external
  1082  // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve
  1083  // in-cluster DNS as that would be a layering violation). `host` may
  1084  // also be an IP address.
  1085  //
  1086  // Please note that using `localhost` or `127.0.0.1` as a `host` is
  1087  // risky unless you take great care to run this webhook on all hosts
  1088  // which run an apiserver which might need to make calls to this
  1089  // webhook. Such installs are likely to be non-portable, i.e., not easy
  1090  // to turn up in a new cluster.
  1091  //
  1092  // The scheme must be "https"; the URL must begin with "https://".
  1093  //
  1094  // A path is optional, and if present may be any string permissible in
  1095  // a URL. You may use the path to pass an arbitrary string to the
  1096  // webhook, for example, a cluster identifier.
  1097  //
  1098  // Attempting to use a user or basic auth e.g. "user:password@" is not
  1099  // allowed. Fragments ("#...") and query parameters ("?...") are not
  1100  // allowed, either.
  1101  //
  1102  // +optional
  1103  optional string url = 3;
  1104
  1105  // `service` is a reference to the service for this webhook. Either
  1106  // `service` or `url` must be specified.
  1107  //
  1108  // If the webhook is running within the cluster, then you should use `service`.
  1109  //
  1110  // +optional
  1111  optional ServiceReference service = 1;
  1112
  1113  // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate.
  1114  // If unspecified, system trust roots on the apiserver are used.
  1115  // +optional
  1116  optional bytes caBundle = 2;
  1117}
  1118

View as plain text