generated.proto 21 KB

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