Skip to content

Commit c7e254d

Browse files
authored
feat(lb): allow query params for lb healthchecks (#156)
1 parent 60ea03b commit c7e254d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

scaleway/loadbalancers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ func getHTTPHealthCheck(service *v1.Service, nodePort int32) (*scwlb.HealthCheck
15321532
return &scwlb.HealthCheckHTTPConfig{
15331533
Method: method,
15341534
Code: &code,
1535-
URI: uri.Path,
1535+
URI: uri.RequestURI(),
15361536
HostHeader: uri.Host,
15371537
}, nil
15381538
}

scaleway/loadbalancers_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,15 @@ func TestGetHTTPHealthCheck(t *testing.T) {
11931193
},
11941194
}, &scwlb.HealthCheckHTTPConfig{URI: "/path", Method: "GET", Code: scw.Int32Ptr(200), HostHeader: "domain.tld"}},
11951195

1196+
{"with a domain, path and query params", &v1.Service{
1197+
ObjectMeta: metav1.ObjectMeta{
1198+
Annotations: map[string]string{
1199+
"service.beta.kubernetes.io/scw-loadbalancer-health-check-type": "http",
1200+
"service.beta.kubernetes.io/scw-loadbalancer-health-check-http-uri": "domain.tld/path?password=xxxx",
1201+
},
1202+
},
1203+
}, &scwlb.HealthCheckHTTPConfig{URI: "/path?password=xxxx", Method: "GET", Code: scw.Int32Ptr(200), HostHeader: "domain.tld"}},
1204+
11961205
{"with just a path", &v1.Service{
11971206
ObjectMeta: metav1.ObjectMeta{
11981207
Annotations: map[string]string{
@@ -1225,7 +1234,7 @@ func TestGetHTTPHealthCheck(t *testing.T) {
12251234
t.Run(tt.name, func(t *testing.T) {
12261235
got, _ := getHTTPHealthCheck(tt.svc, int32(80))
12271236
if !reflect.DeepEqual(got, tt.want) {
1228-
t.Errorf("want: %v, got: %v", got, tt.want)
1237+
t.Errorf("want: %v, got: %v", tt.want, got)
12291238
}
12301239
})
12311240
}

0 commit comments

Comments
 (0)