1package v2
2
3// UpdateRequest is a request to process mutate and generate rules in background.
4#UpdateRequest: {
5 _embeddedResource
6
7 // APIVersion defines the versioned schema of this representation of an object.
8 // Servers should convert recognized schemas to the latest internal value, and
9 // may reject unrecognized values.
10 // More info:
11 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
12 apiVersion?: string
13
14 // Kind is a string value representing the REST resource this object represents.
15 // Servers may infer this from the endpoint the client submits requests to.
16 // Cannot be updated.
17 // In CamelCase.
18 // More info:
19 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
20 kind?: string
21 metadata?: {}
22
23 // ResourceSpec is the information to identify the trigger resource.
24 spec?: {
25 // Context represents admission request context.
26 // It is used upon admission review only and is shared across rules within the same UR.
27 context!: {
28 // AdmissionRequestInfoObject stores the admission request and operation details
29 admissionRequestInfo?: {
30 // AdmissionRequest describes the admission.Attributes for the admission request.
31 admissionRequest?: {
32 // dryRun indicates that modifications will definitely not be persisted for this request.
33 // Defaults to false.
34 dryRun?: bool
35
36 // kind is the fully-qualified type of object being submitted (for example,
37 // v1.Pod or autoscaling.v1.Scale)
38 kind!: {
39 group!: string
40 kind!: string
41 version!: string
42 }
43
44 // name is the name of the object as presented in the request. On a CREATE
45 // operation, the client may omit name and
46 // rely on the server to generate the name. If that is the case, this field will
47 // contain an empty string.
48 name?: string
49
50 // namespace is the namespace associated with the request (if any).
51 namespace?: string
52
53 // object is the object from the incoming request.
54 object?: {...}
55
56 // oldObject is the existing object. Only populated for DELETE and UPDATE requests.
57 oldObject?: {...}
58
59 // operation is the operation being performed. This may be different than the operation
60 // requested. e.g. a patch can result in either a CREATE or UPDATE Operation.
61 operation!: string
62
63 // options is the operation option structure of the operation being performed.
64 // e.g. `meta.k8s.io/v1.DeleteOptions` or `meta.k8s.io/v1.CreateOptions`. This may be
65 // different than the options the caller provided. e.g. for a patch request the performed
66 // Operation might be a CREATE, in which case the Options will a
67 // `meta.k8s.io/v1.CreateOptions` even though the caller provided `meta.k8s.io/v1.PatchOptions`.
68 options?: {...}
69
70 // requestKind is the fully-qualified type of the original API request (for
71 // example, v1.Pod or autoscaling.v1.Scale).
72 // If this is specified and differs from the value in "kind", an equivalent
73 // match and conversion was performed.
74 //
75 // For example, if deployments can be modified via apps/v1 and apps/v1beta1, and
76 // a webhook registered a rule of
77 // `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and
78 // `matchPolicy: Equivalent`,
79 // an API request to apps/v1beta1 deployments would be converted and sent to the webhook
80 // with `kind: {group:"apps", version:"v1", kind:"Deployment"}` (matching the
81 // rule the webhook registered for),
82 // and `requestKind: {group:"apps", version:"v1beta1", kind:"Deployment"}`
83 // (indicating the kind of the original API request).
84 //
85 // See documentation for the "matchPolicy" field in the webhook configuration type for more details.
86 requestKind?: {
87 group!: string
88 kind!: string
89 version!: string
90 }
91
92 // requestResource is the fully-qualified resource of the original API request
93 // (for example, v1.pods).
94 // If this is specified and differs from the value in "resource", an equivalent
95 // match and conversion was performed.
96 //
97 // For example, if deployments can be modified via apps/v1 and apps/v1beta1, and
98 // a webhook registered a rule of
99 // `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and
100 // `matchPolicy: Equivalent`,
101 // an API request to apps/v1beta1 deployments would be converted and sent to the webhook
102 // with `resource: {group:"apps", version:"v1", resource:"deployments"}`
103 // (matching the resource the webhook registered for),
104 // and `requestResource: {group:"apps", version:"v1beta1",
105 // resource:"deployments"}` (indicating the resource of the original API
106 // request).
107 //
108 // See documentation for the "matchPolicy" field in the webhook configuration type.
109 requestResource?: {
110 group!: string
111 resource!: string
112 version!: string
113 }
114
115 // requestSubResource is the name of the subresource of the original API
116 // request, if any (for example, "status" or "scale")
117 // If this is specified and differs from the value in "subResource", an
118 // equivalent match and conversion was performed.
119 // See documentation for the "matchPolicy" field in the webhook configuration type.
120 requestSubResource?: string
121
122 // resource is the fully-qualified resource being requested (for example, v1.pods)
123 resource!: {
124 group!: string
125 resource!: string
126 version!: string
127 }
128
129 // subResource is the subresource being requested, if any (for example, "status" or "scale")
130 subResource?: string
131
132 // uid is an identifier for the individual request/response. It allows us to
133 // distinguish instances of requests which are
134 // otherwise identical (parallel requests, requests when earlier requests did not modify etc)
135 // The UID is meant to track the round trip (request/response) between the KAS
136 // and the WebHook, not the user request.
137 // It is suitable for correlating log entries between the webhook and apiserver,
138 // for either auditing or debugging.
139 uid!: string
140
141 // userInfo is information about the requesting user
142 userInfo!: {
143 // Any additional information provided by the authenticator.
144 extra?: [string]: [...string]
145
146 // The names of groups this user is a part of.
147 groups?: [...string]
148
149 // A unique value that identifies this user across time. If this user is
150 // deleted and another user by the same name is added, they will have
151 // different UIDs.
152 uid?: string
153
154 // The name that uniquely identifies this user among all active users.
155 username?: string
156 }
157 }
158
159 // Operation is the type of resource operation being checked for admission control
160 operation?: string
161 }
162
163 // RequestInfo contains permission info carried in an admission request.
164 userInfo?: {
165 // ClusterRoles is a list of possible clusterRoles send the request.
166 clusterRoles?: null | [...string]
167
168 // Roles is a list of possible role send the request.
169 roles?: null | [...string]
170
171 // DryRun indicates that modifications will definitely not be persisted for this request.
172 // Defaults to false.
173 synchronize?: bool
174
175 // UserInfo is the userInfo carried in the admission request.
176 userInfo?: {
177 // Any additional information provided by the authenticator.
178 extra?: [string]: [...string]
179
180 // The names of groups this user is a part of.
181 groups?: [...string]
182
183 // A unique value that identifies this user across time. If this user is
184 // deleted and another user by the same name is added, they will have
185 // different UIDs.
186 uid?: string
187
188 // The name that uniquely identifies this user among all active users.
189 username?: string
190 }
191 }
192 }
193
194 // DeleteDownstream represents whether the downstream needs to be deleted.
195 // Deprecated
196 deleteDownstream!: bool
197
198 // Specifies the name of the policy.
199 policy!: string
200
201 // Type represents request type for background processing
202 requestType?: "mutate" | "generate" | "cel-generate" | "cel-mutate"
203
204 // ResourceSpec is the information to identify the trigger resource.
205 resource!: {
206 // APIVersion specifies resource apiVersion.
207 apiVersion?: string
208
209 // Kind specifies resource kind.
210 kind?: string
211
212 // Name specifies the resource name.
213 name?: string
214
215 // Namespace specifies resource namespace.
216 namespace?: string
217
218 // UID specifies the resource uid.
219 uid?: string
220 }
221
222 // Rule is the associate rule name of the current UR.
223 rule!: string
224
225 // RuleContext is the associate context to apply rules.
226 // optional
227 ruleContext?: [...{
228 // CacheRestore indicates whether the cache should be restored.
229 cacheRestore?: bool
230
231 // DeleteDownstream represents whether the downstream needs to be deleted.
232 deleteDownstream!: bool
233
234 // Rule is the associate rule name of the current UR.
235 rule!: string
236
237 // Synchronize represents the sync behavior of the corresponding rule
238 // Optional. Defaults to "false" if not specified.
239 synchronize?: bool
240
241 // ResourceSpec is the information to identify the trigger resource.
242 trigger!: {
243 // APIVersion specifies resource apiVersion.
244 apiVersion?: string
245
246 // Kind specifies resource kind.
247 kind?: string
248
249 // Name specifies the resource name.
250 name?: string
251
252 // Namespace specifies resource namespace.
253 namespace?: string
254
255 // UID specifies the resource uid.
256 uid?: string
257 }
258 }]
259
260 // Synchronize represents the sync behavior of the corresponding rule
261 // Optional. Defaults to "false" if not specified.
262 // Deprecated, will be removed in 1.14.
263 synchronize?: bool
264 }
265
266 // Status contains statistics related to update request.
267 status?: {
268 // This will track the resources that are updated by the generate Policy.
269 // Will be used during clean up resources.
270 generatedResources?: [...{
271 // APIVersion specifies resource apiVersion.
272 apiVersion?: string
273
274 // Kind specifies resource kind.
275 kind?: string
276
277 // Name specifies the resource name.
278 name?: string
279
280 // Namespace specifies resource namespace.
281 namespace?: string
282
283 // UID specifies the resource uid.
284 uid?: string
285 }]
286
287 // Specifies request status message.
288 message?: string
289 retryCount?: int
290
291 // State represents state of the update request.
292 state!: string
293 }
294
295 _embeddedResource: {
296 apiVersion!: string
297 kind!: string
298 metadata?: {...}
299 }
300 apiVersion: "kyverno.io/v2"
301 kind: "UpdateRequest"
302 metadata!: {
303 name!: string
304 namespace!: string
305 labels?: [string]: string
306 annotations?: [string]: string
307 ...
308 }
309}