fix: when applying Kubernetes manifests, resources should be updated …#1020
Merged
fix: when applying Kubernetes manifests, resources should be updated …#1020
Conversation
…when they already exist (409 conflict) rather than skipped.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request enhances the Kubernetes client to update resources when they already exist (409 conflict) instead of skipping creation. It introduces a new _update_single_manifest method that patches existing resources and modifies the exception handling in _apply_single_manifest to call this update method.
Changes:
- Added
_update_single_manifestmethod to handle resource updates via patch operations for all supported Kubernetes resource types - Modified
_apply_single_manifestto call_update_single_manifeston 409 conflicts instead of just logging and skipping - Updated tests to verify that update method is called and resources are patched correctly
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| modules/python/clients/kubernetes_client.py | Added new _update_single_manifest method (170+ lines) with patch operations for all resource types; updated 409 exception handling in _apply_single_manifest to trigger updates |
| modules/python/tests/clients/test_kubernetes_client.py | Enhanced two existing tests to verify _update_single_manifest is called and patch methods are invoked correctly when resources already exist |
vittoriasalim
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 how Kubernetes manifests are applied in the client by adding support for updating resources when they already exist, rather than skipping their creation. It introduces a new
_update_single_manifestmethod and updates both the implementation and associated tests to ensure resources are patched (updated) when a 409 conflict occurs.Implementation changes:
_update_single_manifestmethod tokubernetes_client.py, which uses the appropriate Kubernetes API to patch resources when they already exist._apply_single_manifestto call_update_single_manifeston 409 (resource already exists) instead of skipping creation, and updated the log message to reflect the update action.Test improvements:
test_apply_single_manifest_resource_already_existsto check that_update_single_manifestis called and that the log message indicates an update rather than a skipped creation [1] [2].test_apply_manifest_from_file_api_exception_409_conflictto verify that the patch method is called for updates and that the correct log message is produced.…when they already exist (409 conflict) rather than skipped.