client-go
client-go copied to clipboard
Retrieving ServerGroupsAndResources then Group and Version are empty for APIResources
I'm trying to get all the resources for a given Api Group. I'm using the method ServerGroupsAndResource from the client. It returns a list of APIResourceList containing TypeMeta, GroupVersion and APIResources Element GroupVersion is "apps/v1" , "apiregistration.k8s.io/v1" , and so on. But, in the APIResources list inside every APIResourceList the elements have Group and Version empty.
I would expect that APIResourceList.GroupVersion is reflected in every APIResourceList.APIResources.Group & Version
My test code
func main() {
k8sclient := kubernetes.NewForConfigOrDie(config)
groupfilter := "apps/v1"
_, resources, _ := k8sclient.ServerGroupsAndResources()
for _, resourceGroup := range resources {
if resourceGroup.GroupVersion == groupfilter {
for _, apiResource := range resourceGroup.APIResources {
groupVersionKind := resourceGroup.GroupVersionKind()
gkv := schema.GroupVersionResource{
Group: groupVersionKind.Group,
Resource: apiResource.Kind,
Version: groupVersionKind.Version,
}
resource, err := clientset.Resource(gkv).List(ctx, metav1.ListOptions{})
fmt.Printf("GKV %+v Resource %+v", gkv, resource, err)
}
}
}
}
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale
- Mark this issue or PR as rotten with
/lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Close this issue or PR with
/close
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied - After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied - After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closed
You can:
- Reopen this issue or PR with
/reopen
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
@k8s-triage-robot: Closing this issue.
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/stale
is applied- After 30d of inactivity since
lifecycle/stale
was applied,lifecycle/rotten
is applied- After 30d of inactivity since
lifecycle/rotten
was applied, the issue is closedYou can:
- Reopen this issue or PR with
/reopen
- Mark this issue or PR as fresh with
/remove-lifecycle rotten
- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
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.