-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[1.20.2] FakeDynamicClient can't assign or convert unstructured.Unstructured into list item type #983
Comments
Note that no error was returned in v1.19 |
k8s 1.20's fake dynamic client returns an error trying to convert an unstructured type to the list's underlying type. Skipping the resource list unit test until the fake dynamic client is fixed upstream. See kubernetes/client-go#983
k8s 1.20's fake dynamic client returns an error trying to convert an unstructured type to the list's underlying type. Skipping the resource list unit test until the fake dynamic client is fixed upstream. See kubernetes/client-go#983
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:
You can:
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:
You can:
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:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closing this issue. 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. |
v0.21.4 fixed. Related commits: |
… NewSimpleDynamicClientWithCustomListKinds Using NewSimpleDynamicClientWithCustomListKinds leads to an error during type conversion from unstructured to an instance of the object. Remove the gvrToListKind argument as its no longer needed. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
… NewSimpleDynamicClientWithCustomListKinds Using NewSimpleDynamicClientWithCustomListKinds leads to an error during type conversion from unstructured to an instance of the object. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
…d map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
…d map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
…d map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
…d map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
…d map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
…d map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]>
* feature: Add LabelSelector as a field of resource spec to allow fetching by labels Signed-off-by: aerosouund <[email protected]> * chore: Generate CRDs Signed-off-by: aerosouund <[email protected]> * feat: Add the capability to fetch with label selector - Add the label selector as a parameter to GetResources of the engine api client and the dclient. - Use the label selector with list options in the dclient. - convert a metav1.LabelSelector to a labels.Selector before fetching to be able to convert it to a string to be used with ListOptions. Signed-off-by: aerosouund <[email protected]> * feat: Pass label selector to the GetResources method Signed-off-by: aerosouund <[email protected]> * feat: Return the resource selector when resolving spec Signed-off-by: aerosouund <[email protected]> * fix: Instantiate the fake client schema using the passed gvrToListKind map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]> * test: Add labelSelector unit test to mutate existing test. - Remove the unwanted call to GetResource. - Pass an empty map of GVR to string to the fake client constructor. Signed-off-by: aerosouund <[email protected]> * test: Add chainsaw test Signed-off-by: aerosouund <[email protected]> * chore: Run codegen Signed-off-by: aerosouund <[email protected]> * chore: Generate helm CRDs Signed-off-by: aerosouund <[email protected]> * refactor: Put the LabelSelector in a separate struct Many types use the ResourceSpec struct and not all of them support label selectors. This removes the field into a separate schema dedicated to target selection called TargetSelector. It has the ResourceSpec and the selector. Signed-off-by: aerosouund <[email protected]> * chore: Run codegen after modifying selector comment Signed-off-by: aerosouund <[email protected]> * chore: Run codegen Signed-off-by: aerosouund <[email protected]> --------- Signed-off-by: aerosouund <[email protected]> Co-authored-by: shuting <[email protected]>
* feature: Add LabelSelector as a field of resource spec to allow fetching by labels Signed-off-by: aerosouund <[email protected]> * chore: Generate CRDs Signed-off-by: aerosouund <[email protected]> * feat: Add the capability to fetch with label selector - Add the label selector as a parameter to GetResources of the engine api client and the dclient. - Use the label selector with list options in the dclient. - convert a metav1.LabelSelector to a labels.Selector before fetching to be able to convert it to a string to be used with ListOptions. Signed-off-by: aerosouund <[email protected]> * feat: Pass label selector to the GetResources method Signed-off-by: aerosouund <[email protected]> * feat: Return the resource selector when resolving spec Signed-off-by: aerosouund <[email protected]> * fix: Instantiate the fake client schema using the passed gvrToListKind map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]> * test: Add labelSelector unit test to mutate existing test. - Remove the unwanted call to GetResource. - Pass an empty map of GVR to string to the fake client constructor. Signed-off-by: aerosouund <[email protected]> * test: Add chainsaw test Signed-off-by: aerosouund <[email protected]> * chore: Run codegen Signed-off-by: aerosouund <[email protected]> * chore: Generate helm CRDs Signed-off-by: aerosouund <[email protected]> * refactor: Put the LabelSelector in a separate struct Many types use the ResourceSpec struct and not all of them support label selectors. This removes the field into a separate schema dedicated to target selection called TargetSelector. It has the ResourceSpec and the selector. Signed-off-by: aerosouund <[email protected]> * chore: Run codegen after modifying selector comment Signed-off-by: aerosouund <[email protected]> * chore: Run codegen Signed-off-by: aerosouund <[email protected]> --------- Signed-off-by: aerosouund <[email protected]> Co-authored-by: shuting <[email protected]>
* feature: Add LabelSelector as a field of resource spec to allow fetching by labels * chore: Generate CRDs * feat: Add the capability to fetch with label selector - Add the label selector as a parameter to GetResources of the engine api client and the dclient. - Use the label selector with list options in the dclient. - convert a metav1.LabelSelector to a labels.Selector before fetching to be able to convert it to a string to be used with ListOptions. * feat: Pass label selector to the GetResources method * feat: Return the resource selector when resolving spec * fix: Instantiate the fake client schema using the passed gvrToListKind map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 * test: Add labelSelector unit test to mutate existing test. - Remove the unwanted call to GetResource. - Pass an empty map of GVR to string to the fake client constructor. * test: Add chainsaw test * chore: Run codegen * chore: Generate helm CRDs * refactor: Put the LabelSelector in a separate struct Many types use the ResourceSpec struct and not all of them support label selectors. This removes the field into a separate schema dedicated to target selection called TargetSelector. It has the ResourceSpec and the selector. * chore: Run codegen after modifying selector comment * chore: Run codegen --------- Signed-off-by: aerosouund <[email protected]> Co-authored-by: Ammar Yasser <[email protected]> Co-authored-by: shuting <[email protected]>
* feature: Add LabelSelector as a field of resource spec to allow fetching by labels Signed-off-by: aerosouund <[email protected]> * chore: Generate CRDs Signed-off-by: aerosouund <[email protected]> * feat: Add the capability to fetch with label selector - Add the label selector as a parameter to GetResources of the engine api client and the dclient. - Use the label selector with list options in the dclient. - convert a metav1.LabelSelector to a labels.Selector before fetching to be able to convert it to a string to be used with ListOptions. Signed-off-by: aerosouund <[email protected]> * feat: Pass label selector to the GetResources method Signed-off-by: aerosouund <[email protected]> * feat: Return the resource selector when resolving spec Signed-off-by: aerosouund <[email protected]> * fix: Instantiate the fake client schema using the passed gvrToListKind map and by inferring schema from passed resources All tests that use List will fail because the fake client doesn't infer the schema from the passed resources. gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported. References: - kubernetes/client-go#983 - kubernetes/client-go@46c1ad3 Signed-off-by: aerosouund <[email protected]> * test: Add labelSelector unit test to mutate existing test. - Remove the unwanted call to GetResource. - Pass an empty map of GVR to string to the fake client constructor. Signed-off-by: aerosouund <[email protected]> * test: Add chainsaw test Signed-off-by: aerosouund <[email protected]> * chore: Run codegen Signed-off-by: aerosouund <[email protected]> * chore: Generate helm CRDs Signed-off-by: aerosouund <[email protected]> * refactor: Put the LabelSelector in a separate struct Many types use the ResourceSpec struct and not all of them support label selectors. This removes the field into a separate schema dedicated to target selection called TargetSelector. It has the ResourceSpec and the selector. Signed-off-by: aerosouund <[email protected]> * chore: Run codegen after modifying selector comment Signed-off-by: aerosouund <[email protected]> * chore: Run codegen Signed-off-by: aerosouund <[email protected]> --------- Signed-off-by: aerosouund <[email protected]> Co-authored-by: shuting <[email protected]> Signed-off-by: pipo02mix <[email protected]>
Code repository uses the fake dynamic client to test the interaction with a custom resource (Kind: Build, GV: shipwright.io/v1alpha1).
The custom resource has its core object and list types registered to a scheme, and the CRD's scheme is added to the core scheme when setting up the dynamic client.
When running a unit test with the fake dynamic client, the resource can be created and retrieved via the GET resource interface. However when trying to list the objects, the following error is returned:
Is this a bug in the fake dynamic client?
The text was updated successfully, but these errors were encountered: