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

kubernetes versionInfo returns null #1309

Closed
leogps opened this issue Jan 5, 2019 · 4 comments
Closed

kubernetes versionInfo returns null #1309

leogps opened this issue Jan 5, 2019 · 4 comments

Comments

@leogps
Copy link

leogps commented Jan 5, 2019

The below always returns null because the implementation is not constructing the endpoint properly and is failing to complete the HTTP request correctly.
VersionInfo versionInfo = kubernetesClient.getVersion();

In the ClusterOperationsImpl#fetchVersion method, it should be
Builder requestBuilder = (new Builder()).get().url(this.config.getMasterUrl() + "/" + this.versionEndpoint);
The path separator is missing.

Line 43:
https://github.com/fabric8io/kubernetes-client/blob/59e5b9d0f318f4f78f417efaec34050ed8122b8f/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/ClusterOperationsImpl.java

@rohanKanojia
Copy link
Member

rohanKanojia commented Jan 11, 2019

Strange, I tested this but it's working for me both with masterUrl and without masterUrl. Could you please share the Config object which you use to create client?

@candyleer
Copy link
Contributor

candyleer commented Jan 25, 2019

I have the same problem,I found the root cause.
we config the client by Config.fromKubeconfig("") ,in this method,the masterUrl will not ignore if the masterUrl is end with slash,but in default config,the masterUrl will detect slash,that makes the problem occur.

 private static boolean loadFromKubeconfig(Config config, String context, String kubeconfigContents, String kubeconfigPath) {
   ....
      if (currentCluster != null) {
        config.setMasterUrl(currentCluster.getServer());
        config.setNamespace(currentContext.getNamespace());
private static Config autoConfigure(Config config, String context) {
   ...
    if (!config.masterUrl.endsWith("/")) {
      config.masterUrl = config.masterUrl + "/";
    }
    return config;
  }

maybe i can send a pr to fix this?

ERROR is

Caused by: java.net.UnknownHostException: xxxxx.comversion: nodename nor servname provided, or not known
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)

@rohanKanojia
Copy link
Member

@candyleer : Yeah, please create PR and we can discuss over there.

@candyleer
Copy link
Contributor

@rohanKanojia I have create PR very simple ,#1329

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

No branches or pull requests

3 participants