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
Make ApplyConfigurations dynamically extractable in tests #1322
Comments
cc @apelisse |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues 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. This bot triages un-triaged issues 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 according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close not-planned |
@k8s-triage-robot: Closing this issue, marking it as "Not Planned". 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-sigs/prow repository. |
SSA and ApplyConfigurations are great, but writing dynamic (that is, not specific to any one kubernetes type) logic seems to be currently untestable due to how applyconfigurations are organized. I'm trying to write logic for any kubernetes type that can 1) accept and apply an arbitrary applyconfig to a dynamic resource client, and 2) when the underlying collection changes, extract an applyconfig from the latest object, and compare it to the most recently applied applyconfig, triggering a re-apply if the two differ. This seems to be the primary use case for apply, except that it is done using a dynamic client rather than typed clients.
The following code appears to work when running against a live api server (pseudo code for brevity):
However, when the above code is passed a
*fakediscovery.FakeDiscovery
as d, the code results in a panic. This is because the FakeDiscovery server returns an empty Open API document at OpenAPISchema(), which the UnstructuredExtractor depends on being non-empty.Typed clients bypass this problem by accessing embedded open api schema in their respective internal packages such as https://github.com/kubernetes/client-go/blob/master/applyconfigurations/internal/internal.go#L41, but this schema is not directly available to the FakeClient in a unit test.
In order for dynamic SSA to be testable, the internal packages of typed clients should be moved to an importable location.
The text was updated successfully, but these errors were encountered: