Skip to content

Instantly share code, notes, and snippets.

@ashi009
Last active August 14, 2019 11:27
Show Gist options
  • Save ashi009/940bcdab2c6e9d3a4858e62e7df3f53c to your computer and use it in GitHub Desktop.
Save ashi009/940bcdab2c6e9d3a4858e62e7df3f53c to your computer and use it in GitHub Desktop.
Strip metadata from k8s resources json (as a workaround for https://github.com/kubernetes/kubernetes/issues/24855)
#!/bin/bash
jq '
del(.items[]?.status) |
del(.items[]?.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration") |
del(.items[]?.metadata.annotations."ingress.kubernetes.io/backends") |
del(.items[]?.metadata.annotations."ingress.kubernetes.io/https-forwarding-rule") |
del(.items[]?.metadata.annotations."ingress.kubernetes.io/https-target-proxy") |
del(.items[]?.metadata.annotations."ingress.kubernetes.io/url-map") |
del(.items[]?.metadata.creationTimestamp) |
del(.items[]?.metadata.generation) |
del(.items[]?.metadata.resourceVersion) |
del(.items[]?.metadata.selfLink) |
del(.items[]?.metadata.uid) |
del(.metadata.creationTimestamp) |
del(.metadata.generation) |
del(.metadata.resourceVersion) |
del(.metadata.selfLink) |
del(.metadata.uid)
' $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment