Created
April 16, 2021 22:34
-
-
Save joejulian/7dbe5383c32d3b00ff52c1aae174059b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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