kubernetes / kubernetes

Production-Grade Container Scheduling and Management
https://kubernetes.io
Apache License 2.0
111.39k stars 39.74k forks source link

Allow go k8s client to accept KUBECONFIG env readily #127891

Open ajinkyak423 opened 1 month ago

ajinkyak423 commented 1 month ago

What would you like to be added?

The kubeconfig environment variable typically uses a colon-separated format for specifying multiple paths. However, the Kubernetes Go client library currently only supports a single path. This inconsistency can be confusing for developers. To simplify things, let's make the Go client accept the colon-separated format for kubeconfig paths, making it consistent with the standard environment variable format.

KUBECONFIG env doc: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#set-the-kubeconfig-environment-variable

Following is the simple example to explain the issue: image

Why is this needed?

Currently, users have to do extra work to get the config-path value from KUBECONFIG env. The Go client library expects a single value, but the system environment variables for KUBECONFIG are separated by colons. Let's make the Go client accept the KUBECONFIG env value readily. This would make it consistent with how the system handles these variables and make things easier for developers

neolit123 commented 1 month ago

/sig api-machinery

ajinkyak423 commented 1 month ago

/assign @ajinkyak423

Jefftree commented 1 month ago

/cc @seans3 /triage accepted