mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
allow to shutdown quickly the apiserver
This commit is contained in:
@@ -145,11 +145,15 @@ func (c *Controller) Stop() {
|
|||||||
// Run periodically updates the kubernetes service
|
// Run periodically updates the kubernetes service
|
||||||
func (c *Controller) Run(ch <-chan struct{}) {
|
func (c *Controller) Run(ch <-chan struct{}) {
|
||||||
// wait until process is ready
|
// wait until process is ready
|
||||||
wait.PollImmediateUntil(100*time.Millisecond, func() (bool, error) {
|
ctx := wait.ContextForChannel(ch)
|
||||||
|
err := wait.PollUntilContextCancel(ctx, 100*time.Millisecond, true, func(context.Context) (bool, error) {
|
||||||
var code int
|
var code int
|
||||||
c.client.CoreV1().RESTClient().Get().AbsPath("/readyz").Do(context.TODO()).StatusCode(&code)
|
c.client.CoreV1().RESTClient().Get().AbsPath("/readyz").Do(context.TODO()).StatusCode(&code)
|
||||||
return code == http.StatusOK, nil
|
return code == http.StatusOK, nil
|
||||||
}, ch)
|
})
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
wait.NonSlidingUntil(func() {
|
wait.NonSlidingUntil(func() {
|
||||||
// Service definition is not reconciled after first
|
// Service definition is not reconciled after first
|
||||||
|
Reference in New Issue
Block a user