I have defined an object with a few attributes in my values.yaml
file:
serverOptions:
defaultUrl:
p1: abc
p2: def
cpu_request:
p1: abc
p2: def
mem_request:
p1: abc
p2: def
I am saving these data to a server_options
json file in configmap.yaml
using this code:
data:
server_options.json: |
{{ toJson .Values.serverOptions }}
It works but the initial "list" of attributes gets alphabetically ordered. This is the file's content
{"cpu_request":{"p1":"abc","p2":"def"},"defaultUrl":{"p1":"abc","p2":"def"},"mem_request":{"p1":"abc","p2":"def"}}
Is there a way to keep the original ordering?
Json dictionaries aren't ordered, so no that's not possible. They may be alphabetically ordered when printed but that's only for readability.