diff --git a/eventrecorder/recorder.go b/eventrecorder/recorder.go index 43bc553..101a226 100644 --- a/eventrecorder/recorder.go +++ b/eventrecorder/recorder.go @@ -65,6 +65,7 @@ func (r *EventRecorder) Start(ctx context.Context) error { func (r *EventRecorder) httpServerMux() *http.ServeMux { mux := http.NewServeMux() mux.HandleFunc("/v1/retrieval-events", r.handleRetrievalEvents) + mux.HandleFunc("/ready", r.handleReady) return mux } @@ -149,6 +150,16 @@ func (r *EventRecorder) handleRetrievalEvents(res http.ResponseWriter, req *http } } +func (r *EventRecorder) handleReady(res http.ResponseWriter, req *http.Request) { + switch req.Method { + case http.MethodGet: + // TODO: ping DB as part of readiness check? + res.Header().Add("Allow", http.MethodGet) + default: + http.Error(res, "", http.StatusMethodNotAllowed) + } +} + func (r *EventRecorder) Shutdown(ctx context.Context) error { return r.server.Shutdown(ctx) }