Skip to content

Commit

Permalink
revert regionlhc and targettcpproxies
Browse files Browse the repository at this point in the history
  • Loading branch information
swarren83 authored and Shawn Warren committed Jul 11, 2024
1 parent 76f3b00 commit e6001db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 61 deletions.
61 changes: 2 additions & 59 deletions cloud/services/compute/loadbalancers/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ func TestService_createOrGetRegionalHealthCheck(t *testing.T) {
mockHealthChecks *cloud.MockRegionHealthChecks
want *compute.HealthCheck
wantErr bool
sharedVPC bool
}{
{
name: "regional health check does not exist for internal load balancer (should create healthcheck)",
Expand All @@ -280,43 +279,11 @@ func TestService_createOrGetRegionalHealthCheck(t *testing.T) {
UnhealthyThreshold: 3,
},
},
{
name: "regional health check does not exist for internal load balancer in shared VPC (should create healthcheck)",
scope: func(s *scope.ClusterScope) Scope {
s.GCPCluster.Spec.LoadBalancer = infrav1.LoadBalancerSpec{
LoadBalancerType: &lbTypeInternal,
}
return s
},
lbName: infrav1.InternalRoleTagValue,
mockHealthChecks: &cloud.MockRegionHealthChecks{
ProjectRouter: &cloud.SingleProjectRouter{ID: "proj-id"},
Objects: map[meta.Key]*cloud.MockRegionHealthChecksObj{},
},
want: &compute.HealthCheck{
CheckIntervalSec: 10,
HealthyThreshold: 5,
HttpsHealthCheck: &compute.HTTPSHealthCheck{Port: 6443, PortSpecification: "USE_FIXED_PORT", RequestPath: "/readyz"},
Name: "my-cluster-api-internal",
Region: "us-central1",
SelfLink: "https://www.googleapis.com/compute/v1/projects/proj-id/regions/us-central1/healthChecks/my-cluster-api-internal",
TimeoutSec: 5,
Type: "HTTPS",
UnhealthyThreshold: 3,
},
sharedVPC: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.TODO()
var err error
var clusterScope *scope.ClusterScope
if tt.sharedVPC {
clusterScope, err = getBaseClusterScopeWithSharedVPC()
} else {
clusterScope, err = getBaseClusterScope()
}
clusterScope, err := getBaseClusterScope()
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -660,7 +627,6 @@ func TestService_createOrGetTargetTCPProxy(t *testing.T) {
mockTargetTCPProxy *cloud.MockTargetTcpProxies
want *compute.TargetTcpProxy
wantErr bool
sharedVPC bool
}{
{
name: "target tcp proxy does not exist for external load balancer (should create target tp proxy)",
Expand All @@ -678,34 +644,11 @@ func TestService_createOrGetTargetTCPProxy(t *testing.T) {
SelfLink: "https://www.googleapis.com/compute/v1/projects/proj-id/global/targetTcpProxies/my-cluster-apiserver",
},
},
{
name: "target tcp proxy does not exist for external load balancer in shared VPC (should create target tp proxy)",
scope: func(s *scope.ClusterScope) Scope { return s },
backendService: &compute.BackendService{
Name: "my-cluster-api-internal",
},
mockTargetTCPProxy: &cloud.MockTargetTcpProxies{
ProjectRouter: &cloud.SingleProjectRouter{ID: "proj-id"},
Objects: map[meta.Key]*cloud.MockTargetTcpProxiesObj{},
},
want: &compute.TargetTcpProxy{
Name: "my-cluster-apiserver",
ProxyHeader: "NONE",
SelfLink: "https://www.googleapis.com/compute/v1/projects/proj-id/global/targetTcpProxies/my-cluster-apiserver",
},
sharedVPC: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := context.TODO()
var err error
var clusterScope *scope.ClusterScope
if tt.sharedVPC {
clusterScope, err = getBaseClusterScopeWithSharedVPC()
} else {
clusterScope, err = getBaseClusterScope()
}
clusterScope, err := getBaseClusterScope()
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions cloud/services/compute/loadbalancers/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ func New(scope Scope) *Service {
forwardingrules: scope.Cloud().GlobalForwardingRules(),
regionalforwardingrules: scope.Cloud().ForwardingRules(),
healthchecks: scope.Cloud().HealthChecks(),
regionalhealthchecks: cloudScope.RegionHealthChecks(),
regionalhealthchecks: scope.Cloud().RegionHealthChecks(),
instancegroups: scope.Cloud().InstanceGroups(),
targettcpproxies: cloudScope.TargetTcpProxies(),
targettcpproxies: scope.Cloud().TargetTcpProxies(),
subnets: cloudScope.Subnetworks(),
}
}

0 comments on commit e6001db

Please sign in to comment.