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

Exception is buried which makes usage very hard #3818

Closed
mariusstaicu opened this issue Feb 8, 2022 · 1 comment · Fixed by #3834
Closed

Exception is buried which makes usage very hard #3818

mariusstaicu opened this issue Feb 8, 2022 · 1 comment · Fixed by #3834
Assignees
Labels
Milestone

Comments

@mariusstaicu
Copy link

mariusstaicu commented Feb 8, 2022

Describe the bug

Whenever using auto configuration with "EC" algo the underlying http client fails with exception:
JcaPEMKeyConverter is provided by BouncyCastle, an optional dependency. To use support for EC Keys you must explicitly add this dependency to classpath.

However, this exception is buried in HttpClientUtils.java:214:

} catch (Exception e) { KubernetesClientException.launderThrowable(e); }
This causes the users of this library to look for the source of the problem in other places.

Fabric8 Kubernetes Client version

other (please specify in additional context)

Steps to reproduce

  1. on kubernetes-client version 5.12.1
  2. try to configure to a local k3s using auto config - it will be using EC algo
  3. the result is that the client is burying the root cause mentioned before and it will issue a confusing exception like this: Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target which is very confusing, since this is not the cause of the problem

Expected behavior

The main cause of the failure shown in logs should be JcaPEMKeyConverter is provided by BouncyCastle, an optional dependency. To use support for EC Keys you must explicitly add this dependency to classpath. and not Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

This can be done by not burying the initial exception.

Runtime

other (please specify in additional context)

Kubernetes API Server version

1.20.12

Environment

Linux

Fabric8 Kubernetes Client Logs

No response

Additional context

fabric8 kubernetes-client version: 1.15.2
kubernetes cluster: k3s

@shawkins shawkins added this to the 6.0.0 milestone Feb 9, 2022
@shawkins
Copy link
Contributor

shawkins commented Feb 9, 2022

This was not an intentional swallowing of that exception, it should be throwing instead. After #3654 we'll add the appropriate throws.

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Feb 10, 2022
@shawkins shawkins linked a pull request Feb 10, 2022 that will close this issue
11 tasks
@manusa manusa added the bug label Feb 14, 2022
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Feb 16, 2022
manusa pushed a commit to manusa/kubernetes-client that referenced this issue Apr 5, 2022
(cherry picked from commit f792c92)
Signed-off-by: Marc Nuri <marc@marcnuri.com>
manusa pushed a commit that referenced this issue Apr 5, 2022
(cherry picked from commit f792c92)
Signed-off-by: Marc Nuri <marc@marcnuri.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants