Skip to content

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 committed Aug 27, 2016
1 parent 1625f6a commit 34d72cd
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 34d72cd

Please sign in to comment.