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 @@ -2189,15 +2189,16 @@ func (kl *Kubelet) updateRuntimeUp() {
2189
2189
// Set nil if the container runtime network is ready.
2190
2190
kl .runtimeState .setNetworkState (nil )
2191
2191
}
2192
- // TODO(random-liu): Add runtime error in runtimeState, and update it
2193
- // when runtime is not ready, so that the information in RuntimeReady
2194
- // condition will be propagated to NodeReady condition.
2192
+ // information in RuntimeReady condition will be propagated to NodeReady condition.
2195
2193
runtimeReady := s .GetRuntimeCondition (kubecontainer .RuntimeReady )
2196
2194
// If RuntimeReady is not set or is false, report an error.
2197
2195
if runtimeReady == nil || ! runtimeReady .Status {
2198
- klog .Errorf ("Container runtime not ready: %v" , runtimeReady )
2196
+ err := fmt .Errorf ("Container runtime not ready: %v" , runtimeReady )
2197
+ klog .Error (err )
2198
+ kl .runtimeState .setRuntimeState (err )
2199
2199
return
2200
2200
}
2201
+ kl .runtimeState .setRuntimeState (nil )
2201
2202
kl .oneTimeInitializer .Do (kl .initializeRuntimeDependentModules )
2202
2203
kl .runtimeState .setRuntimeSync (kl .clock .Now ())
2203
2204
}
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