diff --git a/cmd/e2e-test/ilb_test.go b/cmd/e2e-test/ilb_test.go index 6920a86045..c350e9e7bd 100644 --- a/cmd/e2e-test/ilb_test.go +++ b/cmd/e2e-test/ilb_test.go @@ -118,7 +118,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) @@ -263,7 +263,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) @@ -404,7 +404,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) @@ -599,7 +599,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/pkg/fuzz/gcp.go b/pkg/fuzz/gcp.go index 2de55c57d3..c119430a66 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 } @@ -398,6 +399,7 @@ func GCLBForVIP(ctx context.Context, c cloud.Cloud, params *GCLBForVIPParams) (* if err := RegionalGCLBForVIP(ctx, c, gclb, params); err != nil { return nil, err } + return gclb, nil } allGFRs, err := c.GlobalForwardingRules().List(ctx, filter.None) @@ -628,7 +630,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 +637,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 }