Add Namespace to all yq eval -i '.metadata.namespace |= "argo"' "${FILE}" Add protocol: TCP to the Services that have missing. yq eval -i 'select(.kind == "Service") |= .spec.ports[] |= select(has("protocol") | not) |= .protocol="TCP" ' ${FILE}