diff --git a/cmd/e2e-test/ilb_test.go b/cmd/e2e-test/ilb_test.go index ab6bc6aa43..1dcc1b4e7e 100644 --- a/cmd/e2e-test/ilb_test.go +++ b/cmd/e2e-test/ilb_test.go @@ -119,7 +119,7 @@ func TestILB(t *testing.T) { t.Fatalf("got %v, want RFC1918 address, ing: %v", vip, ing) } - params := &fuzz.GCLBForVIPParams{VIP: vip, Validators: fuzz.FeatureValidators(features.All), Region: Framework.Region} + params := &fuzz.GCLBForVIPParams{VIP: vip, Validators: fuzz.FeatureValidators(features.All), Region: Framework.Region, Network: Framework.Network} gclb, err := fuzz.GCLBForVIP(context.Background(), Framework.Cloud, params) if err != nil { t.Fatalf("Error getting GCP resources for LB with IP = %q: %v", vip, err) @@ -265,7 +265,7 @@ func TestILBHttps(t *testing.T) { t.Fatalf("got %v, want RFC1918 address, ing: %v", vip, ing) } - params := &fuzz.GCLBForVIPParams{VIP: vip, Region: Framework.Region, Validators: fuzz.FeatureValidators(features.All)} + params := &fuzz.GCLBForVIPParams{VIP: vip, Region: Framework.Region, Network: Framework.Network, Validators: fuzz.FeatureValidators(features.All)} gclb, err := fuzz.GCLBForVIP(context.Background(), Framework.Cloud, params) if err != nil { t.Fatalf("Error getting GCP resources for LB with IP = %q: %v", vip, err) @@ -407,7 +407,7 @@ func TestILBUpdate(t *testing.T) { t.Fatalf("got %v, want RFC1918 address, ing: %v", vip, ing) } - params := &fuzz.GCLBForVIPParams{VIP: vip, Region: Framework.Region, Validators: fuzz.FeatureValidators(features.All)} + params := &fuzz.GCLBForVIPParams{VIP: vip, Region: Framework.Region, Network: Framework.Network, Validators: fuzz.FeatureValidators(features.All)} gclb, err := fuzz.GCLBForVIP(context.Background(), Framework.Cloud, params) if err != nil { t.Fatalf("Error getting GCP resources for LB with IP = %q: %v", vip, err) @@ -604,7 +604,7 @@ func TestILBShared(t *testing.T) { t.Fatalf("got %v, want RFC1918 address, ing: %v", vip, ing) } - params := &fuzz.GCLBForVIPParams{VIP: vip, Region: Framework.Region, Validators: fuzz.FeatureValidators(features.All)} + params := &fuzz.GCLBForVIPParams{VIP: vip, Region: Framework.Region, Network: Framework.Network, Validators: fuzz.FeatureValidators(features.All)} gclb, err = fuzz.GCLBForVIP(context.Background(), Framework.Cloud, params) if err != nil { t.Fatalf("Error getting GCP resources for LB with IP = %q: %v", vip, err) diff --git a/cmd/e2e-test/run.sh b/cmd/e2e-test/run.sh index 98f682c1cb..6aed03030f 100755 --- a/cmd/e2e-test/run.sh +++ b/cmd/e2e-test/run.sh @@ -72,7 +72,7 @@ for ATTEMPT in $(seq 60); do sleep 1 done -NETWORK = NETWORK_INFO | sed 's+projects/.*/networks/++' +NETWORK=$(echo ${NETWORK_INFO} | sed 's+projects/.*/networks/++') if [[ -z "${NETWORK}" ]]; then echo "Error: could not parse network from network info" diff --git a/pkg/fuzz/gcp.go b/pkg/fuzz/gcp.go index 2de55c57d3..6b0bcc4c92 100644 --- a/pkg/fuzz/gcp.go +++ b/pkg/fuzz/gcp.go @@ -387,6 +387,7 @@ func hasBetaResource(resourceType string, validators []FeatureValidator) bool { type GCLBForVIPParams struct { VIP string Region string + Network string Validators []FeatureValidator } @@ -395,9 +396,8 @@ func GCLBForVIP(ctx context.Context, c cloud.Cloud, params *GCLBForVIPParams) (* gclb := NewGCLB(params.VIP) if params.Region != "" { - if err := RegionalGCLBForVIP(ctx, c, gclb, params); err != nil { - return nil, err - } + err := RegionalGCLBForVIP(ctx, c, gclb, params) + return gclb, err } allGFRs, err := c.GlobalForwardingRules().List(ctx, filter.None) @@ -628,7 +628,6 @@ func GCLBForVIP(ctx context.Context, c cloud.Cloud, params *GCLBForVIPParams) (* // GCLBForVIP retrieves all of the resources associated with the GCLB for a given VIP. func RegionalGCLBForVIP(ctx context.Context, c cloud.Cloud, gclb *GCLB, params *GCLBForVIPParams) error { - allRFRs, err := c.ForwardingRules().List(ctx, params.Region, filter.None) if err != nil { klog.Warningf("Error listing forwarding rules: %v", err) @@ -636,14 +635,14 @@ func RegionalGCLBForVIP(ctx context.Context, c cloud.Cloud, gclb *GCLB, params * } var rfrs []*compute.ForwardingRule - for _, gfr := range allRFRs { - if gfr.IPAddress == params.VIP { - rfrs = append(rfrs, gfr) + for _, rfr := range allRFRs { + if rfr.IPAddress == params.VIP && rfr.Network == params.Network { + rfrs = append(rfrs, rfr) } } if len(rfrs) == 0 { - klog.Warningf("No params.Regional forwarding rules found, can't get all GCLB resources") + klog.Warningf("No regional forwarding rules found, can't get all GCLB resources") return nil }