generated.proto 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  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. // AuditAnnotation describes how to produce an audit annotation for an API request.
  22. message AuditAnnotation {
  23. // key specifies the audit annotation key. The audit annotation keys of
  24. // a ValidatingAdmissionPolicy must be unique. The key must be a qualified
  25. // name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.
  26. //
  27. // The key is combined with the resource name of the
  28. // ValidatingAdmissionPolicy to construct an audit annotation key:
  29. // "{ValidatingAdmissionPolicy name}/{key}".
  30. //
  31. // If an admission webhook uses the same resource name as this ValidatingAdmissionPolicy
  32. // and the same audit annotation key, the annotation key will be identical.
  33. // In this case, the first annotation written with the key will be included
  34. // in the audit event and all subsequent annotations with the same key
  35. // will be discarded.
  36. //
  37. // Required.
  38. optional string key = 1;
  39. // valueExpression represents the expression which is evaluated by CEL to
  40. // produce an audit annotation value. The expression must evaluate to either
  41. // a string or null value. If the expression evaluates to a string, the
  42. // audit annotation is included with the string value. If the expression
  43. // evaluates to null or empty string the audit annotation will be omitted.
  44. // The valueExpression may be no longer than 5kb in length.
  45. // If the result of the valueExpression is more than 10kb in length, it
  46. // will be truncated to 10kb.
  47. //
  48. // If multiple ValidatingAdmissionPolicyBinding resources match an
  49. // API request, then the valueExpression will be evaluated for
  50. // each binding. All unique values produced by the valueExpressions
  51. // will be joined together in a comma-separated list.
  52. //
  53. // Required.
  54. optional string valueExpression = 2;
  55. }
  56. // ExpressionWarning is a warning information that targets a specific expression.
  57. message ExpressionWarning {
  58. // The path to the field that refers the expression.
  59. // For example, the reference to the expression of the first item of
  60. // validations is "spec.validations[0].expression"
  61. optional string fieldRef = 2;
  62. // The content of type checking information in a human-readable form.
  63. // Each line of the warning contains the type that the expression is checked
  64. // against, followed by the type check error from the compiler.
  65. optional string warning = 3;
  66. }
  67. // MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook.
  68. message MatchCondition {
  69. // Name is an identifier for this match condition, used for strategic merging of MatchConditions,
  70. // as well as providing an identifier for logging purposes. A good name should be descriptive of
  71. // the associated expression.
  72. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and
  73. // must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or
  74. // '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an
  75. // optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')
  76. //
  77. // Required.
  78. optional string name = 1;
  79. // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool.
  80. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:
  81. //
  82. // 'object' - The object from the incoming request. The value is null for DELETE requests.
  83. // 'oldObject' - The existing object. The value is null for CREATE requests.
  84. // 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest).
  85. // 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
  86. // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
  87. // 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the
  88. // request resource.
  89. // Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/
  90. //
  91. // Required.
  92. optional string expression = 2;
  93. }
  94. // MatchResources decides whether to run the admission control policy on an object based
  95. // on whether it meets the match criteria.
  96. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
  97. // +structType=atomic
  98. message MatchResources {
  99. // NamespaceSelector decides whether to run the admission control policy on an object based
  100. // on whether the namespace for that object matches the selector. If the
  101. // object itself is a namespace, the matching is performed on
  102. // object.metadata.labels. If the object is another cluster scoped resource,
  103. // it never skips the policy.
  104. //
  105. // For example, to run the webhook on any objects whose namespace is not
  106. // associated with "runlevel" of "0" or "1"; you will set the selector as
  107. // follows:
  108. // "namespaceSelector": {
  109. // "matchExpressions": [
  110. // {
  111. // "key": "runlevel",
  112. // "operator": "NotIn",
  113. // "values": [
  114. // "0",
  115. // "1"
  116. // ]
  117. // }
  118. // ]
  119. // }
  120. //
  121. // If instead you want to only run the policy on any objects whose
  122. // namespace is associated with the "environment" of "prod" or "staging";
  123. // you will set the selector as follows:
  124. // "namespaceSelector": {
  125. // "matchExpressions": [
  126. // {
  127. // "key": "environment",
  128. // "operator": "In",
  129. // "values": [
  130. // "prod",
  131. // "staging"
  132. // ]
  133. // }
  134. // ]
  135. // }
  136. //
  137. // See
  138. // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
  139. // for more examples of label selectors.
  140. //
  141. // Default to the empty LabelSelector, which matches everything.
  142. // +optional
  143. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 1;
  144. // ObjectSelector decides whether to run the validation based on if the
  145. // object has matching labels. objectSelector is evaluated against both
  146. // the oldObject and newObject that would be sent to the cel validation, and
  147. // is considered to match if either object matches the selector. A null
  148. // object (oldObject in the case of create, or newObject in the case of
  149. // delete) or an object that cannot have labels (like a
  150. // DeploymentRollback or a PodProxyOptions object) is not considered to
  151. // match.
  152. // Use the object selector only if the webhook is opt-in, because end
  153. // users may skip the admission webhook by setting the labels.
  154. // Default to the empty LabelSelector, which matches everything.
  155. // +optional
  156. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 2;
  157. // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches.
  158. // The policy cares about an operation if it matches _any_ Rule.
  159. // +listType=atomic
  160. // +optional
  161. repeated NamedRuleWithOperations resourceRules = 3;
  162. // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about.
  163. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded)
  164. // +listType=atomic
  165. // +optional
  166. repeated NamedRuleWithOperations excludeResourceRules = 4;
  167. // matchPolicy defines how the "MatchResources" list is used to match incoming requests.
  168. // Allowed values are "Exact" or "Equivalent".
  169. //
  170. // - Exact: match a request only if it exactly matches a specified rule.
  171. // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
  172. // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
  173. // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.
  174. //
  175. // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
  176. // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
  177. // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
  178. // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.
  179. //
  180. // Defaults to "Equivalent"
  181. // +optional
  182. optional string matchPolicy = 7;
  183. }
  184. // MutatingWebhook describes an admission webhook and the resources and operations it applies to.
  185. message MutatingWebhook {
  186. // The name of the admission webhook.
  187. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
  188. // "imagepolicy" is the name of the webhook, and kubernetes.io is the name
  189. // of the organization.
  190. // Required.
  191. optional string name = 1;
  192. // ClientConfig defines how to communicate with the hook.
  193. // Required
  194. optional WebhookClientConfig clientConfig = 2;
  195. // Rules describes what operations on what resources/subresources the webhook cares about.
  196. // The webhook cares about an operation if it matches _any_ Rule.
  197. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks
  198. // from putting the cluster in a state which cannot be recovered from without completely
  199. // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called
  200. // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.
  201. // +listType=atomic
  202. repeated RuleWithOperations rules = 3;
  203. // FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
  204. // allowed values are Ignore or Fail. Defaults to Fail.
  205. // +optional
  206. optional string failurePolicy = 4;
  207. // matchPolicy defines how the "rules" list is used to match incoming requests.
  208. // Allowed values are "Exact" or "Equivalent".
  209. //
  210. // - Exact: match a request only if it exactly matches a specified rule.
  211. // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
  212. // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
  213. // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.
  214. //
  215. // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
  216. // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
  217. // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
  218. // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.
  219. //
  220. // Defaults to "Equivalent"
  221. // +optional
  222. optional string matchPolicy = 9;
  223. // NamespaceSelector decides whether to run the webhook on an object based
  224. // on whether the namespace for that object matches the selector. If the
  225. // object itself is a namespace, the matching is performed on
  226. // object.metadata.labels. If the object is another cluster scoped resource,
  227. // it never skips the webhook.
  228. //
  229. // For example, to run the webhook on any objects whose namespace is not
  230. // associated with "runlevel" of "0" or "1"; you will set the selector as
  231. // follows:
  232. // "namespaceSelector": {
  233. // "matchExpressions": [
  234. // {
  235. // "key": "runlevel",
  236. // "operator": "NotIn",
  237. // "values": [
  238. // "0",
  239. // "1"
  240. // ]
  241. // }
  242. // ]
  243. // }
  244. //
  245. // If instead you want to only run the webhook on any objects whose
  246. // namespace is associated with the "environment" of "prod" or "staging";
  247. // you will set the selector as follows:
  248. // "namespaceSelector": {
  249. // "matchExpressions": [
  250. // {
  251. // "key": "environment",
  252. // "operator": "In",
  253. // "values": [
  254. // "prod",
  255. // "staging"
  256. // ]
  257. // }
  258. // ]
  259. // }
  260. //
  261. // See
  262. // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
  263. // for more examples of label selectors.
  264. //
  265. // Default to the empty LabelSelector, which matches everything.
  266. // +optional
  267. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5;
  268. // ObjectSelector decides whether to run the webhook based on if the
  269. // object has matching labels. objectSelector is evaluated against both
  270. // the oldObject and newObject that would be sent to the webhook, and
  271. // is considered to match if either object matches the selector. A null
  272. // object (oldObject in the case of create, or newObject in the case of
  273. // delete) or an object that cannot have labels (like a
  274. // DeploymentRollback or a PodProxyOptions object) is not considered to
  275. // match.
  276. // Use the object selector only if the webhook is opt-in, because end
  277. // users may skip the admission webhook by setting the labels.
  278. // Default to the empty LabelSelector, which matches everything.
  279. // +optional
  280. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 11;
  281. // SideEffects states whether this webhook has side effects.
  282. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown).
  283. // Webhooks with side effects MUST implement a reconciliation system, since a request may be
  284. // rejected by a future step in the admission chain and the side effects therefore need to be undone.
  285. // Requests with the dryRun attribute will be auto-rejected if they match a webhook with
  286. // sideEffects == Unknown or Some.
  287. optional string sideEffects = 6;
  288. // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
  289. // the webhook call will be ignored or the API call will fail based on the
  290. // failure policy.
  291. // The timeout value must be between 1 and 30 seconds.
  292. // Default to 10 seconds.
  293. // +optional
  294. optional int32 timeoutSeconds = 7;
  295. // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`
  296. // versions the Webhook expects. API server will try to use first version in
  297. // the list which it supports. If none of the versions specified in this list
  298. // supported by API server, validation will fail for this object.
  299. // If a persisted webhook configuration specifies allowed versions and does not
  300. // include any versions known to the API Server, calls to the webhook will fail
  301. // and be subject to the failure policy.
  302. // +listType=atomic
  303. repeated string admissionReviewVersions = 8;
  304. // reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation.
  305. // Allowed values are "Never" and "IfNeeded".
  306. //
  307. // Never: the webhook will not be called more than once in a single admission evaluation.
  308. //
  309. // IfNeeded: the webhook will be called at least one additional time as part of the admission evaluation
  310. // if the object being admitted is modified by other admission plugins after the initial webhook call.
  311. // Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted.
  312. // Note:
  313. // * the number of additional invocations is not guaranteed to be exactly one.
  314. // * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again.
  315. // * webhooks that use this option may be reordered to minimize the number of additional invocations.
  316. // * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.
  317. //
  318. // Defaults to "Never".
  319. // +optional
  320. optional string reinvocationPolicy = 10;
  321. // MatchConditions is a list of conditions that must be met for a request to be sent to this
  322. // webhook. Match conditions filter requests that have already been matched by the rules,
  323. // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.
  324. // There are a maximum of 64 match conditions allowed.
  325. //
  326. // The exact matching logic is (in order):
  327. // 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.
  328. // 2. If ALL matchConditions evaluate to TRUE, the webhook is called.
  329. // 3. If any matchCondition evaluates to an error (but none are FALSE):
  330. // - If failurePolicy=Fail, reject the request
  331. // - If failurePolicy=Ignore, the error is ignored and the webhook is skipped
  332. //
  333. // +patchMergeKey=name
  334. // +patchStrategy=merge
  335. // +listType=map
  336. // +listMapKey=name
  337. // +optional
  338. repeated MatchCondition matchConditions = 12;
  339. }
  340. // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.
  341. message MutatingWebhookConfiguration {
  342. // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
  343. // +optional
  344. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  345. // Webhooks is a list of webhooks and the affected resources and operations.
  346. // +optional
  347. // +patchMergeKey=name
  348. // +patchStrategy=merge
  349. // +listType=map
  350. // +listMapKey=name
  351. repeated MutatingWebhook Webhooks = 2;
  352. }
  353. // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.
  354. message MutatingWebhookConfigurationList {
  355. // Standard list metadata.
  356. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  357. // +optional
  358. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  359. // List of MutatingWebhookConfiguration.
  360. repeated MutatingWebhookConfiguration items = 2;
  361. }
  362. // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.
  363. // +structType=atomic
  364. message NamedRuleWithOperations {
  365. // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.
  366. // +listType=atomic
  367. // +optional
  368. repeated string resourceNames = 1;
  369. // RuleWithOperations is a tuple of Operations and Resources.
  370. optional RuleWithOperations ruleWithOperations = 2;
  371. }
  372. // ParamKind is a tuple of Group Kind and Version.
  373. // +structType=atomic
  374. message ParamKind {
  375. // APIVersion is the API group version the resources belong to.
  376. // In format of "group/version".
  377. // Required.
  378. optional string apiVersion = 1;
  379. // Kind is the API kind the resources belong to.
  380. // Required.
  381. optional string kind = 2;
  382. }
  383. // ParamRef describes how to locate the params to be used as input to
  384. // expressions of rules applied by a policy binding.
  385. // +structType=atomic
  386. message ParamRef {
  387. // name is the name of the resource being referenced.
  388. //
  389. // One of `name` or `selector` must be set, but `name` and `selector` are
  390. // mutually exclusive properties. If one is set, the other must be unset.
  391. //
  392. // A single parameter used for all admission requests can be configured
  393. // by setting the `name` field, leaving `selector` blank, and setting namespace
  394. // if `paramKind` is namespace-scoped.
  395. optional string name = 1;
  396. // namespace is the namespace of the referenced resource. Allows limiting
  397. // the search for params to a specific namespace. Applies to both `name` and
  398. // `selector` fields.
  399. //
  400. // A per-namespace parameter may be used by specifying a namespace-scoped
  401. // `paramKind` in the policy and leaving this field empty.
  402. //
  403. // - If `paramKind` is cluster-scoped, this field MUST be unset. Setting this
  404. // field results in a configuration error.
  405. //
  406. // - If `paramKind` is namespace-scoped, the namespace of the object being
  407. // evaluated for admission will be used when this field is left unset. Take
  408. // care that if this is left empty the binding must not match any cluster-scoped
  409. // resources, which will result in an error.
  410. //
  411. // +optional
  412. optional string namespace = 2;
  413. // selector can be used to match multiple param objects based on their labels.
  414. // Supply selector: {} to match all resources of the ParamKind.
  415. //
  416. // If multiple params are found, they are all evaluated with the policy expressions
  417. // and the results are ANDed together.
  418. //
  419. // One of `name` or `selector` must be set, but `name` and `selector` are
  420. // mutually exclusive properties. If one is set, the other must be unset.
  421. //
  422. // +optional
  423. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3;
  424. // `parameterNotFoundAction` controls the behavior of the binding when the resource
  425. // exists, and name or selector is valid, but there are no parameters
  426. // matched by the binding. If the value is set to `Allow`, then no
  427. // matched parameters will be treated as successful validation by the binding.
  428. // If set to `Deny`, then no matched parameters will be subject to the
  429. // `failurePolicy` of the policy.
  430. //
  431. // Allowed values are `Allow` or `Deny`
  432. //
  433. // Required
  434. optional string parameterNotFoundAction = 4;
  435. }
  436. // Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended
  437. // to make sure that all the tuple expansions are valid.
  438. message Rule {
  439. // APIGroups is the API groups the resources belong to. '*' is all groups.
  440. // If '*' is present, the length of the slice must be one.
  441. // Required.
  442. // +listType=atomic
  443. repeated string apiGroups = 1;
  444. // APIVersions is the API versions the resources belong to. '*' is all versions.
  445. // If '*' is present, the length of the slice must be one.
  446. // Required.
  447. // +listType=atomic
  448. repeated string apiVersions = 2;
  449. // Resources is a list of resources this rule applies to.
  450. //
  451. // For example:
  452. // 'pods' means pods.
  453. // 'pods/log' means the log subresource of pods.
  454. // '*' means all resources, but not subresources.
  455. // 'pods/*' means all subresources of pods.
  456. // '*/scale' means all scale subresources.
  457. // '*/*' means all resources and their subresources.
  458. //
  459. // If wildcard is present, the validation rule will ensure resources do not
  460. // overlap with each other.
  461. //
  462. // Depending on the enclosing object, subresources might not be allowed.
  463. // Required.
  464. // +listType=atomic
  465. repeated string resources = 3;
  466. // scope specifies the scope of this rule.
  467. // Valid values are "Cluster", "Namespaced", and "*"
  468. // "Cluster" means that only cluster-scoped resources will match this rule.
  469. // Namespace API objects are cluster-scoped.
  470. // "Namespaced" means that only namespaced resources will match this rule.
  471. // "*" means that there are no scope restrictions.
  472. // Subresources match the scope of their parent resource.
  473. // Default is "*".
  474. //
  475. // +optional
  476. optional string scope = 4;
  477. }
  478. // RuleWithOperations is a tuple of Operations and Resources. It is recommended to make
  479. // sure that all the tuple expansions are valid.
  480. message RuleWithOperations {
  481. // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or *
  482. // for all of those operations and any future admission operations that are added.
  483. // If '*' is present, the length of the slice must be one.
  484. // Required.
  485. // +listType=atomic
  486. repeated string operations = 1;
  487. // Rule is embedded, it describes other criteria of the rule, like
  488. // APIGroups, APIVersions, Resources, etc.
  489. optional Rule rule = 2;
  490. }
  491. // ServiceReference holds a reference to Service.legacy.k8s.io
  492. message ServiceReference {
  493. // `namespace` is the namespace of the service.
  494. // Required
  495. optional string namespace = 1;
  496. // `name` is the name of the service.
  497. // Required
  498. optional string name = 2;
  499. // `path` is an optional URL path which will be sent in any request to
  500. // this service.
  501. // +optional
  502. optional string path = 3;
  503. // If specified, the port on the service that hosting webhook.
  504. // Default to 443 for backward compatibility.
  505. // `port` should be a valid port number (1-65535, inclusive).
  506. // +optional
  507. optional int32 port = 4;
  508. }
  509. // TypeChecking contains results of type checking the expressions in the
  510. // ValidatingAdmissionPolicy
  511. message TypeChecking {
  512. // The type checking warnings for each expression.
  513. // +optional
  514. // +listType=atomic
  515. repeated ExpressionWarning expressionWarnings = 1;
  516. }
  517. // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.
  518. message ValidatingAdmissionPolicy {
  519. // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
  520. // +optional
  521. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  522. // Specification of the desired behavior of the ValidatingAdmissionPolicy.
  523. optional ValidatingAdmissionPolicySpec spec = 2;
  524. // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy
  525. // behaves in the expected way.
  526. // Populated by the system.
  527. // Read-only.
  528. // +optional
  529. optional ValidatingAdmissionPolicyStatus status = 3;
  530. }
  531. // ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources.
  532. // ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.
  533. //
  534. // For a given admission request, each binding will cause its policy to be
  535. // evaluated N times, where N is 1 for policies/bindings that don't use
  536. // params, otherwise N is the number of parameters selected by the binding.
  537. //
  538. // The CEL expressions of a policy must have a computed CEL cost below the maximum
  539. // CEL budget. Each evaluation of the policy is given an independent CEL cost budget.
  540. // Adding/removing policies, bindings, or params can not affect whether a
  541. // given (policy, binding, param) combination is within its own CEL budget.
  542. message ValidatingAdmissionPolicyBinding {
  543. // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
  544. // +optional
  545. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  546. // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.
  547. optional ValidatingAdmissionPolicyBindingSpec spec = 2;
  548. }
  549. // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding.
  550. message ValidatingAdmissionPolicyBindingList {
  551. // Standard list metadata.
  552. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  553. // +optional
  554. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  555. // List of PolicyBinding.
  556. repeated ValidatingAdmissionPolicyBinding items = 2;
  557. }
  558. // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.
  559. message ValidatingAdmissionPolicyBindingSpec {
  560. // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to.
  561. // If the referenced resource does not exist, this binding is considered invalid and will be ignored
  562. // Required.
  563. optional string policyName = 1;
  564. // paramRef specifies the parameter resource used to configure the admission control policy.
  565. // It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy.
  566. // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied.
  567. // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.
  568. // +optional
  569. optional ParamRef paramRef = 2;
  570. // MatchResources declares what resources match this binding and will be validated by it.
  571. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this.
  572. // If this is unset, all resources matched by the policy are validated by this binding
  573. // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated.
  574. // Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.
  575. // +optional
  576. optional MatchResources matchResources = 3;
  577. // validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced.
  578. // If a validation evaluates to false it is always enforced according to these actions.
  579. //
  580. // Failures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according
  581. // to these actions only if the FailurePolicy is set to Fail, otherwise the failures are
  582. // ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.
  583. //
  584. // validationActions is declared as a set of action values. Order does
  585. // not matter. validationActions may not contain duplicates of the same action.
  586. //
  587. // The supported actions values are:
  588. //
  589. // "Deny" specifies that a validation failure results in a denied request.
  590. //
  591. // "Warn" specifies that a validation failure is reported to the request client
  592. // in HTTP Warning headers, with a warning code of 299. Warnings can be sent
  593. // both for allowed or denied admission responses.
  594. //
  595. // "Audit" specifies that a validation failure is included in the published
  596. // audit event for the request. The audit event will contain a
  597. // `validation.policy.admission.k8s.io/validation_failure` audit annotation
  598. // with a value containing the details of the validation failures, formatted as
  599. // a JSON list of objects, each with the following fields:
  600. // - message: The validation failure message string
  601. // - policy: The resource name of the ValidatingAdmissionPolicy
  602. // - binding: The resource name of the ValidatingAdmissionPolicyBinding
  603. // - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy
  604. // - validationActions: The enforcement actions enacted for the validation failure
  605. // Example audit annotation:
  606. // `"validation.policy.admission.k8s.io/validation_failure": "[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]"`
  607. //
  608. // Clients should expect to handle additional values by ignoring
  609. // any values not recognized.
  610. //
  611. // "Deny" and "Warn" may not be used together since this combination
  612. // needlessly duplicates the validation failure both in the
  613. // API response body and the HTTP warning headers.
  614. //
  615. // Required.
  616. // +listType=set
  617. repeated string validationActions = 4;
  618. }
  619. // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy.
  620. message ValidatingAdmissionPolicyList {
  621. // Standard list metadata.
  622. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  623. // +optional
  624. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  625. // List of ValidatingAdmissionPolicy.
  626. repeated ValidatingAdmissionPolicy items = 2;
  627. }
  628. // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.
  629. message ValidatingAdmissionPolicySpec {
  630. // ParamKind specifies the kind of resources used to parameterize this policy.
  631. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions.
  632. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied.
  633. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.
  634. // +optional
  635. optional ParamKind paramKind = 1;
  636. // MatchConstraints specifies what resources this policy is designed to validate.
  637. // The AdmissionPolicy cares about a request if it matches _all_ Constraints.
  638. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API
  639. // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding.
  640. // Required.
  641. optional MatchResources matchConstraints = 2;
  642. // Validations contain CEL expressions which is used to apply the validation.
  643. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is
  644. // required.
  645. // +listType=atomic
  646. // +optional
  647. repeated Validation validations = 3;
  648. // failurePolicy defines how to handle failures for the admission policy. Failures can
  649. // occur from CEL expression parse errors, type check errors, runtime errors and invalid
  650. // or mis-configured policy definitions or bindings.
  651. //
  652. // A policy is invalid if spec.paramKind refers to a non-existent Kind.
  653. // A binding is invalid if spec.paramRef.name refers to a non-existent resource.
  654. //
  655. // failurePolicy does not define how validations that evaluate to false are handled.
  656. //
  657. // When failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions
  658. // define how failures are enforced.
  659. //
  660. // Allowed values are Ignore or Fail. Defaults to Fail.
  661. // +optional
  662. optional string failurePolicy = 4;
  663. // auditAnnotations contains CEL expressions which are used to produce audit
  664. // annotations for the audit event of the API request.
  665. // validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is
  666. // required.
  667. // +listType=atomic
  668. // +optional
  669. repeated AuditAnnotation auditAnnotations = 5;
  670. // MatchConditions is a list of conditions that must be met for a request to be validated.
  671. // Match conditions filter requests that have already been matched by the rules,
  672. // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.
  673. // There are a maximum of 64 match conditions allowed.
  674. //
  675. // If a parameter object is provided, it can be accessed via the `params` handle in the same
  676. // manner as validation expressions.
  677. //
  678. // The exact matching logic is (in order):
  679. // 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.
  680. // 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.
  681. // 3. If any matchCondition evaluates to an error (but none are FALSE):
  682. // - If failurePolicy=Fail, reject the request
  683. // - If failurePolicy=Ignore, the policy is skipped
  684. //
  685. // +patchMergeKey=name
  686. // +patchStrategy=merge
  687. // +listType=map
  688. // +listMapKey=name
  689. // +optional
  690. repeated MatchCondition matchConditions = 6;
  691. // Variables contain definitions of variables that can be used in composition of other expressions.
  692. // Each variable is defined as a named CEL expression.
  693. // The variables defined here will be available under `variables` in other expressions of the policy
  694. // except MatchConditions because MatchConditions are evaluated before the rest of the policy.
  695. //
  696. // The expression of a variable can refer to other variables defined earlier in the list but not those after.
  697. // Thus, Variables must be sorted by the order of first appearance and acyclic.
  698. // +patchMergeKey=name
  699. // +patchStrategy=merge
  700. // +listType=map
  701. // +listMapKey=name
  702. // +optional
  703. repeated Variable variables = 7;
  704. }
  705. // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy.
  706. message ValidatingAdmissionPolicyStatus {
  707. // The generation observed by the controller.
  708. // +optional
  709. optional int64 observedGeneration = 1;
  710. // The results of type checking for each expression.
  711. // Presence of this field indicates the completion of the type checking.
  712. // +optional
  713. optional TypeChecking typeChecking = 2;
  714. // The conditions represent the latest available observations of a policy's current state.
  715. // +optional
  716. // +listType=map
  717. // +listMapKey=type
  718. repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3;
  719. }
  720. // ValidatingWebhook describes an admission webhook and the resources and operations it applies to.
  721. message ValidatingWebhook {
  722. // The name of the admission webhook.
  723. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where
  724. // "imagepolicy" is the name of the webhook, and kubernetes.io is the name
  725. // of the organization.
  726. // Required.
  727. optional string name = 1;
  728. // ClientConfig defines how to communicate with the hook.
  729. // Required
  730. optional WebhookClientConfig clientConfig = 2;
  731. // Rules describes what operations on what resources/subresources the webhook cares about.
  732. // The webhook cares about an operation if it matches _any_ Rule.
  733. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks
  734. // from putting the cluster in a state which cannot be recovered from without completely
  735. // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called
  736. // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.
  737. // +listType=atomic
  738. repeated RuleWithOperations rules = 3;
  739. // FailurePolicy defines how unrecognized errors from the admission endpoint are handled -
  740. // allowed values are Ignore or Fail. Defaults to Fail.
  741. // +optional
  742. optional string failurePolicy = 4;
  743. // matchPolicy defines how the "rules" list is used to match incoming requests.
  744. // Allowed values are "Exact" or "Equivalent".
  745. //
  746. // - Exact: match a request only if it exactly matches a specified rule.
  747. // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
  748. // but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
  749. // a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.
  750. //
  751. // - Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.
  752. // For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,
  753. // and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,
  754. // a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.
  755. //
  756. // Defaults to "Equivalent"
  757. // +optional
  758. optional string matchPolicy = 9;
  759. // NamespaceSelector decides whether to run the webhook on an object based
  760. // on whether the namespace for that object matches the selector. If the
  761. // object itself is a namespace, the matching is performed on
  762. // object.metadata.labels. If the object is another cluster scoped resource,
  763. // it never skips the webhook.
  764. //
  765. // For example, to run the webhook on any objects whose namespace is not
  766. // associated with "runlevel" of "0" or "1"; you will set the selector as
  767. // follows:
  768. // "namespaceSelector": {
  769. // "matchExpressions": [
  770. // {
  771. // "key": "runlevel",
  772. // "operator": "NotIn",
  773. // "values": [
  774. // "0",
  775. // "1"
  776. // ]
  777. // }
  778. // ]
  779. // }
  780. //
  781. // If instead you want to only run the webhook on any objects whose
  782. // namespace is associated with the "environment" of "prod" or "staging";
  783. // you will set the selector as follows:
  784. // "namespaceSelector": {
  785. // "matchExpressions": [
  786. // {
  787. // "key": "environment",
  788. // "operator": "In",
  789. // "values": [
  790. // "prod",
  791. // "staging"
  792. // ]
  793. // }
  794. // ]
  795. // }
  796. //
  797. // See
  798. // https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
  799. // for more examples of label selectors.
  800. //
  801. // Default to the empty LabelSelector, which matches everything.
  802. // +optional
  803. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5;
  804. // ObjectSelector decides whether to run the webhook based on if the
  805. // object has matching labels. objectSelector is evaluated against both
  806. // the oldObject and newObject that would be sent to the webhook, and
  807. // is considered to match if either object matches the selector. A null
  808. // object (oldObject in the case of create, or newObject in the case of
  809. // delete) or an object that cannot have labels (like a
  810. // DeploymentRollback or a PodProxyOptions object) is not considered to
  811. // match.
  812. // Use the object selector only if the webhook is opt-in, because end
  813. // users may skip the admission webhook by setting the labels.
  814. // Default to the empty LabelSelector, which matches everything.
  815. // +optional
  816. optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 10;
  817. // SideEffects states whether this webhook has side effects.
  818. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown).
  819. // Webhooks with side effects MUST implement a reconciliation system, since a request may be
  820. // rejected by a future step in the admission chain and the side effects therefore need to be undone.
  821. // Requests with the dryRun attribute will be auto-rejected if they match a webhook with
  822. // sideEffects == Unknown or Some.
  823. optional string sideEffects = 6;
  824. // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes,
  825. // the webhook call will be ignored or the API call will fail based on the
  826. // failure policy.
  827. // The timeout value must be between 1 and 30 seconds.
  828. // Default to 10 seconds.
  829. // +optional
  830. optional int32 timeoutSeconds = 7;
  831. // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview`
  832. // versions the Webhook expects. API server will try to use first version in
  833. // the list which it supports. If none of the versions specified in this list
  834. // supported by API server, validation will fail for this object.
  835. // If a persisted webhook configuration specifies allowed versions and does not
  836. // include any versions known to the API Server, calls to the webhook will fail
  837. // and be subject to the failure policy.
  838. // +listType=atomic
  839. repeated string admissionReviewVersions = 8;
  840. // MatchConditions is a list of conditions that must be met for a request to be sent to this
  841. // webhook. Match conditions filter requests that have already been matched by the rules,
  842. // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests.
  843. // There are a maximum of 64 match conditions allowed.
  844. //
  845. // The exact matching logic is (in order):
  846. // 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.
  847. // 2. If ALL matchConditions evaluate to TRUE, the webhook is called.
  848. // 3. If any matchCondition evaluates to an error (but none are FALSE):
  849. // - If failurePolicy=Fail, reject the request
  850. // - If failurePolicy=Ignore, the error is ignored and the webhook is skipped
  851. //
  852. // +patchMergeKey=name
  853. // +patchStrategy=merge
  854. // +listType=map
  855. // +listMapKey=name
  856. // +optional
  857. repeated MatchCondition matchConditions = 11;
  858. }
  859. // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.
  860. message ValidatingWebhookConfiguration {
  861. // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
  862. // +optional
  863. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
  864. // Webhooks is a list of webhooks and the affected resources and operations.
  865. // +optional
  866. // +patchMergeKey=name
  867. // +patchStrategy=merge
  868. // +listType=map
  869. // +listMapKey=name
  870. repeated ValidatingWebhook Webhooks = 2;
  871. }
  872. // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.
  873. message ValidatingWebhookConfigurationList {
  874. // Standard list metadata.
  875. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  876. // +optional
  877. optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
  878. // List of ValidatingWebhookConfiguration.
  879. repeated ValidatingWebhookConfiguration items = 2;
  880. }
  881. // Validation specifies the CEL expression which is used to apply the validation.
  882. message Validation {
  883. // Expression represents the expression which will be evaluated by CEL.
  884. // ref: https://github.com/google/cel-spec
  885. // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:
  886. //
  887. // - 'object' - The object from the incoming request. The value is null for DELETE requests.
  888. // - 'oldObject' - The existing object. The value is null for CREATE requests.
  889. // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).
  890. // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.
  891. // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.
  892. // - 'variables' - Map of composited variables, from its name to its lazily evaluated value.
  893. // For example, a variable named 'foo' can be accessed as 'variables.foo'.
  894. // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.
  895. // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz
  896. // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the
  897. // request resource.
  898. //
  899. // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the
  900. // object. No other metadata properties are accessible.
  901. //
  902. // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.
  903. // Accessible property names are escaped according to the following rules when accessed in the expression:
  904. // - '__' escapes to '__underscores__'
  905. // - '.' escapes to '__dot__'
  906. // - '-' escapes to '__dash__'
  907. // - '/' escapes to '__slash__'
  908. // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:
  909. // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if",
  910. // "import", "let", "loop", "package", "namespace", "return".
  911. // Examples:
  912. // - Expression accessing a property named "namespace": {"Expression": "object.__namespace__ > 0"}
  913. // - Expression accessing a property named "x-prop": {"Expression": "object.x__dash__prop > 0"}
  914. // - Expression accessing a property named "redact__d": {"Expression": "object.redact__underscores__d > 0"}
  915. //
  916. // Equality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1].
  917. // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:
  918. // - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and
  919. // non-intersecting elements in `Y` are appended, retaining their partial order.
  920. // - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values
  921. // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with
  922. // non-intersecting keys are appended, retaining their partial order.
  923. // Required.
  924. optional string Expression = 1;
  925. // Message represents the message displayed when validation fails. The message is required if the Expression contains
  926. // line breaks. The message must not contain line breaks.
  927. // If unset, the message is "failed rule: {Rule}".
  928. // e.g. "must be a URL with the host matching spec.host"
  929. // If the Expression contains line breaks. Message is required.
  930. // The message must not contain line breaks.
  931. // If unset, the message is "failed Expression: {Expression}".
  932. // +optional
  933. optional string message = 2;
  934. // Reason represents a machine-readable description of why this validation failed.
  935. // If this is the first validation in the list to fail, this reason, as well as the
  936. // corresponding HTTP response code, are used in the
  937. // HTTP response to the client.
  938. // The currently supported reasons are: "Unauthorized", "Forbidden", "Invalid", "RequestEntityTooLarge".
  939. // If not set, StatusReasonInvalid is used in the response to the client.
  940. // +optional
  941. optional string reason = 3;
  942. // messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
  943. // Since messageExpression is used as a failure message, it must evaluate to a string.
  944. // If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails.
  945. // If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced
  946. // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string
  947. // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and
  948. // the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged.
  949. // messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'.
  950. // Example:
  951. // "object.x must be less than max ("+string(params.max)+")"
  952. // +optional
  953. optional string messageExpression = 4;
  954. }
  955. // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression.
  956. // +structType=atomic
  957. message Variable {
  958. // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables.
  959. // The variable can be accessed in other expressions through `variables`
  960. // For example, if name is "foo", the variable will be available as `variables.foo`
  961. optional string Name = 1;
  962. // Expression is the expression that will be evaluated as the value of the variable.
  963. // The CEL expression has access to the same identifiers as the CEL expressions in Validation.
  964. optional string Expression = 2;
  965. }
  966. // WebhookClientConfig contains the information to make a TLS
  967. // connection with the webhook
  968. message WebhookClientConfig {
  969. // `url` gives the location of the webhook, in standard URL form
  970. // (`scheme://host:port/path`). Exactly one of `url` or `service`
  971. // must be specified.
  972. //
  973. // The `host` should not refer to a service running in the cluster; use
  974. // the `service` field instead. The host might be resolved via external
  975. // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve
  976. // in-cluster DNS as that would be a layering violation). `host` may
  977. // also be an IP address.
  978. //
  979. // Please note that using `localhost` or `127.0.0.1` as a `host` is
  980. // risky unless you take great care to run this webhook on all hosts
  981. // which run an apiserver which might need to make calls to this
  982. // webhook. Such installs are likely to be non-portable, i.e., not easy
  983. // to turn up in a new cluster.
  984. //
  985. // The scheme must be "https"; the URL must begin with "https://".
  986. //
  987. // A path is optional, and if present may be any string permissible in
  988. // a URL. You may use the path to pass an arbitrary string to the
  989. // webhook, for example, a cluster identifier.
  990. //
  991. // Attempting to use a user or basic auth e.g. "user:password@" is not
  992. // allowed. Fragments ("#...") and query parameters ("?...") are not
  993. // allowed, either.
  994. //
  995. // +optional
  996. optional string url = 3;
  997. // `service` is a reference to the service for this webhook. Either
  998. // `service` or `url` must be specified.
  999. //
  1000. // If the webhook is running within the cluster, then you should use `service`.
  1001. //
  1002. // +optional
  1003. optional ServiceReference service = 1;
  1004. // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate.
  1005. // If unspecified, system trust roots on the apiserver are used.
  1006. // +optional
  1007. optional bytes caBundle = 2;
  1008. }