generated.proto 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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.v1;
  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 = "k8s.io/api/admissionregistration/v1";
  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 Fail.
  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 "Equivalent"
  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: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown).
  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.
  123. optional string sideEffects = 6;
  124. // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
  125. // the webhook call will be ignored or the API call will fail based on the
  126. // failure policy.
  127. // The timeout value must be between 1 and 30 seconds.
  128. // Default to 10 seconds.
  129. // +optional
  130. optional int32 timeoutSeconds = 7;
  131. // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`
  132. // versions the Webhook expects. API server will try to use first version in
  133. // the list which it supports. If none of the versions specified in this list
  134. // supported by API server, validation will fail for this object.
  135. // If a persisted webhook configuration specifies allowed versions and does not
  136. // include any versions known to the API Server, calls to the webhook will fail
  137. // and be subject to the failure policy.
  138. repeated string admissionReviewVersions = 8;
  139. // reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation.
  140. // Allowed values are "Never" and "IfNeeded".
  141. //
  142. // Never: the webhook will not be called more than once in a single admission evaluation.
  143. //
  144. // IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation
  145. // if the object being admitted is modified by other admission plugins after the initial webhook call.
  146. // Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted.
  147. // Note:
  148. // * the number of additional invocations is not guaranteed to be exactly one.
  149. // * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again.
  150. // * webhooks that use this option may be reordered to minimize the number of additional invocations.
  151. // * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.
  152. //
  153. // Defaults to "Never".
  154. // +optional
  155. optional string reinvocationPolicy = 10;
  156. }
  157. // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.
  158. message MutatingWebhookConfiguration {
  159. // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
  160. // +optional
  161. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  162. // Webhooks is a list of webhooks and the affected resources and operations.
  163. // +optional
  164. // +patchMergeKey=name
  165. // +patchStrategy=merge
  166. repeated MutatingWebhook Webhooks = 2;
  167. }
  168. // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.
  169. message MutatingWebhookConfigurationList {
  170. // Standard list metadata.
  171. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  172. // +optional
  173. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  174. // List of MutatingWebhookConfiguration.
  175. repeated MutatingWebhookConfiguration items = 2;
  176. }
  177. // Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended
  178. // to make sure that all the tuple expansions are valid.
  179. message Rule {
  180. // APIGroups is the API groups the resources belong to. '*' is all groups.
  181. // If '*' is present, the length of the slice must be one.
  182. // Required.
  183. // +listType=atomic
  184. repeated string apiGroups = 1;
  185. // APIVersions is the API versions the resources belong to. '*' is all versions.
  186. // If '*' is present, the length of the slice must be one.
  187. // Required.
  188. // +listType=atomic
  189. repeated string apiVersions = 2;
  190. // Resources is a list of resources this rule applies to.
  191. //
  192. // For example:
  193. // 'pods' means pods.
  194. // 'pods/log' means the log subresource of pods.
  195. // '*' means all resources, but not subresources.
  196. // 'pods/*' means all subresources of pods.
  197. // '*/scale' means all scale subresources.
  198. // '*/*' means all resources and their subresources.
  199. //
  200. // If wildcard is present, the validation rule will ensure resources do not
  201. // overlap with each other.
  202. //
  203. // Depending on the enclosing object, subresources might not be allowed.
  204. // Required.
  205. // +listType=atomic
  206. repeated string resources = 3;
  207. // scope specifies the scope of this rule.
  208. // Valid values are "Cluster", "Namespaced", and "*"
  209. // "Cluster" means that only cluster-scoped resources will match this rule.
  210. // Namespace API objects are cluster-scoped.
  211. // "Namespaced" means that only namespaced resources will match this rule.
  212. // "*" means that there are no scope restrictions.
  213. // Subresources match the scope of their parent resource.
  214. // Default is "*".
  215. //
  216. // +optional
  217. optional string scope = 4;
  218. }
  219. // RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
  220. // sure that all the tuple expansions are valid.
  221. message RuleWithOperations {
  222. // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or *
  223. // for all of those operations and any future admission operations that are added.
  224. // If '*' is present, the length of the slice must be one.
  225. // Required.
  226. // +listType=atomic
  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 Fail.
  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 "Equivalent"
  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: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown).
  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.
  352. optional string sideEffects = 6;
  353. // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
  354. // the webhook call will be ignored or the API call will fail based on the
  355. // failure policy.
  356. // The timeout value must be between 1 and 30 seconds.
  357. // Default to 10 seconds.
  358. // +optional
  359. optional int32 timeoutSeconds = 7;
  360. // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`
  361. // versions the Webhook expects. API server will try to use first version in
  362. // the list which it supports. If none of the versions specified in this list
  363. // supported by API server, validation will fail for this object.
  364. // If a persisted webhook configuration specifies allowed versions and does not
  365. // include any versions known to the API Server, calls to the webhook will fail
  366. // and be subject to the failure policy.
  367. repeated string admissionReviewVersions = 8;
  368. }
  369. // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.
  370. message ValidatingWebhookConfiguration {
  371. // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
  372. // +optional
  373. optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  374. // Webhooks is a list of webhooks and the affected resources and operations.
  375. // +optional
  376. // +patchMergeKey=name
  377. // +patchStrategy=merge
  378. repeated ValidatingWebhook Webhooks = 2;
  379. }
  380. // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.
  381. message ValidatingWebhookConfigurationList {
  382. // Standard list metadata.
  383. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  384. // +optional
  385. optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  386. // List of ValidatingWebhookConfiguration.
  387. repeated ValidatingWebhookConfiguration items = 2;
  388. }
  389. // WebhookClientConfig contains the information to make a TLS
  390. // connection with the webhook
  391. message WebhookClientConfig {
  392. // `url` gives the location of the webhook, in standard URL form
  393. // (`scheme://host:port/path`). Exactly one of `url` or `service`
  394. // must be specified.
  395. //
  396. // The `host` should not refer to a service running in the cluster; use
  397. // the `service` field instead. The host might be resolved via external
  398. // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve
  399. // in-cluster DNS as that would be a layering violation). `host` may
  400. // also be an IP address.
  401. //
  402. // Please note that using `localhost` or `127.0.0.1` as a `host` is
  403. // risky unless you take great care to run this webhook on all hosts
  404. // which run an apiserver which might need to make calls to this
  405. // webhook. Such installs are likely to be non-portable, i.e., not easy
  406. // to turn up in a new cluster.
  407. //
  408. // The scheme must be "https"; the URL must begin with "https://".
  409. //
  410. // A path is optional, and if present may be any string permissible in
  411. // a URL. You may use the path to pass an arbitrary string to the
  412. // webhook, for example, a cluster identifier.
  413. //
  414. // Attempting to use a user or basic auth e.g. "user:password@" is not
  415. // allowed. Fragments ("#...") and query parameters ("?...") are not
  416. // allowed, either.
  417. //
  418. // +optional
  419. optional string url = 3;
  420. // `service` is a reference to the service for this webhook. Either
  421. // `service` or `url` must be specified.
  422. //
  423. // If the webhook is running within the cluster, then you should use `service`.
  424. //
  425. // +optional
  426. optional ServiceReference service = 1;
  427. // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate.
  428. // If unspecified, system trust roots on the apiserver are used.
  429. // +optional
  430. optional bytes caBundle = 2;
  431. }