use http.StatusConflict

This commit is contained in:
Jesse Haka 2023-02-20 13:01:43 +02:00
parent 8e6199fa39
commit a765191898
2 changed files with 3 additions and 3 deletions

View File

@ -144,7 +144,7 @@ func (s *Server) bootstrap(w http.ResponseWriter, r *http.Request) {
if err != nil { if err != nil {
// means that we should exit nodeup gracefully // means that we should exit nodeup gracefully
if err == bootstrap.ErrAlreadyExists { if err == bootstrap.ErrAlreadyExists {
w.WriteHeader(http.StatusNoContent) w.WriteHeader(http.StatusConflict)
klog.Infof("%s: %v", r.RemoteAddr, err) klog.Infof("%s: %v", r.RemoteAddr, err)
return return
} }

View File

@ -151,8 +151,8 @@ func (b *Client) Query(ctx context.Context, req any, resp any) error {
defer response.Body.Close() defer response.Body.Close()
} }
// if we receive StatusNoContent it means that we should exit gracefully // if we receive StatusConflict it means that we should exit gracefully
if response.StatusCode == http.StatusNoContent { if response.StatusCode == http.StatusConflict {
klog.Infof("kops-controller returned status code %d", response.StatusCode) klog.Infof("kops-controller returned status code %d", response.StatusCode)
os.Exit(0) os.Exit(0)
} }