fix(renaming): namespace renames from nested kustomizations#31
Merged
andyyu2004 merged 4 commits intomasterfrom Feb 7, 2026
Merged
fix(renaming): namespace renames from nested kustomizations#31andyyu2004 merged 4 commits intomasterfrom
andyyu2004 merged 4 commits intomasterfrom
Conversation
…n clientConfig TestValidatingWebhookCombinedNamespaces from validatingwebhook_test.go The namespace transformer should update the clientConfig.service.namespace in ValidatingWebhookConfiguration to match the overlay namespace but it doesn't. Expected: namespace: merge-namespace Actual: namespace: base-namespace
Adds namespace field spec support to transform service namespace references in ValidatingWebhookConfiguration and MutatingWebhookConfiguration when a namespace transformer is applied. Changes: - Created namespace.yaml field spec with paths for: - webhooks[]/clientConfig/service/namespace (ValidatingWebhook & MutatingWebhook) - spec/conversion/webhook/clientConfig/service/namespace (CustomResourceDefinition) - spec/service/namespace (APIService) - Updated Builtin struct to load namespace field specs - Modified NamespaceTransformer to apply namespace field specs This fixes the common case where a kustomization sets a namespace and includes webhook configurations. The webhook's clientConfig.service.namespace is now correctly updated to match the kustomization's namespace. Verified working with simple test case where namespace is set directly. Note: The combined test case (validating-webhook-combined) still fails. This appears to be related to how resources are merged from nested kustomizations and may require additional investigation into the interaction between NamespaceTransformer and RenameTransformer. Related issue: Namespace transformer should update ValidatingWebhookConfiguration clientConfig.service.namespace field when overlay sets different namespace.
This reverts commit 28f4f4b.
When a nested kustomization changes a resource's namespace, those renames now propagate upward to update references in the parent's resources. This fixes the bug where webhooks wouldn't be updated when services were moved to different namespaces in nested overlays. The fix only propagates namespace-only renames (not name changes from namePrefix/nameSuffix) to avoid cross-tree pollution where renames from one subtree incorrectly affect resources from sibling subtrees. Fixes validating-webhook-combined test. All 234 tests pass.
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.
No description provided.