Skip to content

Apply using typed apply configurations doesn't deserialize the response into the passed object #3474

@alvaroaleman

Description

@alvaroaleman

The client-go result requires a runtime.Object to decode into: https://github.com/kubernetes/kubernetes/blob/dfbe79674a33c47c1f0fd7b75882314f6db5e136/staging/src/k8s.io/client-go/rest/request.go#L1449

Because of this, the controller-runtime typed apply wraps the passed applyconfiguration with something that implements runtime.Object and embedds an interface for the applyconfiguration:

Into(runtimeObjectFromApplyConfiguration(obj))
func runtimeObjectFromApplyConfiguration(ac runtime.ApplyConfiguration) runtime.Object {
return &applyconfigurationRuntimeObject{ApplyConfiguration: ac}
}

The json unmarshaller however doesn't inline interfaces, only embedded structs. As a result, only hypothetical fields under an ApplyConfiguration key would be deserialized into the applyconfiguration and hence we never update the passed applyconfiguration.

Deserialization of the result works fine in the case of unstructured.

/kind bug
/assign

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions