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