Skip to content

How to assign (update) a value as a list (array) or a dict #1236

Answered by mikefarah
juanpons asked this question in Q&A
Discussion options

You must be logged in to vote

What you need to do is append to the array. Putting everything in double quotes will set it as a string.

I'm not at a machine with yq installed, but it should look something like:

yq -i   ' .ingress.hosts += {"host": chart.domain.com, "paths": []}'

Note that quotes are required around the string key name (as you can use an expression for the key, just as you do for the value).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@juanpons
Comment options

Answer selected by juanpons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants