Skip to content

ClusterHelper.isOpenShift thinks k8 cluster with expired token is OpenShift cluster #216

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

Closed
adietish opened this issue Apr 5, 2024 · 0 comments · Fixed by #217
Closed
Assignees
Milestone

Comments

@adietish
Copy link
Contributor

adietish commented Apr 5, 2024

Current implementation of ClusterHelper.isOpenShift thinks that a kubernetes cluster, where the token is expired, is an OpenShift cluster.

    public static boolean isOpenShift(KubernetesClient client) {
        OpenShiftClient osClient = client.adapt(OpenShiftClient.class);
        try {
            return osClient.isSupported();
        } catch (KubernetesClientException e) {
            return e.getCode() == HttpURLConnection.HTTP_UNAUTHORIZED;
        }
    }

An expired token causes a KubernetesClientException with error code 401 and thus erroneously returns true.

This prevents OIDC tokens from being refreshed in redhat-developer/intellij-kubernetes#726 as

@adietish adietish self-assigned this Apr 5, 2024
adietish added a commit to adietish/intellij-common that referenced this issue Apr 5, 2024
adietish added a commit to adietish/intellij-common that referenced this issue Apr 5, 2024
@adietish adietish moved this to 👀 In review in IDE Cloudaptors Apr 5, 2024
@adietish adietish changed the title ClusterHelper.isOpenShift thinks k8 clusters with expired token is OpenShift cluster ClusterHelper.isOpenShift thinks k8 cluster with expired token is OpenShift cluster Apr 9, 2024
adietish added a commit that referenced this issue Apr 9, 2024
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in IDE Cloudaptors Apr 9, 2024
@adietish adietish added this to the 1.9.4 milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant