use of io.fabric8.kubernetes.client.VersionInfo in project jbosstools-openshift by jbosstools.
the class ClusterHelper method getClusterInfo.
public static ClusterInfo getClusterInfo(KubernetesClient client) throws KubernetesClientException {
if (client instanceof OpenShiftClient || client.isAdaptable(OpenShiftClient.class)) {
VersionInfo oClientVersionInfo;
VersionInfo kClientVersionInfo;
if (client instanceof OpenShiftClient) {
oClientVersionInfo = ((OpenShiftClient) client).getVersion();
kClientVersionInfo = new DefaultKubernetesClient(client.getConfiguration()).getVersion();
} else {
oClientVersionInfo = client.adapt(OpenShiftClient.class).getVersion();
kClientVersionInfo = client.getVersion();
}
return new ClusterInfo(kClientVersionInfo != null ? kClientVersionInfo.getGitVersion() : "", true, oClientVersionInfo != null && oClientVersionInfo.getMajor() != null ? assemble(oClientVersionInfo.getMajor(), oClientVersionInfo.getMinor()) : "");
}
VersionInfo kClientVersionInfo = client.getVersion();
return new ClusterInfo(kClientVersionInfo != null ? kClientVersionInfo.getGitVersion() : "", false, "");
}
Aggregations