From 50b487bf5ffe9835124cbc38e2fd1f6041816c3d Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 15 Aug 2021 17:36:24 -0700 Subject: [PATCH] Add taint to supervisor --- supervisor/src/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/supervisor/src/main.go b/supervisor/src/main.go index 7686ea8..54c829b 100644 --- a/supervisor/src/main.go +++ b/supervisor/src/main.go @@ -117,6 +117,14 @@ func (sv *supervisor) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.Error(w, "401 wrong access token", http.StatusUnauthorized) return } + if r.URL.Path == "/api/supervisor/v1/taint" { + if r.Method != http.MethodPost { + http.Error(w, "405 method not allowed", http.StatusMethodNotAllowed) + return + } + sv.deployConfigHash = "tainted" + return + } if r.URL.Path == "/api/supervisor/v1/reload" { if r.Method != http.MethodPost { http.Error(w, "405 method not allowed", http.StatusMethodNotAllowed) @@ -322,6 +330,7 @@ func (sv *supervisor) reload() error { deployCfgHash := fmt.Sprintf("%x", h.Sum(nil)) if deployCfgHash == sv.deployConfigHash { sv.status(fmt.Sprintf("config hash remains at %s", deployCfgHash)) + return nil } else { sv.status(fmt.Sprintf( "config hash updated %s => %s",