mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +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},
|
||||
}.Execute()
|
||||
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 {
|
||||
return err
|
||||
|
||||
@@ -123,18 +123,25 @@ func (c SubstitutionCreator) Create(openAPIPath, resourcesPath string) error {
|
||||
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}
|
||||
return kio.Pipeline{
|
||||
Inputs: []kio.Reader{inout},
|
||||
Filters: []kio.Filter{kio.FilterAll(
|
||||
&setters2.Add{
|
||||
FieldName: c.FieldName,
|
||||
FieldValue: c.FieldValue,
|
||||
Ref: fieldmeta.DefinitionsPrefix + fieldmeta.SubstitutionDefinitionPrefix + c.Name,
|
||||
})},
|
||||
err = kio.Pipeline{
|
||||
Inputs: []kio.Reader{inout},
|
||||
Filters: []kio.Filter{kio.FilterAll(a)},
|
||||
Outputs: []kio.Writer{inout},
|
||||
}.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
|
||||
|
||||
Reference in New Issue
Block a user