File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -2182,15 +2182,16 @@ func (kl *Kubelet) updateRuntimeUp() {
2182
2182
// Set nil if the container runtime network is ready.
2183
2183
kl .runtimeState .setNetworkState (nil )
2184
2184
}
2185
- // TODO(random-liu): Add runtime error in runtimeState, and update it
2186
- // when runtime is not ready, so that the information in RuntimeReady
2187
- // condition will be propagated to NodeReady condition.
2185
+ // information in RuntimeReady condition will be propagated to NodeReady condition.
2188
2186
runtimeReady := s .GetRuntimeCondition (kubecontainer .RuntimeReady )
2189
2187
// If RuntimeReady is not set or is false, report an error.
2190
2188
if runtimeReady == nil || ! runtimeReady .Status {
2191
- klog .Errorf ("Container runtime not ready: %v" , runtimeReady )
2189
+ err := fmt .Errorf ("Container runtime not ready: %v" , runtimeReady )
2190
+ klog .Error (err )
2191
+ kl .runtimeState .setRuntimeState (err )
2192
2192
return
2193
2193
}
2194
+ kl .runtimeState .setRuntimeState (nil )
2194
2195
kl .oneTimeInitializer .Do (kl .initializeRuntimeDependentModules )
2195
2196
kl .runtimeState .setRuntimeSync (kl .clock .Now ())
2196
2197
}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ type runtimeState struct {
30
30
lastBaseRuntimeSync time.Time
31
31
baseRuntimeSyncThreshold time.Duration
32
32
networkError error
33
+ runtimeError error
33
34
storageError error
34
35
cidr string
35
36
healthChecks []* healthCheck
@@ -62,6 +63,12 @@ func (s *runtimeState) setNetworkState(err error) {
62
63
s .networkError = err
63
64
}
64
65
66
+ func (s * runtimeState ) setRuntimeState (err error ) {
67
+ s .Lock ()
68
+ defer s .Unlock ()
69
+ s .runtimeError = err
70
+ }
71
+
65
72
func (s * runtimeState ) setStorageState (err error ) {
66
73
s .Lock ()
67
74
defer s .Unlock ()
@@ -94,6 +101,9 @@ func (s *runtimeState) runtimeErrors() error {
94
101
errs = append (errs , fmt .Errorf ("%s is not healthy: %v" , hc .name , err ))
95
102
}
96
103
}
104
+ if s .runtimeError != nil {
105
+ errs = append (errs , s .runtimeError )
106
+ }
97
107
98
108
return utilerrors .NewAggregate (errs )
99
109
}
You can’t perform that action at this time.
0 commit comments