Skip to content

Commit

Permalink
Merge pull request kubernetes#16785 from justinsb/better_error_messag…
Browse files Browse the repository at this point in the history
…e_around_challenge

refactor: give clear error message if challenge endpoint cannot be found
  • Loading branch information
k8s-ci-robot authored Aug 29, 2024
2 parents 2a71599 + 6a2a723 commit 2deb457
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/kops-controller/pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ func (s *Server) bootstrap(w http.ResponseWriter, r *http.Request) {
}

if model.UseChallengeCallback(kops.CloudProviderID(s.opt.Cloud)) {
if id.ChallengeEndpoint == "" {
klog.Infof("cannot determine endpoint for bootstrap callback challenge from %q", r.RemoteAddr)
w.WriteHeader(http.StatusBadRequest)
_, _ = w.Write([]byte("callback failed"))
return
}
if err := s.challengeClient.DoCallbackChallenge(ctx, s.opt.ClusterName, id.ChallengeEndpoint, req); err != nil {
klog.Infof("bootstrap %s callback challenge failed: %v", r.RemoteAddr, err)
w.WriteHeader(http.StatusBadRequest)
Expand Down

0 comments on commit 2deb457

Please sign in to comment.