feat(kube): Convert kube_openapi Resource to DynamicObject #180
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: NationTech/harmony#180
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/kube_convert_dynamic_resource"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Utility function to allow initializing strongly typed resources and then bundle various types into a list of DynamicObject
@ -0,0 +115,4 @@secret.metadata.namespace = Some("false".to_string());let modified_value = serde_json::to_value(&secret).expect("Failed to serialize Secret");assert_ne!(modified_value, dynamic_value);What's the purpose of these 3 last lines? They don't really seem relevant for this test, it's basically testing
serde_json::to_valueand notkube_resource_to_dynamicI know it looks this way but I feel more comfortable having them in.
We're completely dependent on the serialized values for the "real" assertion above and I've often seen cases where the value just ended up being empty or missing some relevant field so assert_eq!(empty, empty) is true and the tests passes. But if for some reason the serialization implementation of the kube::Resource changes to exclude the metadata field or something like that we would be broken without a test failing.
I know I'm kind of splitting hair but I'm just speaking from experience even if I can't explain it that well.
@ -0,0 +178,4 @@.unwrap(),"nginx".to_string());}I'm not sure about the value of these 2 last assertions. The main assert
assert_eq!(original_value, dynamic_value)already validates this.It does not validate "this" directly, it just validates that the serde Serialize implementation returns equal values for original and dynamic. For all we know they could be empty. I want to make sure they contain the actual correct data, that the dynamic type truly contains the fields expected.
After checking my comments 👍
feat(kube): Utility function to convert kube_openapi Resource to DynamicObject. This will allow initializing resources strongly typed and then bundle various types into a list of DynamicObjectto feat(kube): Convert kube_openapi Resource to DynamicObjectI am merging, we can continue the conversation later.