Merge pull request #163 from goddenrich/kube-configs-with-no-contexts-clusters-users
Merging configs with missing fields
This commit is contained in:
commit
9f73cc68c1
@ -586,7 +586,7 @@ class KubeConfigMerger:
|
||||
self.config_merged = ConfigNode(path, config_merged, path)
|
||||
|
||||
for item in ('clusters', 'contexts', 'users'):
|
||||
self._merge(item, config[item], path)
|
||||
self._merge(item, config.get(item, {}), path)
|
||||
self.config_files[path] = config
|
||||
|
||||
def _merge(self, item, add_cfg, path):
|
||||
|
||||
@ -1355,13 +1355,17 @@ class TestKubeConfigMerger(BaseTestCase):
|
||||
},
|
||||
]
|
||||
}
|
||||
TEST_KUBE_CONFIG_PART4 = {
|
||||
"current-context": "no_user",
|
||||
}
|
||||
|
||||
def _create_multi_config(self):
|
||||
files = []
|
||||
for part in (
|
||||
self.TEST_KUBE_CONFIG_PART1,
|
||||
self.TEST_KUBE_CONFIG_PART2,
|
||||
self.TEST_KUBE_CONFIG_PART3):
|
||||
self.TEST_KUBE_CONFIG_PART3,
|
||||
self.TEST_KUBE_CONFIG_PART4):
|
||||
files.append(self._create_temp_file(yaml.safe_dump(part)))
|
||||
return ENV_KUBECONFIG_PATH_SEPARATOR.join(files)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user