mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 02:20:53 +00:00
Break the dep between fs and pgmconfig.
This commit is contained in:
@@ -64,7 +64,7 @@ const metaNamespace = "metadata/namespace"
|
||||
// that don't exist in a namespace (the Namespace
|
||||
// object itself doesn't live in a namespace).
|
||||
func (p *NamespaceTransformerPlugin) applicableFieldSpecs(id resid.ResId) []config.FieldSpec {
|
||||
res := []config.FieldSpec{}
|
||||
var res []config.FieldSpec
|
||||
for _, fs := range p.FieldSpecs {
|
||||
if id.IsSelected(&fs.Gvk) && (fs.Path != metaNamespace || (fs.Path == metaNamespace && id.IsNamespaceableKind())) {
|
||||
res = append(res, fs)
|
||||
@@ -73,14 +73,14 @@ func (p *NamespaceTransformerPlugin) applicableFieldSpecs(id resid.ResId) []conf
|
||||
return res
|
||||
}
|
||||
|
||||
func (o *NamespaceTransformerPlugin) changeNamespace(
|
||||
func (p *NamespaceTransformerPlugin) changeNamespace(
|
||||
referrer *resource.Resource) func(in interface{}) (interface{}, error) {
|
||||
return func(in interface{}) (interface{}, error) {
|
||||
switch in.(type) {
|
||||
case string:
|
||||
// will happen when the metadata/namespace
|
||||
// value is replaced
|
||||
return o.Namespace, nil
|
||||
return p.Namespace, nil
|
||||
case []interface{}:
|
||||
l, _ := in.([]interface{})
|
||||
for idx, item := range l {
|
||||
@@ -102,7 +102,7 @@ func (o *NamespaceTransformerPlugin) changeNamespace(
|
||||
if name != "default" {
|
||||
continue
|
||||
}
|
||||
inMap["namespace"] = o.Namespace
|
||||
inMap["namespace"] = p.Namespace
|
||||
l[idx] = inMap
|
||||
default:
|
||||
// nothing to do for right now
|
||||
@@ -115,7 +115,7 @@ func (o *NamespaceTransformerPlugin) changeNamespace(
|
||||
// object
|
||||
inMap := in.(map[string]interface{})
|
||||
if len(inMap) == 0 {
|
||||
return o.Namespace, nil
|
||||
return p.Namespace, nil
|
||||
} else {
|
||||
return in, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user