Closed rexagod closed 1 year ago
Does the internal logic respect the version priority, even on specifying a certain version?
This is working as intended. All instances of a group/resource (regardless of version) are accessible via all versions served for that group/resource. The API server converts instances into the requested version.
That means if I create a v1 instance, and you list v1beta1, you will see the object I created, converted into the v1beta1 representation.
/close
@liggitt: Closing this issue.
PTAL at the code snippet below. Currently, if there's CRD installed that has three version defined under one group for one kind, then if we try to
list
the resources under a GVK combination that does not have any resource under it, it will still fetch resources from the GVK combination (with the versions that do have resources under them) and return that for every such query made.So effectively, a GV(no resource)K query, will yield all GV(any resource if G and K are the same as the other GVK)K resources.
Snippet to reproduce the issue.
```go package main import ( "context" "os" "github.com/davecgh/go-spew/spew" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/client-go/dynamic" "k8s.io/client-go/tools/clientcmd" ) func main() { kubeconfigPath, _ := os.LookupEnv("KUBECONFIG") config, _ := clientcmd.BuildConfigFromFlags("", kubeconfigPath) dynamicClient, _ := dynamic.NewForConfig(config) list, _ := dynamicClient.Resource(schema.GroupVersionResource{ Group: `