kops-controller: Return `http.StatusConflict` when node already exists

This commit is contained in:
Ciprian Hacman 2023-05-27 09:47:40 +03:00
parent 669c2bc202
commit 7b545dde4b
1 changed files with 1 additions and 1 deletions

View File

@ -181,7 +181,7 @@ func (s *Server) bootstrap(w http.ResponseWriter, r *http.Request) {
err := s.uncachedClient.Get(ctx, types.NamespacedName{Name: id.NodeName}, node)
if err == nil {
klog.Infof("bootstrap %s node %q already exists; denying to avoid node-impersonation attacks", r.RemoteAddr, id.NodeName)
w.WriteHeader(http.StatusForbidden)
w.WriteHeader(http.StatusConflict)
_, _ = w.Write([]byte("node already registered"))
return
}