Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Merging configs with missing fields #163

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/kube_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def load_config(self, path):
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):
Expand Down
6 changes: 5 additions & 1 deletion config/kube_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,13 +1353,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)

Expand Down