Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kustomize/commands/edit/add/addmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (o *addMetadataOptions) writeToLabels(m *types.Kustomization, kind kindOfAd
}
continue
}
if err := o.writeToMap(lbl.Pairs, kind); err != nil {
if err := o.writeToMapEntry(lbl.Pairs, k, v, kind); err != nil {
return err
}
m.Labels = append(m.Labels, lbl)
Expand Down
13 changes: 13 additions & 0 deletions kustomize/commands/edit/add/addmetadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,19 @@ func TestAddLabelWithoutSelector(t *testing.T) {
},
},
},
{
name: "add multiple labels without selector",
baseLabels: []types.Label{},
options: addMetadataOptions{
labelsWithoutSelector: true,
metadata: map[string]string{"test1": "a", "test2": "b"},
},
expected: []types.Label{
{
Pairs: map[string]string{"test1": "a", "test2": "b"},
},
},
},
{
name: "overwrite label with same settings",
baseLabels: []types.Label{
Expand Down
Loading