You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I currently using following type as a hacky workaround:
#[derive(Deserialize,Serialize,Clone)]structMetadataLessDynamicObjectForAdmissionReview(serde_json::Value);implResourceforMetadataLessDynamicObjectForAdmissionReview{typeDynamicType = ApiResource;fngroup(dt:&ApiResource) -> Cow<'_,str>{
dt.group.as_str().into()}fnversion(dt:&ApiResource) -> Cow<'_,str>{
dt.version.as_str().into()}fnkind(dt:&ApiResource) -> Cow<'_,str>{
dt.kind.as_str().into()}fnapi_version(dt:&ApiResource) -> Cow<'_,str>{
dt.api_version.as_str().into()}fnplural(dt:&ApiResource) -> Cow<'_,str>{
dt.plural.as_str().into()}fnmeta(&self) -> &ObjectMeta{panic!("This method `meta` should not be called. This is a bug.")}fnmeta_mut(&mutself) -> &mutObjectMeta{panic!("This method `meta_mut` should not be called. This is a bug.")}}
Environment
Client Version: v1.24.3
Kustomize Version: v4.5.4
Server Version: v1.20.15
Configuration and features
No response
Affected crates
kube-core
Would you like to work on fixing this bug?
No response
The text was updated successfully, but these errors were encountered:
Thanks for this report. It looks like Kubernetes does not treat subresources (like PodExecOptions and PodAttachOptions - neither are presented with metadata in the schema) like true (top level) objects and appear exempt from the api convention of metadata for objects.
Maybe there's room for another dynamic type here (like your last suggestion), but I am leaning towards just adding the #[serde(default)] to the DynamicObject's metadata direct and document that metadata for subresources are not filled in and must be read from the parent object. All the properties of ObjectMeta are optional after all (and kubernetes generally treats them as +optional anyway) and we no longer assume a lot about them in ResourceExt after the last deprecation.
Current and expected behavior
When making an admission controller for
pod/exec
resource, I cannot deserialize the admission request intoAdmissionReview<DynamicObject>
.The actual request looks like this:
Deserialization into
AdmissionReview<DynamicObject>
always fails because the object......does not have
metadata
.I think this is a bug.
Possible solution
No response
Additional context
I currently using following type as a hacky workaround:
Environment
Configuration and features
No response
Affected crates
kube-core
Would you like to work on fixing this bug?
No response
The text was updated successfully, but these errors were encountered: