@@ -49,7 +49,7 @@ const (
49
49
serviceAnnotationLoadBalancerStickySessionsCookieName = "service.beta.kubernetes.io/scw-loadbalancer-sticky-sessions-cookie-name"
50
50
51
51
// serviceAnnotationLoadBalancerHealthCheckType is the type of health check used
52
- // The default value is "tcp" and the possible values are "tcp", "http", "mysql", "pgsql", "redis" or "ldap"
52
+ // The default value is "tcp" and the possible values are "tcp", "http", "https", " mysql", "pgsql", "redis" or "ldap"
53
53
// NB: depending on the type, some other annotations are required, see below
54
54
serviceAnnotationLoadBalancerHealthCheckType = "service.beta.kubernetes.io/scw-loadbalancer-health-check-type"
55
55
@@ -66,15 +66,15 @@ const (
66
66
serviceAnnotationLoadBalancerHealthCheckMaxRetries = "service.beta.kubernetes.io/scw-loadbalancer-health-check-max-retries"
67
67
68
68
// serviceAnnotationLoadBalancerHealthCheckHTTPURI is the URI that is used by the "http" health check
69
- // NB: Required when setting service.beta.kubernetes.io/scw-loadbalancer-health-check-type to "http"
69
+ // NB: Required when setting service.beta.kubernetes.io/scw-loadbalancer-health-check-type to "http" or "https"
70
70
serviceAnnotationLoadBalancerHealthCheckHTTPURI = "service.beta.kubernetes.io/scw-loadbalancer-health-check-http-uri"
71
71
72
72
// serviceAnnotationLoadBalancerHealthCheckHTTPMethod is the HTTP method used by the "http" health check
73
- // NB: Required when setting service.beta.kubernetes.io/scw-loadbalancer-health-check-type to "http"
73
+ // NB: Required when setting service.beta.kubernetes.io/scw-loadbalancer-health-check-type to "http" or "https"
74
74
serviceAnnotationLoadBalancerHealthCheckHTTPMethod = "service.beta.kubernetes.io/scw-loadbalancer-health-check-http-method"
75
75
76
76
// serviceAnnotationLoadBalancerHealthCheckHTTPCode is the HTTP code that the "http" health check will be matching against
77
- // NB: Required when setting service.beta.kubernetes.io/scw-loadbalancer-health-check-type to "http"
77
+ // NB: Required when setting service.beta.kubernetes.io/scw-loadbalancer-health-check-type to "http" or "https"
78
78
serviceAnnotationLoadBalancerHealthCheckHTTPCode = "service.beta.kubernetes.io/scw-loadbalancer-health-check-http-code"
79
79
80
80
// serviceAnnotationLoadBalancerHealthCheckMysqlUser is the MySQL user used to check the MySQL connection when using the "mysql" health check
@@ -923,6 +923,19 @@ func (l *loadbalancers) makeUpdateHealthCheckRequest(backend *scwlb.Backend, nod
923
923
Method : healthCheckHTTPMethod ,
924
924
Code : & healthCheckHTTPCode ,
925
925
}
926
+ case "https" :
927
+ healthCheckHTTPURI := getHealthCheckHTTPURI (service )
928
+ healthCheckHTTPMethod := getHealthCheckHTTPMethod (service )
929
+ healthCheckHTTPCode , err := getHealthCheckHTTPCode (service )
930
+ if err != nil {
931
+ return nil , err
932
+ }
933
+ request .HTTPSConfig = & scwlb.HealthCheckHTTPSConfig {
934
+ URI : healthCheckHTTPURI ,
935
+ Method : healthCheckHTTPMethod ,
936
+ Code : & healthCheckHTTPCode ,
937
+ }
938
+
926
939
default :
927
940
klog .Errorf ("wrong value for healthCheckType" )
928
941
return nil , NewAnnorationError (serviceAnnotationLoadBalancerHealthCheckType , healthCheckType )
@@ -1068,6 +1081,18 @@ func (l *loadbalancers) makeCreateBackendRequest(loadbalancer *scwlb.LB, nodePor
1068
1081
Method : healthCheckHTTPMethod ,
1069
1082
Code : & healthCheckHTTPCode ,
1070
1083
}
1084
+ case "https" :
1085
+ healthCheckHTTPURI := getHealthCheckHTTPURI (service )
1086
+ healthCheckHTTPMethod := getHealthCheckHTTPMethod (service )
1087
+ healthCheckHTTPCode , err := getHealthCheckHTTPCode (service )
1088
+ if err != nil {
1089
+ return nil , err
1090
+ }
1091
+ healthCheck .HTTPSConfig = & scwlb.HealthCheckHTTPSConfig {
1092
+ URI : healthCheckHTTPURI ,
1093
+ Method : healthCheckHTTPMethod ,
1094
+ Code : & healthCheckHTTPCode ,
1095
+ }
1071
1096
default :
1072
1097
klog .Errorf ("wrong value for healthCheckType" )
1073
1098
return nil , errLoadBalancerInvalidAnnotation
@@ -1309,7 +1334,7 @@ func getHealthCheckType(service *v1.Service) (string, error) {
1309
1334
return "tcp" , nil
1310
1335
}
1311
1336
1312
- if healthCheckType != "mysql" && healthCheckType != "ldap" && healthCheckType != "redis" && healthCheckType != "pgsql" && healthCheckType != "tcp" && healthCheckType != "http" {
1337
+ if healthCheckType != "mysql" && healthCheckType != "ldap" && healthCheckType != "redis" && healthCheckType != "pgsql" && healthCheckType != "tcp" && healthCheckType != "http" && healthCheckType != "https" {
1313
1338
klog .Errorf ("invalid value for annotation %s" , serviceAnnotationLoadBalancerHealthCheckType )
1314
1339
return "" , errLoadBalancerInvalidAnnotation
1315
1340
}
0 commit comments