Closed abikouo closed 3 years ago
Merging #389 (35cc336) into main (c9157ce) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## main #389 +/- ##
=======================================
Coverage 23.17% 23.17%
=======================================
Files 1 1
Lines 151 151
Branches 24 24
=======================================
Hits 35 35
Misses 111 111
Partials 5 5
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update c9157ce...35cc336. Read the comment docs.
@abikouo Thanks for the PR. Could you please paste return info before and after?
Hi @Akasurde
The return info before the commit was similar to this
{
"": {
"api_version": "v1",
"categories": [],
"kind": "Binding",
"name": "bindings",
"namespaced": true,
"preferred": true,
"short_names": [],
"singular_name": "binding"
},
"admissionregistration.k8s.io": {
"api_version": "admissionregistration.k8s.io/v1",
"categories": [],
"kind": "ValidatingWebhookConfiguration",
"name": "validatingwebhookconfigurations",
"namespaced": false,
"preferred": true,
"short_names": [],
"singular_name": "validatingwebhookconfiguration"
},
"apiextensions.k8s.io": {
"api_version": "apiextensions.k8s.io/v1",
"categories": [],
"kind": "CustomResourceDefinition",
"name": "customresourcedefinitions",
"namespaced": false,
"preferred": true,
"short_names": [
"crd",
"crds"
],
"singular_name": "customresourcedefinition"
},
[...]
}
now the return info will look like this
{
"": [
{
"api_version": "v1",
"categories": [],
"kind": "Binding",
"name": "bindings",
"namespaced": true,
"preferred": true,
"short_names": [],
"singular_name": "binding"
},
{
"api_version": "v1",
"categories": [],
"kind": "ComponentStatus",
"name": "componentstatuses",
"namespaced": false,
"preferred": true,
"short_names": [
"cs"
],
"singular_name": "componentstatuse"
},
[...]
],
"admissionregistration.k8s.io": [
{
"api_version": "admissionregistration.k8s.io/v1",
"categories": [],
"kind": "MutatingWebhookConfiguration",
"name": "mutatingwebhookconfigurations",
"namespaced": false,
"preferred": true,
"short_names": [],
"singular_name": "mutatingwebhookconfiguration"
},
{
"api_version": "admissionregistration.k8s.io/v1",
"categories": [],
"kind": "ValidatingWebhookConfiguration",
"name": "validatingwebhookconfigurations",
"namespaced": false,
"preferred": true,
"short_names": [],
"singular_name": "validatingwebhookconfiguration"
},
[...]
],
"apiextensions.k8s.io": [
{
"api_version": "apiextensions.k8s.io/v1",
"categories": [],
"kind": "CustomResourceDefinition",
"name": "customresourcedefinitions",
"namespaced": false,
"preferred": true,
"short_names": [
"crd",
"crds"
],
"singular_name": "customresourcedefinition"
},
{
"api_version": "apiextensions.k8s.io/v1beta1",
"categories": [],
"kind": "CustomResourceDefinition",
"name": "customresourcedefinitions",
"namespaced": false,
"preferred": false,
"short_names": [
"crd",
"crds"
],
"singular_name": "customresourcedefinition"
}
],
[...]
}
@abikouo @tima @gravesm I think this is a "breaking change". Previously we returned dict whereas now this change return list inside a dict.
Yes, this would be a breaking change. Also, we should add some tests for this, or better yet, just fix the test in https://github.com/ansible-collections/community.kubernetes/blob/main/molecule/default/tasks/cluster_info.yml. That test failed to catch this bug and is also failing to catch this breaking change, which says to me it's not a very good test.
@Akasurde I totally agree with you, in fact there were 2 proposals to solve this issue, either returning items as on list per group (this is what has been done here) or change the key of the return dictionary in order to avoid overriding items
Good point @Akasurde. I think if we wanted to introduce this breaking changing doing it as part of the v2.0 effort would be a good time. We'll need to make sure to clearly document this break and promote it perhaps as some sort of porting guidance section.
@gravesm please have a look. WDYT
I'm :+1: on @fabianvf's suggestion of group+version+kind.
I'm on @fabianvf's suggestion of group+version+kind.
Hey @gravesm
the pull request has been updated accordingly, could you please review ?
Thanks
migrated to kubernetes.core
This repository does not accept pull requests, see the README for details.
SUMMARY
Apis being overwritten when multiple values on the same group Fix #380
ISSUE TYPE
COMPONENT NAME
k8s_cluster_info
ADDITIONAL INFORMATION
output after change