yq

15 commands

15 shown

Read YAML field Extract a value from a YAML file yq '.spec.replicas' deployment.yaml #yq Set YAML field In-place update of a YAML field yq -i '.spec.replicas = 3' deployment.yaml #yq Convert YAML to JSON Output YAML as JSON for jq processing yq -o=json deployment.yaml #yq Merge YAML files Deep-merge a base YAML with an override file yq '. *= load("override.yaml")' base.yaml #yq Multi-document YAML to array Split a multi-document YAML into a JSON array yq -s '.' multi.yaml | yq -o=json #yq Read a field value Extract a single field from YAML yq '.spec.replicas' deployment.yaml #yq Set a field value in-place Modify YAML file in-place with yq v4 yq -i '.spec.replicas = 3' deployment.yaml #yq Add array element Append an env var to the first container yq -i '.spec.containers[0].env += {"name":"DEBUG","value":"true"}' deployment.yaml #yq Delete a key Remove a specific annotation from YAML yq -i 'del(.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration")' resource.yaml #yq Merge two YAML files Deep-merge two YAML documents yq eval-all 'select(fileIndex==0) * select(fileIndex==1)' base.yaml override.yaml #yq Convert YAML to JSON Output YAML document as JSON yq -o=json '.' config.yaml #yq Convert JSON to YAML Pretty-print JSON as YAML cat config.json | yq -P '.' #yq Filter array items by condition Select only Running pods from a list yq '.items[] | select(.status.phase == "Running")' pods.yaml #yq#debug Update image tag across manifests Targeted image update for a named container yq -i '(.spec.template.spec.containers[] | select(.name == "app") | .image) = "myapp:v2.0.0"' deployment.yaml #yq#ci Process multiple files at once Extract metadata.name from all YAML files in a directory yq '.metadata.name' manifests/*.yaml #yq
no commands match