-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
design of resource and resourceList methods #3407
Comments
2 - is not a simple change. BaseOperation/HasMetadataOperation can't implement two Namespaceable interfaces. The simplest thing we could do is change resource to return Resource, so client.resource(resource) would be implemented by something like:
However that means you would loose the ability to later call inNamespace as that is not provided on the Resource interface. The only drawback is that means you have to directly manipulate the resource object (or convert the string to object) to change the namespace. |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
Also relates to #3860 - if you use the KubernetesClient.load methods they are different that the Loadable.load methods - they will default to inferring the namespace from the item, and allow for the namespace to be changed. I'd like to make everything uniform if possible for 6.0 |
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
Kubernetes.resource now returns NamespaceableResource also adds sanity checks useful for fabric8io#3859 as well
@manusa @rohanKanojia #3858 proposes to replace convert the resource method into one that returns NamespaceableResource - a Resource that also exposes an inNamespace call. The implementation is roughly doing what is described in #3407 (comment) Other than the interface name changes, the biggest difference in support is deletingExisting, which is discussed in the pr comments. For resourceList - there are two/three list apis - load/resourceList(String) which expose parameterizable, the other resourceList methods, and lists().load - which instead exposes a RecreateFromServerGettable. It doesn't appear that lists() logic is widely used. Looking at it more I see that lists().load(...).delete() - won't do anything, and deletingExisting isn't doing anything either. Should lists() simply be deprecated? It appears also that parameterizable is exposed to account for the case where you are using the kubernetesclient (which is actually a DefaultOpenShiftClient) and the list may contain a template. It may be better to push that concern entirely over to the openshiftclient instead. The core of the resourceList methods is ListVisitFromServerGetDeleteRecreateWaitApplicable. An option touched on above is to deprecate anything that doesn't make sense - and not add anything else to this interface other than have it expose a List<Resource>. The user would make use of lambdas resourceList(...).getResources().forEach(r -> r.withGracePeriod(10).delete()); - or whatever sequence of options they want. |
It might be good to cover namespace expectations of the various methods: KuberntesClient.resource / resourceList - use the namespace from the item by default, override both the item and the context with inNamespace KubernetesClient.lists.load, Loadable.load - expect the item namespace to match context namespace, there is no option to change item or the context namespace after the load call. |
…n logic also various cleanups and adding some migration docs
…n logic also various cleanups and adding some migration docs
…n logic also various cleanups and adding some migration docs
Resolved by #3858 |
After #3364 the implementation logic for these methods aligns well with everything else. However they are still not aligned completely with the rest of the api.
There are several possibilities:
Would be
The interface for resourceList would be minimized to just a handful of operations, as any operation could be implemented by
The text was updated successfully, but these errors were encountered: