mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Merge pull request #2853 from phanimarupaka/WarnIfNoSubstMatch
Print message if subst doesn't match any field value
This commit is contained in:
@@ -78,7 +78,8 @@ func (c SetterCreator) Create(openAPIPath, resourcesPath string) error {
|
|||||||
Outputs: []kio.Writer{inout},
|
Outputs: []kio.Writer{inout},
|
||||||
}.Execute()
|
}.Execute()
|
||||||
if a.Count == 0 {
|
if a.Count == 0 {
|
||||||
fmt.Printf("setter %s doesn't match any field in resources, but creating setter definition\n", c.Name)
|
fmt.Printf("setter %s doesn't match any field in resource configs, "+
|
||||||
|
"but creating setter definition\n", c.Name)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -123,18 +123,25 @@ func (c SubstitutionCreator) Create(openAPIPath, resourcesPath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the resources with the setter reference
|
a := &setters2.Add{
|
||||||
|
FieldName: c.FieldName,
|
||||||
|
FieldValue: c.FieldValue,
|
||||||
|
Ref: fieldmeta.DefinitionsPrefix + fieldmeta.SubstitutionDefinitionPrefix + c.Name,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the resources with the substitution reference
|
||||||
inout := &kio.LocalPackageReadWriter{PackagePath: resourcesPath}
|
inout := &kio.LocalPackageReadWriter{PackagePath: resourcesPath}
|
||||||
return kio.Pipeline{
|
err = kio.Pipeline{
|
||||||
Inputs: []kio.Reader{inout},
|
Inputs: []kio.Reader{inout},
|
||||||
Filters: []kio.Filter{kio.FilterAll(
|
Filters: []kio.Filter{kio.FilterAll(a)},
|
||||||
&setters2.Add{
|
|
||||||
FieldName: c.FieldName,
|
|
||||||
FieldValue: c.FieldValue,
|
|
||||||
Ref: fieldmeta.DefinitionsPrefix + fieldmeta.SubstitutionDefinitionPrefix + c.Name,
|
|
||||||
})},
|
|
||||||
Outputs: []kio.Writer{inout},
|
Outputs: []kio.Writer{inout},
|
||||||
}.Execute()
|
}.Execute()
|
||||||
|
|
||||||
|
if a.Count == 0 {
|
||||||
|
fmt.Printf("substitution %s doesn't match any field value in resource configs, "+
|
||||||
|
"but creating substitution definition\n", c.Name)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// createMarkersAndRefs takes the input pattern, creates setter/substitution markers
|
// createMarkersAndRefs takes the input pattern, creates setter/substitution markers
|
||||||
|
|||||||
Reference in New Issue
Block a user