Skip to content

Commit

Permalink
feat: implement healthcheck for kubernetes probes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke committed Jun 1, 2022
1 parent b961d28 commit 7300232
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions injectproxy/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package injectproxy

import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -162,6 +163,12 @@ func NewRoutes(upstream *url.URL, label string, opts ...Option) (*routes, error)
mux.Handle("/api/v2/alerts/groups", r.enforceLabel(enforceMethods(r.enforceFilterParameter, "GET"))),
)

errs.Add(
mux.Handle("/healthz", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
json.NewEncoder(w).Encode(map[string]bool{"ok": true})
})),
)

if err := errs.Err(); err != nil {
return nil, err
}
Expand Down

0 comments on commit 7300232

Please sign in to comment.