This repository was archived by the owner on Oct 3, 2020. It is now read-only.
This repository was archived by the owner on Oct 3, 2020. It is now read-only.
kubeconfig logic requires 'current-context' even when --kubeconfig-contexts are provided #133
Open
Description
$ python3 -m kube_ops_view --kubeconfig-path ~/kubeconfig --kubeconfig-contexts production
INFO:kube_ops_view.main:Listening on :8080..
ERROR:kube_ops_view.update:Failed to update
Traceback (most recent call last):
File "/home/pi/kube-ops-view/kube_ops_view/update.py", line 42, in update_clusters
for cluster in clusters:
File "/home/pi/kube-ops-view/kube_ops_view/cluster_discovery.py", line 139, in get_clusters
contexts, current_context = kubernetes.config.list_kube_config_contexts(config_file)
File "/usr/local/lib/python3.4/dist-packages/kubernetes/config/kube_config.py", line 279, in list_kube_config_contexts
loader = _get_kube_config_loader_for_yaml_file(config_file)
File "/usr/local/lib/python3.4/dist-packages/kubernetes/config/kube_config.py", line 271, in _get_kube_config_loader_for_yaml_file
**kwargs)
File "/usr/local/lib/python3.4/dist-packages/kubernetes/config/kube_config.py", line 108, in __init__
self.set_active_context(active_context)
File "/usr/local/lib/python3.4/dist-packages/kubernetes/config/kube_config.py", line 120, in set_active_context
context_name = self._config['current-context']
File "/usr/local/lib/python3.4/dist-packages/kubernetes/config/kube_config.py", line 242, in __getitem__
% (key, self.name))
kubernetes.config.config_exception.ConfigException: Invalid kube-config file. Expected key current-context in kube-config
I think this is too strict: given that I am providing the name of the context to use, there is really no point in requiring a "current" context.