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 = "v1"; 30 31// MutatingWebhook describes an admission webhook and the resources and operations it applies to. 32message MutatingWebhook { 33 // The name of the admission webhook. 34 // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where 35 // "imagepolicy" is the name of the webhook, and kubernetes.io is the name 36 // of the organization. 37 // Required. 38 optional string name = 1; 39 40 // ClientConfig defines how to communicate with the hook. 41 // Required 42 optional WebhookClientConfig clientConfig = 2; 43 44 // Rules describes what operations on what resources/subresources the webhook cares about. 45 // The webhook cares about an operation if it matches _any_ Rule. 46 // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks 47 // from putting the cluster in a state which cannot be recovered from without completely 48 // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called 49 // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. 50 repeated RuleWithOperations rules = 3; 51 52 // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - 53 // allowed values are Ignore or Fail. Defaults to Fail. 54 // +optional 55 optional string failurePolicy = 4; 56 57 // matchPolicy defines how the "rules" list is used to match incoming requests. 58 // Allowed values are "Exact" or "Equivalent". 59 // 60 // - Exact: match a request only if it exactly matches a specified rule. 61 // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, 62 // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, 63 // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. 64 // 65 // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. 66 // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, 67 // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, 68 // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. 69 // 70 // Defaults to "Equivalent" 71 // +optional 72 optional string matchPolicy = 9; 73 74 // NamespaceSelector decides whether to run the webhook on an object based 75 // on whether the namespace for that object matches the selector. If the 76 // object itself is a namespace, the matching is performed on 77 // object.metadata.labels. If the object is another cluster scoped resource, 78 // it never skips the webhook. 79 // 80 // For example, to run the webhook on any objects whose namespace is not 81 // associated with "runlevel" of "0" or "1"; you will set the selector as 82 // follows: 83 // "namespaceSelector": { 84 // "matchExpressions": [ 85 // { 86 // "key": "runlevel", 87 // "operator": "NotIn", 88 // "values": [ 89 // "0", 90 // "1" 91 // ] 92 // } 93 // ] 94 // } 95 // 96 // If instead you want to only run the webhook on any objects whose 97 // namespace is associated with the "environment" of "prod" or "staging"; 98 // you will set the selector as follows: 99 // "namespaceSelector": { 100 // "matchExpressions": [ 101 // { 102 // "key": "environment", 103 // "operator": "In", 104 // "values": [ 105 // "prod", 106 // "staging" 107 // ] 108 // } 109 // ] 110 // } 111 // 112 // See 113 // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ 114 // for more examples of label selectors. 115 // 116 // Default to the empty LabelSelector, which matches everything. 117 // +optional 118 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5; 119 120 // ObjectSelector decides whether to run the webhook based on if the 121 // object has matching labels. objectSelector is evaluated against both 122 // the oldObject and newObject that would be sent to the webhook, and 123 // is considered to match if either object matches the selector. A null 124 // object (oldObject in the case of create, or newObject in the case of 125 // delete) or an object that cannot have labels (like a 126 // DeploymentRollback or a PodProxyOptions object) is not considered to 127 // match. 128 // Use the object selector only if the webhook is opt-in, because end 129 // users may skip the admission webhook by setting the labels. 130 // Default to the empty LabelSelector, which matches everything. 131 // +optional 132 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 11; 133 134 // SideEffects states whether this webhook has side effects. 135 // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). 136 // Webhooks with side effects MUST implement a reconciliation system, since a request may be 137 // rejected by a future step in the admission change and the side effects therefore need to be undone. 138 // Requests with the dryRun attribute will be auto-rejected if they match a webhook with 139 // sideEffects == Unknown or Some. 140 optional string sideEffects = 6; 141 142 // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, 143 // the webhook call will be ignored or the API call will fail based on the 144 // failure policy. 145 // The timeout value must be between 1 and 30 seconds. 146 // Default to 10 seconds. 147 // +optional 148 optional int32 timeoutSeconds = 7; 149 150 // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` 151 // versions the Webhook expects. API server will try to use first version in 152 // the list which it supports. If none of the versions specified in this list 153 // supported by API server, validation will fail for this object. 154 // If a persisted webhook configuration specifies allowed versions and does not 155 // include any versions known to the API Server, calls to the webhook will fail 156 // and be subject to the failure policy. 157 repeated string admissionReviewVersions = 8; 158 159 // reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. 160 // Allowed values are "Never" and "IfNeeded". 161 // 162 // Never: the webhook will not be called more than once in a single admission evaluation. 163 // 164 // IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation 165 // if the object being admitted is modified by other admission plugins after the initial webhook call. 166 // Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. 167 // Note: 168 // * the number of additional invocations is not guaranteed to be exactly one. 169 // * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. 170 // * webhooks that use this option may be reordered to minimize the number of additional invocations. 171 // * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead. 172 // 173 // Defaults to "Never". 174 // +optional 175 optional string reinvocationPolicy = 10; 176} 177 178// MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. 179message MutatingWebhookConfiguration { 180 // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. 181 // +optional 182 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; 183 184 // Webhooks is a list of webhooks and the affected resources and operations. 185 // +optional 186 // +patchMergeKey=name 187 // +patchStrategy=merge 188 repeated MutatingWebhook Webhooks = 2; 189} 190 191// MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. 192message MutatingWebhookConfigurationList { 193 // Standard list metadata. 194 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 195 // +optional 196 optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; 197 198 // List of MutatingWebhookConfiguration. 199 repeated MutatingWebhookConfiguration items = 2; 200} 201 202// Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended 203// to make sure that all the tuple expansions are valid. 204message Rule { 205 // APIGroups is the API groups the resources belong to. '*' is all groups. 206 // If '*' is present, the length of the slice must be one. 207 // Required. 208 repeated string apiGroups = 1; 209 210 // APIVersions is the API versions the resources belong to. '*' is all versions. 211 // If '*' is present, the length of the slice must be one. 212 // Required. 213 repeated string apiVersions = 2; 214 215 // Resources is a list of resources this rule applies to. 216 // 217 // For example: 218 // 'pods' means pods. 219 // 'pods/log' means the log subresource of pods. 220 // '*' means all resources, but not subresources. 221 // 'pods/*' means all subresources of pods. 222 // '*/scale' means all scale subresources. 223 // '*/*' means all resources and their subresources. 224 // 225 // If wildcard is present, the validation rule will ensure resources do not 226 // overlap with each other. 227 // 228 // Depending on the enclosing object, subresources might not be allowed. 229 // Required. 230 repeated string resources = 3; 231 232 // scope specifies the scope of this rule. 233 // Valid values are "Cluster", "Namespaced", and "*" 234 // "Cluster" means that only cluster-scoped resources will match this rule. 235 // Namespace API objects are cluster-scoped. 236 // "Namespaced" means that only namespaced resources will match this rule. 237 // "*" means that there are no scope restrictions. 238 // Subresources match the scope of their parent resource. 239 // Default is "*". 240 // 241 // +optional 242 optional string scope = 4; 243} 244 245// RuleWithOperations is a tuple of Operations and Resources. It is recommended to make 246// sure that all the tuple expansions are valid. 247message RuleWithOperations { 248 // Operations is the operations the admission hook cares about - CREATE, UPDATE, or * 249 // for all operations. 250 // If '*' is present, the length of the slice must be one. 251 // Required. 252 repeated string operations = 1; 253 254 // Rule is embedded, it describes other criteria of the rule, like 255 // APIGroups, APIVersions, Resources, etc. 256 optional Rule rule = 2; 257} 258 259// ServiceReference holds a reference to Service.legacy.k8s.io 260message ServiceReference { 261 // `namespace` is the namespace of the service. 262 // Required 263 optional string namespace = 1; 264 265 // `name` is the name of the service. 266 // Required 267 optional string name = 2; 268 269 // `path` is an optional URL path which will be sent in any request to 270 // this service. 271 // +optional 272 optional string path = 3; 273 274 // If specified, the port on the service that hosting webhook. 275 // Default to 443 for backward compatibility. 276 // `port` should be a valid port number (1-65535, inclusive). 277 // +optional 278 optional int32 port = 4; 279} 280 281// ValidatingWebhook describes an admission webhook and the resources and operations it applies to. 282message ValidatingWebhook { 283 // The name of the admission webhook. 284 // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where 285 // "imagepolicy" is the name of the webhook, and kubernetes.io is the name 286 // of the organization. 287 // Required. 288 optional string name = 1; 289 290 // ClientConfig defines how to communicate with the hook. 291 // Required 292 optional WebhookClientConfig clientConfig = 2; 293 294 // Rules describes what operations on what resources/subresources the webhook cares about. 295 // The webhook cares about an operation if it matches _any_ Rule. 296 // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks 297 // from putting the cluster in a state which cannot be recovered from without completely 298 // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called 299 // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. 300 repeated RuleWithOperations rules = 3; 301 302 // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - 303 // allowed values are Ignore or Fail. Defaults to Fail. 304 // +optional 305 optional string failurePolicy = 4; 306 307 // matchPolicy defines how the "rules" list is used to match incoming requests. 308 // Allowed values are "Exact" or "Equivalent". 309 // 310 // - Exact: match a request only if it exactly matches a specified rule. 311 // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, 312 // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, 313 // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook. 314 // 315 // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. 316 // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, 317 // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`, 318 // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook. 319 // 320 // Defaults to "Equivalent" 321 // +optional 322 optional string matchPolicy = 9; 323 324 // NamespaceSelector decides whether to run the webhook on an object based 325 // on whether the namespace for that object matches the selector. If the 326 // object itself is a namespace, the matching is performed on 327 // object.metadata.labels. If the object is another cluster scoped resource, 328 // it never skips the webhook. 329 // 330 // For example, to run the webhook on any objects whose namespace is not 331 // associated with "runlevel" of "0" or "1"; you will set the selector as 332 // follows: 333 // "namespaceSelector": { 334 // "matchExpressions": [ 335 // { 336 // "key": "runlevel", 337 // "operator": "NotIn", 338 // "values": [ 339 // "0", 340 // "1" 341 // ] 342 // } 343 // ] 344 // } 345 // 346 // If instead you want to only run the webhook on any objects whose 347 // namespace is associated with the "environment" of "prod" or "staging"; 348 // you will set the selector as follows: 349 // "namespaceSelector": { 350 // "matchExpressions": [ 351 // { 352 // "key": "environment", 353 // "operator": "In", 354 // "values": [ 355 // "prod", 356 // "staging" 357 // ] 358 // } 359 // ] 360 // } 361 // 362 // See 363 // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels 364 // for more examples of label selectors. 365 // 366 // Default to the empty LabelSelector, which matches everything. 367 // +optional 368 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5; 369 370 // ObjectSelector decides whether to run the webhook based on if the 371 // object has matching labels. objectSelector is evaluated against both 372 // the oldObject and newObject that would be sent to the webhook, and 373 // is considered to match if either object matches the selector. A null 374 // object (oldObject in the case of create, or newObject in the case of 375 // delete) or an object that cannot have labels (like a 376 // DeploymentRollback or a PodProxyOptions object) is not considered to 377 // match. 378 // Use the object selector only if the webhook is opt-in, because end 379 // users may skip the admission webhook by setting the labels. 380 // Default to the empty LabelSelector, which matches everything. 381 // +optional 382 optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 10; 383 384 // SideEffects states whether this webhook has side effects. 385 // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). 386 // Webhooks with side effects MUST implement a reconciliation system, since a request may be 387 // rejected by a future step in the admission change and the side effects therefore need to be undone. 388 // Requests with the dryRun attribute will be auto-rejected if they match a webhook with 389 // sideEffects == Unknown or Some. 390 optional string sideEffects = 6; 391 392 // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, 393 // the webhook call will be ignored or the API call will fail based on the 394 // failure policy. 395 // The timeout value must be between 1 and 30 seconds. 396 // Default to 10 seconds. 397 // +optional 398 optional int32 timeoutSeconds = 7; 399 400 // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` 401 // versions the Webhook expects. API server will try to use first version in 402 // the list which it supports. If none of the versions specified in this list 403 // supported by API server, validation will fail for this object. 404 // If a persisted webhook configuration specifies allowed versions and does not 405 // include any versions known to the API Server, calls to the webhook will fail 406 // and be subject to the failure policy. 407 repeated string admissionReviewVersions = 8; 408} 409 410// ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. 411message ValidatingWebhookConfiguration { 412 // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. 413 // +optional 414 optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; 415 416 // Webhooks is a list of webhooks and the affected resources and operations. 417 // +optional 418 // +patchMergeKey=name 419 // +patchStrategy=merge 420 repeated ValidatingWebhook Webhooks = 2; 421} 422 423// ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. 424message ValidatingWebhookConfigurationList { 425 // Standard list metadata. 426 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds 427 // +optional 428 optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; 429 430 // List of ValidatingWebhookConfiguration. 431 repeated ValidatingWebhookConfiguration items = 2; 432} 433 434// WebhookClientConfig contains the information to make a TLS 435// connection with the webhook 436message WebhookClientConfig { 437 // `url` gives the location of the webhook, in standard URL form 438 // (`scheme://host:port/path`). Exactly one of `url` or `service` 439 // must be specified. 440 // 441 // The `host` should not refer to a service running in the cluster; use 442 // the `service` field instead. The host might be resolved via external 443 // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve 444 // in-cluster DNS as that would be a layering violation). `host` may 445 // also be an IP address. 446 // 447 // Please note that using `localhost` or `127.0.0.1` as a `host` is 448 // risky unless you take great care to run this webhook on all hosts 449 // which run an apiserver which might need to make calls to this 450 // webhook. Such installs are likely to be non-portable, i.e., not easy 451 // to turn up in a new cluster. 452 // 453 // The scheme must be "https"; the URL must begin with "https://". 454 // 455 // A path is optional, and if present may be any string permissible in 456 // a URL. You may use the path to pass an arbitrary string to the 457 // webhook, for example, a cluster identifier. 458 // 459 // Attempting to use a user or basic auth e.g. "user:password@" is not 460 // allowed. Fragments ("#...") and query parameters ("?...") are not 461 // allowed, either. 462 // 463 // +optional 464 optional string url = 3; 465 466 // `service` is a reference to the service for this webhook. Either 467 // `service` or `url` must be specified. 468 // 469 // If the webhook is running within the cluster, then you should use `service`. 470 // 471 // +optional 472 optional ServiceReference service = 1; 473 474 // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. 475 // If unspecified, system trust roots on the apiserver are used. 476 // +optional 477 optional bytes caBundle = 2; 478} 479 480