Repository navigation
fix: ensure default namespace is used when none is specified for Kube… - #1021
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request changes the Kubernetes client's behavior when applying manifests that lack a namespace specification. Previously, the client would raise a ValueError for namespaced resources without a namespace. Now it defaults to using the "default" namespace instead. The test suite has been comprehensively updated to verify this new defaulting behavior.
Changes:
- Modified
_apply_single_manifestto default to "default" namespace for all resources when no namespace is specified - Updated 10+ unit tests to expect "default" namespace instead of ValueError when namespace is missing
- Removed namespace validation checks that previously raised ValueErrors
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| modules/python/clients/kubernetes_client.py | Updated _apply_single_manifest to default to "default" namespace, removing explicit namespace requirement checks |
| modules/python/tests/clients/test_kubernetes_client.py | Updated tests to verify "default" namespace is used when none is specified, replacing tests that expected ValueError |
Anson Qian (anson627)
force-pushed
the
fix-namespace-check-before-apply
branch
from
February 3, 2026 15:05
cdfda96 to
532d86d
Compare
Alyssa Vu (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 updates the Kubernetes client logic to improve how namespaces are handled when applying manifests. Instead of raising an error when a namespace is missing for namespaced resources, the code now defaults to using the
"default"namespace. Corresponding tests have also been updated to reflect this new behavior, ensuring that resources are created in the"default"namespace if none is specified.Key changes include:
Namespace handling improvements:
_apply_single_manifestinkubernetes_client.pyto default to"default"namespace for namespaced resources if no namespace is provided in the manifest or as a parameter, instead of raising aValueError. [1] [2] [3]Test updates:
test_kubernetes_client.pyto assert that the"default"namespace is used when a namespace is missing, rather than expecting an error. This includes tests for Deployments, StatefulSets, MPIJobs, Services, and ConfigMaps. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Logging and update logic:
"default"as the namespace when none is provided.These changes make the manifest application process more robust and user-friendly by eliminating unnecessary errors and providing a sensible default namespace.