mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 10:30:59 +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:
@@ -191,6 +191,11 @@ func (o *nameReferenceTransformer) getNameAndNsStruct(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if (newname == oldName) && (newnamespace == nil) {
|
||||
// no candidate found.
|
||||
return inMap, nil
|
||||
}
|
||||
|
||||
inMap["name"] = newname
|
||||
if newnamespace != "" {
|
||||
// We don't want value "" to replace value "default" since
|
||||
@@ -212,6 +217,12 @@ func (o *nameReferenceTransformer) getNewNameFunc(
|
||||
oldName, _ := in.(string)
|
||||
return o.getSimpleNameField(oldName, referrer, target,
|
||||
referralCandidates, referralCandidates.Resources())
|
||||
case map[string]interface{}:
|
||||
// Kind: ValidatingWebhookConfiguration
|
||||
// FieldSpec is webhooks/clientConfig/service
|
||||
oldMap, _ := in.(map[string]interface{})
|
||||
return o.getNameAndNsStruct(oldMap, referrer, target,
|
||||
referralCandidates)
|
||||
case []interface{}:
|
||||
l, _ := in.([]interface{})
|
||||
for idx, item := range l {
|
||||
|
||||
Reference in New Issue
Block a user