@@ -168,15 +168,15 @@ func initNodeInfo(ctx context.Context) {
168168 panic ("" )
169169 }
170170
171- SelfNodeName = getNodeName ()
172- if SelfNodeName != "" {
173- return
174- }
175-
176171 pod , err := client .CoreV1 ().Pods (getNamespace ()).Get (ctx , podName , metav1.GetOptions {})
177172 if err != nil {
178- localLogger .Fatalf ("can't detect node name for k8s plugin using pod %q: %s" , podName , err .Error ())
179- panic ("" )
173+ localLogger .Warnf ("can't detect node name for k8s plugin using pod %q: %s" , podName , err .Error ())
174+ SelfNodeName = getNodeName ()
175+ if SelfNodeName != "" {
176+ localLogger .Fatalf ("can't get node name from cache for k8s plugin using pod %q" , podName )
177+ panic ("" )
178+ }
179+ return
180180 }
181181 SelfNodeName = pod .Spec .NodeName
182182}
@@ -228,14 +228,14 @@ func initInformer() {
228228}
229229
230230func initRuntime (ctx context.Context ) {
231- if MetaData .NodeLabels != nil && MetaData .CriType != "" {
232- return
233- }
234-
235231 node , err := client .CoreV1 ().Nodes ().Get (ctx , SelfNodeName , metav1.GetOptions {})
236232 if err != nil || node == nil {
237- localLogger .Fatalf ("can't detect CRI runtime for node %s, api call is unsuccessful: %s" , node , err .Error ())
238- panic ("_" )
233+ localLogger .Warnf ("can't detect CRI runtime for node %s, api call is unsuccessful: %s" , node , err .Error ())
234+ if MetaData .CriType == "" {
235+ localLogger .Fatalf ("can't get CRI runtime for node %s from cache" , node )
236+ panic ("" )
237+ }
238+ return
239239 }
240240 runtimeVer := node .Status .NodeInfo .ContainerRuntimeVersion
241241 pos := strings .IndexByte (runtimeVer , ':' )
0 commit comments