Kubeconfig module improvement (#1123)

* Add kubeconfig module for managing Kubernetes config files

* Remove unnecessary requirement & Change version

* Move functions to module_utils

* Add unit tests

* Add kubeconfig module for managing Kubernetes config files

* Remove unnecessary requirement & Change version

* Move functions to module_utils

* Add unit tests

* Avoid linter errors

* Improve documentation clarity

* Redact sensitive kubeconfig information

* Imprvoe verbosity

* Move import statement for to_native to avoid linters check failure

* Fix linting error

* Add remove behavior

* Add tests for remove behavior

* Imporve documentation

* Add changelog

---------

Co-authored-by: Bianca Henderson <bianca@redhat.com>
This commit is contained in:
Youssef Ali
2026-05-19 17:10:19 +03:00
committed by GitHub
parent b58b2ca70e
commit 53c6c0ee80
5 changed files with 175 additions and 23 deletions

View File

@@ -53,6 +53,8 @@ def merge_by_name(existing, new):
if name in merged:
if behavior == "keep":
continue
elif behavior == "remove":
del merged[name]
elif behavior == "replace":
merged[name] = item_copy
else:
@@ -73,6 +75,8 @@ def merge_by_name(existing, new):
result[key] = item_copy[key]
merged[name] = result
else:
if behavior == "remove":
continue
merged[name] = item_copy
return list(merged.values())