diff --git a/cmd/config/internal/commands/cmdcreatesetter.go b/cmd/config/internal/commands/cmdcreatesetter.go index 78ebb2d27..010606c8e 100644 --- a/cmd/config/internal/commands/cmdcreatesetter.go +++ b/cmd/config/internal/commands/cmdcreatesetter.go @@ -38,7 +38,6 @@ func NewCreateSetterRunner(parent string) *CreateSetterRunner { "create a partial setter for only part of the field value.") fixDocs(parent, set) set.MarkFlagRequired("type") - set.MarkFlagRequired("field") r.Command = set return r } diff --git a/kyaml/setters/addyaml.go b/kyaml/setters/addyaml.go index 0a70fa84a..18fb7918d 100644 --- a/kyaml/setters/addyaml.go +++ b/kyaml/setters/addyaml.go @@ -55,8 +55,9 @@ func (m *customFieldSetter) Filter(object *yaml.RNode) (*yaml.RNode, error) { return node.PipeE(m) }) case yaml.ScalarNode: - // only create the setter for fields with the given name - if m.currentFieldName != m.Field { + // if filed is empty, create the setter for all fields with given value + // else only create the setter for given field and value combination, with given name + if m.Field != "" && m.currentFieldName != m.Field { return object, nil } if err := m.create(object); err != nil {