@@ -49,7 +49,7 @@ const (
4949 serviceAnnotationLoadBalancerStickySessionsCookieName = "service.beta.kubernetes.io/scw-loadbalancer-sticky-sessions-cookie-name"
5050
5151 // 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"
5353 // NB: depending on the type, some other annotations are required, see below
5454 serviceAnnotationLoadBalancerHealthCheckType = "service.beta.kubernetes.io/scw-loadbalancer-health-check-type"
5555
@@ -66,15 +66,15 @@ const (
6666 serviceAnnotationLoadBalancerHealthCheckMaxRetries = "service.beta.kubernetes.io/scw-loadbalancer-health-check-max-retries"
6767
6868 // 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"
7070 serviceAnnotationLoadBalancerHealthCheckHTTPURI = "service.beta.kubernetes.io/scw-loadbalancer-health-check-http-uri"
7171
7272 // 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"
7474 serviceAnnotationLoadBalancerHealthCheckHTTPMethod = "service.beta.kubernetes.io/scw-loadbalancer-health-check-http-method"
7575
7676 // 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"
7878 serviceAnnotationLoadBalancerHealthCheckHTTPCode = "service.beta.kubernetes.io/scw-loadbalancer-health-check-http-code"
7979
8080 // 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
923923 Method : healthCheckHTTPMethod ,
924924 Code : & healthCheckHTTPCode ,
925925 }
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+
926939 default :
927940 klog .Errorf ("wrong value for healthCheckType" )
928941 return nil , NewAnnorationError (serviceAnnotationLoadBalancerHealthCheckType , healthCheckType )
@@ -1068,6 +1081,18 @@ func (l *loadbalancers) makeCreateBackendRequest(loadbalancer *scwlb.LB, nodePor
10681081 Method : healthCheckHTTPMethod ,
10691082 Code : & healthCheckHTTPCode ,
10701083 }
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+ }
10711096 default :
10721097 klog .Errorf ("wrong value for healthCheckType" )
10731098 return nil , errLoadBalancerInvalidAnnotation
@@ -1309,7 +1334,7 @@ func getHealthCheckType(service *v1.Service) (string, error) {
13091334 return "tcp" , nil
13101335 }
13111336
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" {
13131338 klog .Errorf ("invalid value for annotation %s" , serviceAnnotationLoadBalancerHealthCheckType )
13141339 return "" , errLoadBalancerInvalidAnnotation
13151340 }
0 commit comments