Repository: hetznercloud/hcloud-cloud-controller-manager (go)

Issue:
health-check-interval: parsing "15s": invalid syntax
The health-check-interval annotation is set as `time.Duration` but then is attempted to be parsed as `int`.

```
Event(v1.ObjectReference{Kind:"Service", Namespace:"default", Name:"echoserver", UID:"618a5944-ff89-4042-85c3-f398036c582d", APIVersion:"v1", ResourceVersion:"1538", FieldPath:""}): type: 'Warning' reason: 'UpdateLoadBalancerFailed' Error updating load balancer with new hosts map[ubuntu-2gb-hel1-3:{}]: hcloud/loadBalancers.UpdateLoadBalancer: hcops/LoadBalancerOps.ReconcileHCLBServices: hcops/hclbServiceOptsBuilder.buildUpdateServiceOpts: hcops/hclbServiceOptsBuilder.extractHealthCheck: annotation/Name.IntFromService: load-balancer.hetzner.cloud/health-check-interval: strconv.Atoi: parsing "15s": invalid syntax
```

Pull request:
Parse interval and timeout as time.Duration
Closes #54

Patch:
diff --git a/internal/hcops/load_balancer.go b/internal/hcops/load_balancer.go
index 64596866..9fe95e82 100644
--- a/internal/hcops/load_balancer.go
+++ b/internal/hcops/load_balancer.go
@@ -607,27 +607,27 @@ func (b *hclbServiceOptsBuilder) extractHealthCheck() {
 	})
 
 	b.do(func() error {
-		hcInterval, err := annotation.LBSvcHealthCheckInterval.IntFromService(b.Service)
+		hcInterval, err := annotation.LBSvcHealthCheckInterval.DurationFromService(b.Service)
 		if errors.Is(err, annotation.ErrNotSet) {
 			return nil
 		}
 		if err != nil {
 			return fmt.Errorf("%s: %w", op, err)
 		}
-		b.healthCheckOpts.Interval = time.Duration(hcInterval) * time.Second
+		b.healthCheckOpts.Interval = time.Duration(hcInterval)
 		b.addHealthCheck = true
 		return nil
 	})
 
 	b.do(func() error {
-		t, err := annotation.LBSvcHealthCheckTimeout.IntFromService(b.Service)
+		t, err := annotation.LBSvcHealthCheckTimeout.DurationFromService(b.Service)
 		if errors.Is(err, annotation.ErrNotSet) {
 			return nil
 		}
 		if err != nil {
 			return fmt.Errorf("%s: %w", op, err)
 		}
-		b.healthCheckOpts.Timeout = time.Duration(t) * time.Second
+		b.healthCheckOpts.Timeout = time.Duration(t)
 		b.addHealthCheck = true
 		return nil
 	})


Test patch:
diff --git a/internal/hcops/load_balancer_internal_test.go b/internal/hcops/load_balancer_internal_test.go
index b1b424fc..8c7b752f 100644
--- a/internal/hcops/load_balancer_internal_test.go
+++ b/internal/hcops/load_balancer_internal_test.go
@@ -93,10 +93,10 @@ func TestHCLBServiceOptsBuilder(t *testing.T) {
 			servicePort: v1.ServicePort{Port: 83, NodePort: 8083},
 			serviceAnnotations: map[annotation.Name]interface{}{
 				annotation.LBSvcHealthCheckProtocol: string(hcloud.LoadBalancerServiceProtocolTCP),
-				annotation.LBSvcHealthCheckPort:     "8084",
-				annotation.LBSvcHealthCheckInterval: "3600",
-				annotation.LBSvcHealthCheckTimeout:  "30",
-				annotation.LBSvcHealthCheckRetries:  "5",
+				annotation.LBSvcHealthCheckPort:     8084,
+				annotation.LBSvcHealthCheckInterval: time.Hour,
+				annotation.LBSvcHealthCheckTimeout:  30 * time.Second,
+				annotation.LBSvcHealthCheckRetries:  5,
 			},
 			expectedAddOpts: hcloud.LoadBalancerAddServiceOpts{
 				ListenPort:      hcloud.Int(83),
@@ -130,8 +130,8 @@ func TestHCLBServiceOptsBuilder(t *testing.T) {
 			serviceAnnotations: map[annotation.Name]interface{}{
 				annotation.LBSvcHealthCheckProtocol:                hcloud.LoadBalancerServiceProtocolHTTP,
 				annotation.LBSvcHealthCheckPort:                    8085,
-				annotation.LBSvcHealthCheckInterval:                3600,
-				annotation.LBSvcHealthCheckTimeout:                 30,
+				annotation.LBSvcHealthCheckInterval:                time.Hour,
+				annotation.LBSvcHealthCheckTimeout:                 30 * time.Second,
 				annotation.LBSvcHealthCheckRetries:                 5,
 				annotation.LBSvcHealthCheckHTTPDomain:              "example.com",
 				annotation.LBSvcHealthCheckHTTPPath:                "/internal/health",