mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Update Namespace and Name simultaneously (1/2)
- Removed RoleBinding and Webhook specific code in the namespacetransformer. That code was attempting to perform the task of the namereference - Updated namereference transformer configuration to suppport the Webhooks. - Prevent the namereference from wiping out the namespace value if no referral candidate was selected - Added unit tests.
This commit is contained in:
@@ -99,6 +99,15 @@ metadata:
|
||||
name: crd
|
||||
`)
|
||||
|
||||
// Import note: The namespace transformer is in charge of
|
||||
// the metadata.namespace field. The namespace transformer SHOULD
|
||||
// NOT modify neither the "namespace" subfield within the
|
||||
// ClusterRoleBinding.subjects field nor the "namespace"
|
||||
// subfield in the ValidatingWebhookConfiguration.webhooks field.
|
||||
// This is the role of the namereference Transformer to handle
|
||||
// object reference changes (prefix/suffix and namespace).
|
||||
// For use cases involving simultaneous change of name and namespace,
|
||||
// refer to namespaces tests in pkg/target test suites.
|
||||
th.AssertActualEqualsExpected(rm, `
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
@@ -142,10 +151,10 @@ metadata:
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: default
|
||||
namespace: test
|
||||
namespace: system
|
||||
- kind: ServiceAccount
|
||||
name: service-account
|
||||
namespace: test
|
||||
namespace: system
|
||||
- kind: ServiceAccount
|
||||
name: another
|
||||
namespace: random
|
||||
@@ -158,7 +167,7 @@ webhooks:
|
||||
- clientConfig:
|
||||
service:
|
||||
name: svc1
|
||||
namespace: test
|
||||
namespace: system
|
||||
name: example1
|
||||
- clientConfig:
|
||||
service:
|
||||
|
||||
Reference in New Issue
Block a user