mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
fix the double quotation problem in ConfigMapGenerator
This commit is contained in:
@@ -212,6 +212,5 @@ func parseLiteralSource(source string) (keyName, value string, err error) {
|
|||||||
if len(items) != 2 {
|
if len(items) != 2 {
|
||||||
return "", "", fmt.Errorf("invalid literal source %v, expected key=value", source)
|
return "", "", fmt.Errorf("invalid literal source %v, expected key=value", source)
|
||||||
}
|
}
|
||||||
|
return items[0], strings.Trim(items[1], "\"'"), nil
|
||||||
return items[0], items[1], nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ func makeLiteralConfigMap(name string) *corev1.ConfigMap {
|
|||||||
Data: map[string]string{
|
Data: map[string]string{
|
||||||
"a": "x",
|
"a": "x",
|
||||||
"b": "y",
|
"b": "y",
|
||||||
|
"c": "Hello World",
|
||||||
|
"d": "true",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,7 +129,7 @@ func TestConstructConfigMap(t *testing.T) {
|
|||||||
input: types.ConfigMapArgs{
|
input: types.ConfigMapArgs{
|
||||||
Name: "literalConfigMap",
|
Name: "literalConfigMap",
|
||||||
DataSources: types.DataSources{
|
DataSources: types.DataSources{
|
||||||
LiteralSources: []string{"a=x", "b=y"},
|
LiteralSources: []string{"a=x", "b=y", "c=\"Hello World\"", "d='true'"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: makeLiteralConfigMap("literalConfigMap"),
|
expected: makeLiteralConfigMap("literalConfigMap"),
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ BAR=baz
|
|||||||
{
|
{
|
||||||
Name: "literalConfigMap",
|
Name: "literalConfigMap",
|
||||||
DataSources: types.DataSources{
|
DataSources: types.DataSources{
|
||||||
LiteralSources: []string{"a=x", "b=y"},
|
LiteralSources: []string{"a=x", "b=y", "c=\"Good Morning\"", "d=\"false\""},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -120,6 +120,8 @@ BAR=baz
|
|||||||
"data": map[string]interface{}{
|
"data": map[string]interface{}{
|
||||||
"a": "x",
|
"a": "x",
|
||||||
"b": "y",
|
"b": "y",
|
||||||
|
"c": "Good Morning",
|
||||||
|
"d": "false",
|
||||||
},
|
},
|
||||||
}).SetBehavior(resource.BehaviorCreate),
|
}).SetBehavior(resource.BehaviorCreate),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user