Skip to content
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

ValidatingWebhookConfigurationOperationsImpl should be a NonNamespaceOperation #1387

Closed
leogps opened this issue Mar 6, 2019 · 6 comments
Closed
Labels

Comments

@leogps
Copy link

leogps commented Mar 6, 2019

When dealing with ValidatingWebhookConfiguration, namespace should not be specified in the url.
However, when creating a ValidatingWebhookConfiguration throws an exception as it ends up appending namespace to the url.

The following code constructs the URL incorrectly.

ValidatingWebhookConfiguration validatingWebhookConfiguration = new ValidatingWebhookConfiguration();
//.....
//.....
//.....
try(KubernetesClient kubernetesClient = new DefaultKubernetesClient(config)) {
            kubernetesClient
                    .resource(validatingWebhookConfiguration)
                    .createOrReplace();
}

Constructs:

https://:/apis/admissionregistration.k8s.io/v1beta1/namespaces/default/validatingwebhookconfigurations

Instead of:

https://:/apis/admissionregistration.k8s.io/v1beta1/validatingwebhookconfigurations

Reproducible with: kubernetes-client-4.1.2.jar

@rohanKanojia
Copy link
Member

@leogps : Could you please create a quick PR to resolve this?

@rohanKanojia
Copy link
Member

We need to add this method somehow, but it's autogenerated:

@Override
public boolean isResourceNamespaced() {
return false;
}

@leogps
Copy link
Author

leogps commented Mar 7, 2019

I see that the implementation makes use of jsonschema2pojo to auto-generate the pojos and seems like the Handler and the OperationImpl are also auto-generated. I am not sure how exactly this is accomplished.
Also, a git-blame on StorageClassOperationsImpl suggests that it was copied off of an auto-generated class.
Maybe, that is the way to go about this.

The ideal solution might be to fix the auto-generate logic to include the method properly.
Also isResourceNamespaced() doesn't suffice I guess. The checkNamespace() should be overridden to return null as OperationSupport#checkNamespace assumes a namespace and resolves to default even if the metadata does not include namespace.

@rohanKanojia
Copy link
Member

@leogps : I think you're right. If we copy that class from target to dsl, and make changes onto it, it gets overridden. let me create a quick PR myself

rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Mar 11, 2019
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Mar 11, 2019
iocanel pushed a commit to iocanel/kubernetes-client that referenced this issue Mar 14, 2019
@leogps
Copy link
Author

leogps commented Mar 26, 2019

Just checking if the fix is available in a newer build?

@rohanKanojia
Copy link
Member

rohanKanojia commented Mar 26, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants