Skip to content

Instantly share code, notes, and snippets.

@slok
Created March 27, 2021 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slok/f34cdda35f2a8de9b180c03a32748b6b to your computer and use it in GitHub Desktop.
Save slok/f34cdda35f2a8de9b180c03a32748b6b to your computer and use it in GitHub Desktop.
yq Kubernetes tricks

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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment