generated.proto 21 KB

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