fix: enhance manifest handling by validating and expanding YAML docum…#1022
Merged
fix: enhance manifest handling by validating and expanding YAML docum…#1022
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances Kubernetes manifest handling by adding validation and expansion capabilities for kind: List manifests and non-dictionary YAML documents. The changes ensure that only valid manifest dictionaries are processed while expanding nested list structures.
Changes:
- Added a new
_expand_and_validate_manifestsmethod that recursively expandskind: Listmanifests, validates manifest types, and logs warnings for invalid documents - Updated four manifest processing methods (
apply_manifest_from_url,delete_manifest_from_url,apply_manifest_from_file,delete_manifest_from_file) to use the new validation and expansion logic - Added comprehensive unit tests covering valid manifests,
kind: List(including nested lists), non-dict/scalar/empty/None manifests, and invaliditemsfields
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| modules/python/clients/kubernetes_client.py | Added _expand_and_validate_manifests method and integrated it into manifest processing methods to ensure only valid dictionaries are processed and kind: List manifests are properly expanded |
| modules/python/tests/clients/test_kubernetes_client.py | Added 9 comprehensive test cases covering various scenarios for the new manifest validation and expansion functionality |
15b1e93 to
69d57d8
Compare
alyssa1303
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request improves the robustness and correctness of Kubernetes manifest handling by introducing a new method to validate and expand manifest documents, especially those using
kind: Listor containing non-dictionary YAML documents. The update ensures only valid manifest dictionaries are processed, and includes comprehensive tests for these scenarios.Manifest validation and expansion improvements:
_expand_and_validate_manifestsmethod tokubernetes_client.pyto recursively expandkind: Listmanifests and skip invalid or non-dictionary documents, logging appropriate warnings.apply_manifest_from_url,delete_manifest_from_url,apply_manifest_from_file, anddelete_manifest_from_fileto use_expand_and_validate_manifestsbefore applying or deleting manifests, ensuring only valid manifests are processed and allkind: Listitems are handled correctly. [1] [2] [3] [4]Testing enhancements:
test_kubernetes_client.pyto cover various scenarios for_expand_and_validate_manifests, including valid manifests,kind: List(including nested lists), non-dict/scalar/empty/None manifests, and invalid or missingitemsfields. Also added integration tests for manifest application from URLs with these edge cases.…ents