Reputation: 1269
i have map data in my values.yaml
values.yaml
shapes:
"FIRST SHAPE": "square"
"SECOND SHAPE": "circle"
"THIRD SHAPE": "triangle"
i need to convert this as json in my config-map. Also i need to add additional json key value attribute "FOURTH_SHAPE":"rectangle" which will not be available in values.yaml.
I want end json to be
{"FIRST SHAPE": "square","SECOND SHAPE": "circle","THIRD SHAPE": "triangle","FOURTH_SHAPE":"rectangle"}
how do i get this done? i tried toJson function and it doesn't work. Any help appreciated
Upvotes: 1
Views: 3385
Reputation: 20537
Use the toJson function annd one of the merge variants.
{{ merge .Values.shapes (dict "FOURTH_SHAPE" "rectangle") | toJson }}
If you only want to add a single value, you can also use set.
{{ set .Values.shapes "FOURTH_SHAPE" "rectangle" | toJson }}
Upvotes: 2