Modify firewall rules names to make them shorter.

This commit is contained in:
Maciej Borsz 2019-06-05 13:10:19 +02:00
parent 9f85c5c4b5
commit 31f18c0a6d
2 changed files with 10 additions and 10 deletions

View File

@ -3503,12 +3503,12 @@ function test-setup() {
--target-tags "${NODE_TAG}" \ --target-tags "${NODE_TAG}" \
--allow tcp:80,tcp:8080 \ --allow tcp:80,tcp:8080 \
--network "${NETWORK}" \ --network "${NETWORK}" \
"${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" 2> /dev/null || true "${NODE_TAG}-http-alt" 2> /dev/null || true
# As there is no simple way to wait longer for this operation we need to manually # As there is no simple way to wait longer for this operation we need to manually
# wait some additional time (20 minutes altogether). # wait some additional time (20 minutes altogether).
while ! gcloud compute firewall-rules describe --project "${NETWORK_PROJECT}" "${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" 2> /dev/null; do while ! gcloud compute firewall-rules describe --project "${NETWORK_PROJECT}" "${NODE_TAG}-http-alt" 2> /dev/null; do
if [[ $(($start + 1200)) -lt `date +%s` ]]; then if [[ $(($start + 1200)) -lt `date +%s` ]]; then
echo -e "${color_red}Failed to create firewall ${NODE_TAG}-${INSTANCE_PREFIX}-http-alt in ${NETWORK_PROJECT}" >&2 echo -e "${color_red}Failed to create firewall ${NODE_TAG}-http-alt in ${NETWORK_PROJECT}" >&2
exit 1 exit 1
fi fi
sleep 5 sleep 5
@ -3522,12 +3522,12 @@ function test-setup() {
--target-tags "${NODE_TAG}" \ --target-tags "${NODE_TAG}" \
--allow tcp:30000-32767,udp:30000-32767 \ --allow tcp:30000-32767,udp:30000-32767 \
--network "${NETWORK}" \ --network "${NETWORK}" \
"${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" 2> /dev/null || true "${NODE_TAG}-nodeports" 2> /dev/null || true
# As there is no simple way to wait longer for this operation we need to manually # As there is no simple way to wait longer for this operation we need to manually
# wait some additional time (20 minutes altogether). # wait some additional time (20 minutes altogether).
while ! gcloud compute firewall-rules describe --project "${NETWORK_PROJECT}" "${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" 2> /dev/null; do while ! gcloud compute firewall-rules describe --project "${NETWORK_PROJECT}" "${NODE_TAG}-nodeports" 2> /dev/null; do
if [[ $(($start + 1200)) -lt `date +%s` ]]; then if [[ $(($start + 1200)) -lt `date +%s` ]]; then
echo -e "${color_red}Failed to create firewall ${NODE_TAG}-${INSTANCE_PREFIX}-nodeports in ${PROJECT}" >&2 echo -e "${color_red}Failed to create firewall ${NODE_TAG}-nodeports in ${PROJECT}" >&2
exit 1 exit 1
fi fi
sleep 5 sleep 5
@ -3540,8 +3540,8 @@ function test-teardown() {
detect-project detect-project
echo "Shutting down test cluster in background." echo "Shutting down test cluster in background."
delete-firewall-rules \ delete-firewall-rules \
"${NODE_TAG}-${INSTANCE_PREFIX}-http-alt" \ "${NODE_TAG}-http-alt" \
"${NODE_TAG}-${INSTANCE_PREFIX}-nodeports" "${NODE_TAG}-nodeports"
if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then if [[ ${MULTIZONE:-} == "true" && -n ${E2E_ZONES:-} ]]; then
local zones=( ${E2E_ZONES} ) local zones=( ${E2E_ZONES} )
# tear them down in reverse order, finally tearing down the master too. # tear them down in reverse order, finally tearing down the master too.

View File

@ -217,7 +217,7 @@ func GetE2eFirewalls(masterName, masterTag, nodeTag, network, clusterIPRange str
}, },
}) })
fws = append(fws, &compute.Firewall{ fws = append(fws, &compute.Firewall{
Name: nodeTag + "-" + instancePrefix + "-http-alt", Name: nodeTag + "-http-alt",
SourceRanges: []string{"0.0.0.0/0"}, SourceRanges: []string{"0.0.0.0/0"},
TargetTags: []string{nodeTag}, TargetTags: []string{nodeTag},
Allowed: []*compute.FirewallAllowed{ Allowed: []*compute.FirewallAllowed{
@ -232,7 +232,7 @@ func GetE2eFirewalls(masterName, masterTag, nodeTag, network, clusterIPRange str
}, },
}) })
fws = append(fws, &compute.Firewall{ fws = append(fws, &compute.Firewall{
Name: nodeTag + "-" + instancePrefix + "-nodeports", Name: nodeTag + "-nodeports",
SourceRanges: []string{"0.0.0.0/0"}, SourceRanges: []string{"0.0.0.0/0"},
TargetTags: []string{nodeTag}, TargetTags: []string{nodeTag},
Allowed: []*compute.FirewallAllowed{ Allowed: []*compute.FirewallAllowed{