Skip to content

Instantly share code, notes, and snippets.

@joejulian
Created April 16, 2021 22:34
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 joejulian/7dbe5383c32d3b00ff52c1aae174059b to your computer and use it in GitHub Desktop.
Save joejulian/7dbe5383c32d3b00ff52c1aae174059b to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
EXPIRATION="${1:-8h}"
TEMPFILE=$(mktemp)
yq -Y '. | (
select(.kind == "ClusterProvisioner") |
.spec.aws.tags.expiration = "'"${EXPIRATION}"'"),(
select(.kind != "ClusterProvisioner") |
.spec.addons[].addonsList |=
map(
if .name=="traefik" then .values =
({"service": {"annotations": { "service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags" : "owner='"${USER}"',expiration='"${EXPIRATION}"'"}}} | tojson)
else .
end
)
)
' cluster.yaml > "${TEMPFILE}"
mv "${TEMPFILE}" cluster.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment