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

Allow people to use KUBECONFIG env var and multiple config files #4816

Open
adietish opened this issue Feb 7, 2025 · 1 comment
Open

Allow people to use KUBECONFIG env var and multiple config files #4816

adietish opened this issue Feb 7, 2025 · 1 comment
Assignees
Labels
kind/enhancement New feature or request

Comments

@adietish
Copy link
Contributor

adietish commented Feb 7, 2025

Steps:

  1. ASSERT: have several kube config files and KUBECONFIG env var pointing to it.
    example:
    ~/.bash/.bashrc
export KUBECONFIG=${HOME}/.kube/config:${HOME}/.kube/minikube.yaml:${HOME}/.kube/sandbox.yaml

~/.kube/config

apiVersion: v1
current-context: rh-sandbox
kind: Config
preferences: {}

~/.kube/minikube.yaml

apiVersion: v1
clusters:
- cluster:
    certificate-authority: /Users/adietish/.minikube/ca.crt
    extensions:
    - extension:
        provider: minikube.sigs.k8s.io
        version: v1.34.0
      name: cluster_info
    server: https://127.0.0.1:41825
  name: minikube
contexts:
- context:
    cluster: minikube
    extensions:
    - extension:
        last-update: Wed, 08 Jan 2025 15:05:54 CET
        provider: minikube.sigs.k8s.io
        version: v1.34.0
      name: context_info
    namespace: kube-node-lease
    user: minikube
  name: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /Users/adietish/.minikube/profiles/minikube/client.crt
    client-key: /Users/adietish/.minikube/profiles/minikube/client.key

~/.kube/sandbox.yaml

apiVersion: v1
clusters:
- cluster:
    server: https://api.XXXX.openshiftapps.com:6443
  name: rh-sandbox
contexts:
- context:
    cluster: rh-sandbox
    namespace: adietish-dev
    user: adietish/rh-sandbox
  name: rh-sandbox
current-context: ""
kind: Config
preferences: {}
users:
- name: adietish/rh-sandbox
  user:
    token: sha256~XXXXXXXXXXXXXXXXXXXEMhxfNi614txI
  1. EXEC: launch extension

Result:
You get told that multiple config files are not supported and prompted to select one.
Image

Expected result:
The extension should support multiple config files if they're listed in KUBECONFIG. kubectl, oc and odo support it.
The major gotcha we faced in intellij-openshift-connector was oc login adding all contexts to the first file. See redhat-developer/intellij-openshift-connector#966

@vrubezhny vrubezhny self-assigned this Feb 11, 2025
@sbouchet
Copy link

see also #1579

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: 📝 In Progress
Development

No branches or pull requests

3 participants