-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
RawCustomResourceOperationsImpl#delete(String) invalid JavaDoc and variable names #2780
RawCustomResourceOperationsImpl#delete(String) invalid JavaDoc and variable names #2780
Comments
I tested this and seems like it's actually for bulk deletion. If I have these resources in my kubernetes cluster:
If I run this code, all dummies in default namespace get deleted: boolean result = client.customResource(context).delete("default", new DeleteOptionsBuilder()
.withPropagationPolicy(DeletionPropagation.BACKGROUND.toString())
.build()); I think for ClusterScope resources it doesn't even matter if user provides a namespace or not. Since while building the API endpoint for CustomResource we check the scope of CustomResource and skip adding namespace to it: Lines 738 to 740 in 5df8dae
Right now for deleting a Cluster scoped custom resource, this seems to work: CustomResourceDefinitionContext context = new CustomResourceDefinitionContext.Builder()
.withGroup("demos.fabric8.io")
.withScope("Cluster")
.withPlural("satellites")
.withVersion("v1alpha1")
.build();
boolean result = client.customResource(context).delete(null, "callisto"); Even this is working(which is not good): boolean result = client.customResource(context).delete("idontexist", "callisto"); |
The problem is that for cluster scoped resources, using the following method: boolean result = client.customResource(context).delete(null, "callisto"); doesn't make sense because the resource is cluster scoped. And using the single argument method boolean result = client.customResource(context).delete("callisto"); makes sense in terms of UX, but not in terms of JavaDoc or variable naming. Since the argument is named |
As agreed during our call. In order to start providing a consistent API with the rest of the Client Operation implementations, we'll start by Besides, the current methods:
Will be reimplemented to consider both situations public Map<String, Object> delete(String nameOrNamespace) {
if (customResourceDefinition.getScope().equals("Namespaced") && namespace != null) {
return makeCall(fetchUrl(nameOrNamespace, null, null), null, HttpCallMethod.DELETE);
}
return makeCall(fetchUrl(null, nameOrNamespace, null), null, HttpCallMethod.DELETE);
} and JavaDocs will be updated accordingly to describe the possible outcomes of the method invocation depending on the |
…tring) + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext + Added helper `withName()`, `inNamespace()`, `inAnyNamespace()` methods to allow user to configure name/namespace instead of specifying them in method parameters
…tring) + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext + Added helper `withName()`, `inNamespace()`, `inAnyNamespace()` methods to allow user to configure name/namespace instead of specifying them in method parameters
…tring) + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext + Added helper `withName()`, `inNamespace()`, `inAnyNamespace()` methods to allow user to configure name/namespace instead of specifying them in method parameters
…tring) + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext
…tring) + Move namespace and name to be member fields rather than being specified in method parameters so that they can be configured using `withName`, `inNamespace` methods + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext
…tring) + Move namespace and name to be member fields rather than being specified in method parameters so that they can be configured using `withName`, `inNamespace` methods + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext
…tring) + Move namespace and name to be member fields rather than being specified in method parameters so that they can be configured using `withName`, `inNamespace` methods + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext
+ Move namespace and name to be member fields rather than being specified in method parameters so that they can be configured using `withName`, `inNamespace` methods + Right now these single argument delete methods are quite confusing. On first look user might think it's for deleting a Cluster Scoped Custom Resource. Hence, modifying it to behave differently based on Scope provided in CustomResourceDefinitionContext
Description
The method
public Map<String, Object> delete(String namespace)
has a wrong description ar at least a partial description.kubernetes-client/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/RawCustomResourceOperationsImpl.java
Lines 421 to 429 in e5e48ca
If this method is invoked for a
Cluster
scoped CR, it will delete a CR with that name.Not sure if the rest of the JavaDoc is actually correct for
Namespaced
scoped CRs.The text was updated successfully, but these errors were encountered: