Repository: hetznercloud/hcloud-cloud-controller-manager
Pull request #531 (2023-10-05 13:10:21)

refactor: clean up unused fields


Patch:
diff --git a/hcloud/cloud.go b/hcloud/cloud.go
index f427db68..1eb8105d 100644
--- a/hcloud/cloud.go
+++ b/hcloud/cloud.go
@@ -61,7 +61,6 @@ var providerVersion = "unknown"
 type cloud struct {
 	client       *hcloud.Client
 	instances    *instances
-	routes       *routes
 	loadBalancer *loadBalancers
 	networkID    int64
 }
@@ -154,7 +153,7 @@ func newCloud(_ io.Reader) (cloudprovider.Interface, error) {
 		Defaults:      lbOpsDefaults,
 	}
 
-	loadBalancers := newLoadBalancers(lbOps, &client.Action, lbDisablePrivateIngress, lbDisableIPv6)
+	loadBalancers := newLoadBalancers(lbOps, lbDisablePrivateIngress, lbDisableIPv6)
 	if os.Getenv(hcloudLoadBalancersEnabledENVVar) == "false" {
 		loadBalancers = nil
 	}
@@ -168,7 +167,6 @@ func newCloud(_ io.Reader) (cloudprovider.Interface, error) {
 		client:       client,
 		instances:    newInstances(client, instancesAddressFamily, networkID),
 		loadBalancer: loadBalancers,
-		routes:       nil,
 		networkID:    networkID,
 	}, nil
 }
diff --git a/hcloud/load_balancers.go b/hcloud/load_balancers.go
index 09be6ef3..cf0e478a 100644
--- a/hcloud/load_balancers.go
+++ b/hcloud/load_balancers.go
@@ -31,15 +31,13 @@ type LoadBalancerOps interface {
 
 type loadBalancers struct {
 	lbOps                        LoadBalancerOps
-	ac                           hcops.HCloudActionClient // Deprecated: should only be referenced by hcops types
 	disablePrivateIngressDefault bool
 	disableIPv6Default           bool
 }
 
-func newLoadBalancers(lbOps LoadBalancerOps, ac hcops.HCloudActionClient, disablePrivateIngressDefault bool, disableIPv6Default bool) *loadBalancers {
+func newLoadBalancers(lbOps LoadBalancerOps, disablePrivateIngressDefault bool, disableIPv6Default bool) *loadBalancers {
 	return &loadBalancers{
 		lbOps:                        lbOps,
-		ac:                           ac,
 		disablePrivateIngressDefault: disablePrivateIngressDefault,
 		disableIPv6Default:           disableIPv6Default,
 	}


Test patch:
diff --git a/hcloud/testing.go b/hcloud/testing.go
index 1d05321b..77bea1a1 100644
--- a/hcloud/testing.go
+++ b/hcloud/testing.go
@@ -89,7 +89,6 @@ type LoadBalancerTestCase struct {
 	// Set by run
 	LBOps         *hcops.MockLoadBalancerOps
 	LBClient      *mocks.LoadBalancerClient
-	ActionClient  *mocks.ActionClient
 	LoadBalancers *loadBalancers
 	Service       *corev1.Service
 }
@@ -100,9 +99,6 @@ func (tt *LoadBalancerTestCase) run(t *testing.T) {
 	tt.LBOps = &hcops.MockLoadBalancerOps{}
 	tt.LBOps.Test(t)
 
-	tt.ActionClient = &mocks.ActionClient{}
-	tt.ActionClient.Test(t)
-
 	tt.LBClient = &mocks.LoadBalancerClient{}
 	tt.LBClient.Test(t)
 
@@ -125,12 +121,11 @@ func (tt *LoadBalancerTestCase) run(t *testing.T) {
 		tt.Mock(t, tt)
 	}
 
-	tt.LoadBalancers = newLoadBalancers(tt.LBOps, tt.ActionClient, tt.DisablePrivateIngressDefault, tt.DisableIPv6Default)
+	tt.LoadBalancers = newLoadBalancers(tt.LBOps, tt.DisablePrivateIngressDefault, tt.DisableIPv6Default)
 	tt.Perform(t, tt)
 
 	tt.LBOps.AssertExpectations(t)
 	tt.LBClient.AssertExpectations(t)
-	tt.ActionClient.AssertExpectations(t)
 }
 
 func RunLoadBalancerTests(t *testing.T, tests []LoadBalancerTestCase) {