@@ -379,6 +379,9 @@ func (nim *nodeInfoManager) tryUpdateCSINode(
379
379
maxAttachLimit int64 ,
380
380
topology map [string ]string ) error {
381
381
382
+ nim .lock .Lock ()
383
+ defer nim .lock .Unlock ()
384
+
382
385
nodeInfo , err := csiKubeClient .StorageV1 ().CSINodes ().Get (context .TODO (), string (nim .nodeName ), metav1.GetOptions {})
383
386
if nodeInfo == nil || errors .IsNotFound (err ) {
384
387
nodeInfo , err = nim .CreateCSINode ()
@@ -412,6 +415,9 @@ func (nim *nodeInfoManager) InitializeCSINodeWithAnnotation() error {
412
415
}
413
416
414
417
func (nim * nodeInfoManager ) tryInitializeCSINodeWithAnnotation (csiKubeClient clientset.Interface ) error {
418
+ nim .lock .Lock ()
419
+ defer nim .lock .Unlock ()
420
+
415
421
nodeInfo , err := csiKubeClient .StorageV1 ().CSINodes ().Get (context .TODO (), string (nim .nodeName ), metav1.GetOptions {})
416
422
if nodeInfo == nil || errors .IsNotFound (err ) {
417
423
// CreateCSINode will set the annotation
@@ -602,6 +608,9 @@ func (nim *nodeInfoManager) tryUninstallDriverFromCSINode(
602
608
csiKubeClient clientset.Interface ,
603
609
csiDriverName string ) error {
604
610
611
+ nim .lock .Lock ()
612
+ defer nim .lock .Unlock ()
613
+
605
614
nodeInfoClient := csiKubeClient .StorageV1 ().CSINodes ()
606
615
nodeInfo , err := nodeInfoClient .Get (context .TODO (), string (nim .nodeName ), metav1.GetOptions {})
607
616
if err != nil && errors .IsNotFound (err ) {
0 commit comments