generated.proto 50 KB

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