Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update of containerinfra cluster template's labels #1455

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions openstack/containerinfra_shared_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ func expandContainerInfraV1LabelsString(v map[string]interface{}) (string, error
}
formattedLabels = strings.Join([]string{
formattedLabels,
fmt.Sprintf("%s=%s", key, labelValue),
fmt.Sprintf("'%s':'%s'", key, labelValue),
}, ",")
}
formattedLabels = strings.Trim(formattedLabels, ",")

return formattedLabels, nil
return fmt.Sprintf("{%s}", formattedLabels), nil
}

func containerInfraV1GetLabelsMerged(labelsAdded map[string]string, labelsSkipped map[string]string, labelsOverridden map[string]string, labels map[string]string, resourceDataLabels map[string]string) map[string]string {
Expand Down
4 changes: 2 additions & 2 deletions openstack/containerinfra_shared_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func TestExpandContainerInfraV1LabelsString(t *testing.T) {
"bar": "baz",
}

expectedLabels1 := "foo=bar,bar=baz"
expectedLabels2 := "bar=baz,foo=bar"
expectedLabels1 := "{'foo':'bar','bar':'baz'}"
expectedLabels2 := "{'bar':'baz','foo':'bar'}"

actualLabels, err := expandContainerInfraV1LabelsString(labels)
assert.Equal(t, err, nil)
Expand Down