Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for AWS ELB healthcheck probe #1198 #1199

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ This changelog keeps track of work items that have been completed and are ready
- **General**: Support setting multiple TLS certs for different domains on the interceptor proxy ([#1116](https://github.com/kedacore/http-add-on/issues/1116))
- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))

- **Interceptor**: Add support for for AWS ELB healthcheck probe ([#1198](https://github.com/kedacore/http-add-on/issues/1198))

### Improvements

- **General**: TODO ([#TODO](https://github.com/kedacore/http-add-on/issues/TODO))
Expand Down
3 changes: 2 additions & 1 deletion interceptor/middleware/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
var (
kubernetesProbeUserAgent = regexp.MustCompile(`(^|\s)kube-probe/`)
googleHCUserAgent = regexp.MustCompile(`(^|\s)GoogleHC/`)
awsELBserAgent = regexp.MustCompile(`(^|\s)ELB-HealthChecker/`)
)

type Routing struct {
Expand Down Expand Up @@ -112,5 +113,5 @@ func (rm *Routing) streamFromHTTPSO(ctx context.Context, httpso *httpv1alpha1.HT
func (rm *Routing) isProbe(r *http.Request) bool {
ua := r.UserAgent()

return kubernetesProbeUserAgent.Match([]byte(ua)) || googleHCUserAgent.Match([]byte(ua))
return kubernetesProbeUserAgent.Match([]byte(ua)) || googleHCUserAgent.Match([]byte(ua)) || awsELBserAgent.Match([]byte(ua))
}
14 changes: 13 additions & 1 deletion interceptor/middleware/routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,19 @@ var _ = Describe("RoutingMiddleware", func() {
Expect(b).To(BeTrue())
})

It("returns false if the request is not from kube-probe or GoogleHC", func() {
It("returns true if the request is from AWS ELB", func() {
const (
uaVal = "Go-http-client/1.1 ELB-HealthChecker/2.0 (linux/amd64) kubernetes/4c94112"
)

r.Header.Set(uaKey, uaVal)

var rm Routing
b := rm.isProbe(r)
Expect(b).To(BeTrue())
})

It("returns false if the request is not from kube-probe or GoogleHC or ELB-HealthChecker", func() {
const (
uaVal = "Go-http-client/1.1 kubectl/v1.27.1 (linux/amd64) kubernetes/4c94112"
)
Expand Down
Loading