vmware-tanzu / k-bench

Workload Benchmark for Kubernetes
Other
391 stars 56 forks source link

Use KUBECONFIG environment variable if it exists #27

Closed necatican closed 2 years ago

necatican commented 3 years ago

What would you like to be added: I want K-bench to recognize the KUBECONFIG environment variable that I set.

Why is this needed: The k-bench README tells the use to use kubectl get nodes to verify the cluster they are currently operating on. While this is a good way to check, it can be misleading due to not handling the KUBECONFIG variable in the code.

Quoting from Kubernetes docs:

If the KUBECONFIG environment variable doesn't exist, kubectl uses the default kubeconfig file, $HOME/.kube/config.

If the KUBECONFIG environment variable does exist, kubectl uses an effective configuration that is the result of merging the files listed in the KUBECONFIG environment variable.

This small change will reduce the chances of running the tests on the wrong cluster while not introducing breaking changes.