Skip to content

Instantly share code, notes, and snippets.

@mesmacosta
Created July 19, 2020 18:30
Show Gist options
  • Select an option

  • Save mesmacosta/8c4d2b661a669abf35450ed9ae7389f4 to your computer and use it in GitHub Desktop.

Select an option

Save mesmacosta/8c4d2b661a669abf35450ed9ae7389f4 to your computer and use it in GitHub Desktop.
set -euo pipefail
source ./scripts/env.sh
function join_by { local IFS="$1"; shift; echo "$*"; }
ALL_CLUSTER_CIDRS=$(gcloud container clusters list --format='value(clusterIpv4Cidr)' | sort | uniq)
ALL_CLUSTER_CIDRS=$(join_by , $(echo "${ALL_CLUSTER_CIDRS}"))
ALL_CLUSTER_NETTAGS=$(gcloud compute instances list --format='value(tags.items.[0])' | sort | uniq)
ALL_CLUSTER_NETTAGS=$(join_by , $(echo "${ALL_CLUSTER_NETTAGS}"))
gcloud compute firewall-rules create istio-multicluster-test-pods \
--allow=tcp,udp,icmp,esp,ah,sctp \
--direction=INGRESS \
--priority=900 \
--source-ranges="${ALL_CLUSTER_CIDRS}" \
--target-tags="${ALL_CLUSTER_NETTAGS}" --quiet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment