mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
Set runtimeState when RuntimeReady is not set or false
This commit is contained in:
parent
656cf9cc7c
commit
3865e2b956
@ -2182,15 +2182,16 @@ func (kl *Kubelet) updateRuntimeUp() {
|
|||||||
// Set nil if the container runtime network is ready.
|
// Set nil if the container runtime network is ready.
|
||||||
kl.runtimeState.setNetworkState(nil)
|
kl.runtimeState.setNetworkState(nil)
|
||||||
}
|
}
|
||||||
// TODO(random-liu): Add runtime error in runtimeState, and update it
|
// information in RuntimeReady condition will be propagated to NodeReady condition.
|
||||||
// when runtime is not ready, so that the information in RuntimeReady
|
|
||||||
// condition will be propagated to NodeReady condition.
|
|
||||||
runtimeReady := s.GetRuntimeCondition(kubecontainer.RuntimeReady)
|
runtimeReady := s.GetRuntimeCondition(kubecontainer.RuntimeReady)
|
||||||
// If RuntimeReady is not set or is false, report an error.
|
// If RuntimeReady is not set or is false, report an error.
|
||||||
if runtimeReady == nil || !runtimeReady.Status {
|
if runtimeReady == nil || !runtimeReady.Status {
|
||||||
klog.Errorf("Container runtime not ready: %v", runtimeReady)
|
err := fmt.Errorf("Container runtime not ready: %v", runtimeReady)
|
||||||
|
klog.Error(err)
|
||||||
|
kl.runtimeState.setRuntimeState(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
kl.runtimeState.setRuntimeState(nil)
|
||||||
kl.oneTimeInitializer.Do(kl.initializeRuntimeDependentModules)
|
kl.oneTimeInitializer.Do(kl.initializeRuntimeDependentModules)
|
||||||
kl.runtimeState.setRuntimeSync(kl.clock.Now())
|
kl.runtimeState.setRuntimeSync(kl.clock.Now())
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ type runtimeState struct {
|
|||||||
lastBaseRuntimeSync time.Time
|
lastBaseRuntimeSync time.Time
|
||||||
baseRuntimeSyncThreshold time.Duration
|
baseRuntimeSyncThreshold time.Duration
|
||||||
networkError error
|
networkError error
|
||||||
|
runtimeError error
|
||||||
storageError error
|
storageError error
|
||||||
cidr string
|
cidr string
|
||||||
healthChecks []*healthCheck
|
healthChecks []*healthCheck
|
||||||
@ -62,6 +63,12 @@ func (s *runtimeState) setNetworkState(err error) {
|
|||||||
s.networkError = err
|
s.networkError = err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *runtimeState) setRuntimeState(err error) {
|
||||||
|
s.Lock()
|
||||||
|
defer s.Unlock()
|
||||||
|
s.runtimeError = err
|
||||||
|
}
|
||||||
|
|
||||||
func (s *runtimeState) setStorageState(err error) {
|
func (s *runtimeState) setStorageState(err error) {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
defer s.Unlock()
|
defer s.Unlock()
|
||||||
@ -94,6 +101,9 @@ func (s *runtimeState) runtimeErrors() error {
|
|||||||
errs = append(errs, fmt.Errorf("%s is not healthy: %v", hc.name, err))
|
errs = append(errs, fmt.Errorf("%s is not healthy: %v", hc.name, err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if s.runtimeError != nil {
|
||||||
|
errs = append(errs, s.runtimeError)
|
||||||
|
}
|
||||||
|
|
||||||
return utilerrors.NewAggregate(errs)
|
return utilerrors.NewAggregate(errs)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user