@@ -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
@@ -939,6 +939,19 @@ func (l *loadbalancers) makeUpdateHealthCheckRequest(backend *scwlb.Backend, nod
939
939
Method : healthCheckHTTPMethod ,
940
940
Code : & healthCheckHTTPCode ,
941
941
}
942
+ case "https" :
943
+ healthCheckHTTPURI := getHealthCheckHTTPURI (service )
944
+ healthCheckHTTPMethod := getHealthCheckHTTPMethod (service )
945
+ healthCheckHTTPCode , err := getHealthCheckHTTPCode (service )
946
+ if err != nil {
947
+ return nil , err
948
+ }
949
+ request .HTTPSConfig = & scwlb.HealthCheckHTTPSConfig {
950
+ URI : healthCheckHTTPURI ,
951
+ Method : healthCheckHTTPMethod ,
952
+ Code : & healthCheckHTTPCode ,
953
+ }
954
+
942
955
default :
943
956
klog .Errorf ("wrong value for healthCheckType" )
944
957
return nil , NewAnnorationError (serviceAnnotationLoadBalancerHealthCheckType , healthCheckType )
@@ -1084,6 +1097,18 @@ func (l *loadbalancers) makeCreateBackendRequest(loadbalancer *scwlb.LB, nodePor
1084
1097
Method : healthCheckHTTPMethod ,
1085
1098
Code : & healthCheckHTTPCode ,
1086
1099
}
1100
+ case "https" :
1101
+ healthCheckHTTPURI := getHealthCheckHTTPURI (service )
1102
+ healthCheckHTTPMethod := getHealthCheckHTTPMethod (service )
1103
+ healthCheckHTTPCode , err := getHealthCheckHTTPCode (service )
1104
+ if err != nil {
1105
+ return nil , err
1106
+ }
1107
+ healthCheck .HTTPSConfig = & scwlb.HealthCheckHTTPSConfig {
1108
+ URI : healthCheckHTTPURI ,
1109
+ Method : healthCheckHTTPMethod ,
1110
+ Code : & healthCheckHTTPCode ,
1111
+ }
1087
1112
default :
1088
1113
klog .Errorf ("wrong value for healthCheckType" )
1089
1114
return nil , errLoadBalancerInvalidAnnotation
@@ -1325,7 +1350,7 @@ func getHealthCheckType(service *v1.Service) (string, error) {
1325
1350
return "tcp" , nil
1326
1351
}
1327
1352
1328
- if healthCheckType != "mysql" && healthCheckType != "ldap" && healthCheckType != "redis" && healthCheckType != "pgsql" && healthCheckType != "tcp" && healthCheckType != "http" {
1353
+ if healthCheckType != "mysql" && healthCheckType != "ldap" && healthCheckType != "redis" && healthCheckType != "pgsql" && healthCheckType != "tcp" && healthCheckType != "http" && healthCheckType != "https" {
1329
1354
klog .Errorf ("invalid value for annotation %s" , serviceAnnotationLoadBalancerHealthCheckType )
1330
1355
return "" , errLoadBalancerInvalidAnnotation
1331
1356
}
0 commit comments