proxy: implement simple healthcheck
This commit is contained in:
parent
77842fab58
commit
4af563ce89
|
@ -7,6 +7,10 @@ COPY . .
|
||||||
RUN go build -o /work/proxy .
|
RUN go build -o /work/proxy .
|
||||||
|
|
||||||
# Copy binary to alpine
|
# Copy binary to alpine
|
||||||
FROM gcr.io/distroless/base-debian10
|
FROM gcr.io/distroless/base-debian10:debug
|
||||||
|
|
||||||
COPY --from=builder /work/proxy /
|
COPY --from=builder /work/proxy /
|
||||||
|
|
||||||
|
HEALTHCHECK CMD [ "wget", "spider", "http://localhost:4180/pbprox/ping" ]
|
||||||
|
|
||||||
ENTRYPOINT ["/proxy"]
|
ENTRYPOINT ["/proxy"]
|
||||||
|
|
|
@ -47,7 +47,6 @@ func getCommonOptions() *options.Options {
|
||||||
commonOpts.EmailDomains = []string{"*"}
|
commonOpts.EmailDomains = []string{"*"}
|
||||||
commonOpts.ProviderType = "oidc"
|
commonOpts.ProviderType = "oidc"
|
||||||
commonOpts.ProxyPrefix = "/pbprox"
|
commonOpts.ProxyPrefix = "/pbprox"
|
||||||
commonOpts.PingPath = "/pbprox/ping"
|
|
||||||
commonOpts.SkipProviderButton = true
|
commonOpts.SkipProviderButton = true
|
||||||
commonOpts.Logging.SilencePing = true
|
commonOpts.Logging.SilencePing = true
|
||||||
commonOpts.SetXAuthRequest = true
|
commonOpts.SetXAuthRequest = true
|
||||||
|
|
|
@ -82,6 +82,10 @@ func (s *Server) ServeHTTPS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.URL.Path == "/pbprox/ping" {
|
||||||
|
w.WriteHeader(204)
|
||||||
|
return
|
||||||
|
}
|
||||||
handler, ok := s.Handlers[r.Host]
|
handler, ok := s.Handlers[r.Host]
|
||||||
if !ok {
|
if !ok {
|
||||||
// If we only have one handler, host name switching doesn't matter
|
// If we only have one handler, host name switching doesn't matter
|
||||||
|
|
Reference in New Issue