Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
retry on apiserver insecure listen failures
Browse files Browse the repository at this point in the history
This is a backport of:
kubernetes#28797
  • Loading branch information
aaronlevy authored and Jenkins Deploy committed Nov 1, 2016
1 parent 8e44707 commit 894a723
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/genericapiserver/genericapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,18 @@ func (s *GenericAPIServer) Run(options *options.ServerRunOptions) {
Handler: apiserver.RecoverPanics(handler),
MaxHeaderBytes: 1 << 20,
}

glog.Infof("Serving insecurely on %s", insecureLocation)
glog.Fatal(http.ListenAndServe())
go func() {
defer utilruntime.HandleCrash()
for {
if err := http.ListenAndServe(); err != nil {
glog.Errorf("Unable to listen for insecure (%v); will try again.", err)
}
time.Sleep(15 * time.Second)
}
}()
select {}
}

// Exposes the given group version in API.
Expand Down

0 comments on commit 894a723

Please sign in to comment.