-
Notifications
You must be signed in to change notification settings - Fork 145
Always set apiVersion and kind for resources within a resource list #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When the Kubernetes REST API returns a list of objects, it returns a resource list object with an apiVersion and kind set to "KindList" where "Kind" is the Kind of object queried, rather than an simple array of objects. The `items` property contains the array of resources returned. Each resource in this list does not contain the GVK information, only the resource list has an apiVersion or kind property set. This ensures when a resource list is returned, each resource within the list has it's apiVersion and kind set, to make it similar to other Kubernetes clients, and easier to work with the returned resources.
37d9ed5 to
17dd847
Compare
|
/cherrypick release-0.9 |
|
@fabianvf: once the present PR merges, I will cherry-pick it on top of release-0.9 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/cherrypick release-0.8 |
|
@fabianvf: once the present PR merges, I will cherry-pick it on top of release-0.8 in a new PR and assign it to you. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Just do one big serialization at the end of a ResourceList operation
|
@fabianvf: new pull request created: #301 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@fabianvf: #298 failed to apply on top of branch "release-0.8": In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
…penshift#298) * Always set apiVersion and kind for resources within a resource list When the Kubernetes REST API returns a list of objects, it returns a resource list object with an apiVersion and kind set to "KindList" where "Kind" is the Kind of object queried, rather than an simple array of objects. The `items` property contains the array of resources returned. Each resource in this list does not contain the GVK information, only the resource list has an apiVersion or kind property set. This ensures when a resource list is returned, each resource within the list has it's apiVersion and kind set, to make it similar to other Kubernetes clients, and easier to work with the returned resources. * Just do one big serialization at the end of a ResourceList operation (cherry picked from commit 68cc0e3)
…298) (#302) * Always set apiVersion and kind for resources within a resource list When the Kubernetes REST API returns a list of objects, it returns a resource list object with an apiVersion and kind set to "KindList" where "Kind" is the Kind of object queried, rather than an simple array of objects. The `items` property contains the array of resources returned. Each resource in this list does not contain the GVK information, only the resource list has an apiVersion or kind property set. This ensures when a resource list is returned, each resource within the list has it's apiVersion and kind set, to make it similar to other Kubernetes clients, and easier to work with the returned resources. * Just do one big serialization at the end of a ResourceList operation (cherry picked from commit 68cc0e3)
Includes a fix from openshift/openshift-restclient-python#298 which ensures resources returned in a list have GVK information populated.
…penshift#298) * Always set apiVersion and kind for resources within a resource list When the Kubernetes REST API returns a list of objects, it returns a resource list object with an apiVersion and kind set to "KindList" where "Kind" is the Kind of object queried, rather than an simple array of objects. The `items` property contains the array of resources returned. Each resource in this list does not contain the GVK information, only the resource list has an apiVersion or kind property set. This ensures when a resource list is returned, each resource within the list has it's apiVersion and kind set, to make it similar to other Kubernetes clients, and easier to work with the returned resources. * Just do one big serialization at the end of a ResourceList operation
When the Kubernetes REST API returns a list of objects, it returns a
resource list object with an apiVersion and kind set to "KindList" where
"Kind" is the Kind of object queried, rather than an simple array of
objects.
The
itemsproperty contains the array of resources returned. Eachresource in this list does not contain the GVK information, only the
resource list has an apiVersion or kind property set.
This ensures when a resource list is returned, each resource within the
list has it's apiVersion and kind set, to make it similar to other
Kubernetes clients, and easier to work with the returned resources.
My primary reason for contributing this is because in the k8s_facts module in
Ansible pulls the
itemsout of a resource list(https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/k8s/common.py#L211-L212), but each item in a resource
list doesn't have the apiVersion/kind information, only the list object itself
does, so you can't inspect the
kind of the objects returned, which is problematic.