@@ -550,22 +550,32 @@ var _ = Describe("GarbageCollect", func() {
550
550
},
551
551
},
552
552
}
553
- versionLabel := utils .GetModuleVersionLabelName (mod .Namespace , mod .Name )
553
+ moduleLoaderVersionLabel := utils .GetModuleLoaderVersionLabelName (mod .Namespace , mod .Name )
554
+ devicePluginVersionLabel := utils .GetDevicePluginVersionLabelName (mod .Namespace , mod .Name )
554
555
555
- DescribeTable ("device-plugin and modue -loader GC" , func (devicePluginFormerLabel , moduleLoaderFormerLabel , moduleLoaderInvalidKernel bool ,
556
+ DescribeTable ("device-plugin and module -loader GC" , func (devicePluginFormerLabel , moduleLoaderFormerLabel , moduleLoaderInvalidKernel bool ,
556
557
devicePluginFormerDesired , moduleLoaderFormerDesired int ) {
557
558
moduleLoaderDS := appsv1.DaemonSet {
558
559
ObjectMeta : metav1.ObjectMeta {
559
560
Name : "moduleLoader" ,
560
561
Namespace : "namespace" ,
561
- Labels : map [string ]string {kernelLabel : legitKernelVersion , constants .DaemonSetRole : moduleLoaderRoleLabelValue , versionLabel : currentModuleVersion },
562
+ Labels : map [string ]string {
563
+ kernelLabel : legitKernelVersion ,
564
+ constants .DaemonSetRole : moduleLoaderRoleLabelValue ,
565
+ moduleLoaderVersionLabel : currentModuleVersion ,
566
+ constants .ModuleNameLabel : mod .Name ,
567
+ },
562
568
},
563
569
}
564
570
devicePluginDS := appsv1.DaemonSet {
565
571
ObjectMeta : metav1.ObjectMeta {
566
572
Name : "devicePlugin" ,
567
573
Namespace : "namespace" ,
568
- Labels : map [string ]string {constants .DaemonSetRole : devicePluginRoleLabelValue , versionLabel : currentModuleVersion },
574
+ Labels : map [string ]string {
575
+ constants .DaemonSetRole : devicePluginRoleLabelValue ,
576
+ devicePluginVersionLabel : currentModuleVersion ,
577
+ constants .ModuleNameLabel : mod .Name ,
578
+ },
569
579
},
570
580
}
571
581
devicePluginFormerVersionDS := & appsv1.DaemonSet {}
@@ -577,14 +587,14 @@ var _ = Describe("GarbageCollect", func() {
577
587
if devicePluginFormerLabel {
578
588
devicePluginFormerVersionDS = devicePluginDS .DeepCopy ()
579
589
devicePluginFormerVersionDS .SetName ("devicePluginFormer" )
580
- devicePluginFormerVersionDS .Labels [versionLabel ] = "former label"
590
+ devicePluginFormerVersionDS .Labels [devicePluginVersionLabel ] = "former label"
581
591
devicePluginFormerVersionDS .Status .DesiredNumberScheduled = int32 (devicePluginFormerDesired )
582
592
existingDS = append (existingDS , * devicePluginFormerVersionDS )
583
593
}
584
594
if moduleLoaderFormerLabel {
585
595
moduleLoaderFormerVersionDS = moduleLoaderDS .DeepCopy ()
586
596
moduleLoaderFormerVersionDS .SetName ("moduleLoaderFormer" )
587
- moduleLoaderFormerVersionDS .Labels [versionLabel ] = "former label"
597
+ moduleLoaderFormerVersionDS .Labels [moduleLoaderVersionLabel ] = "former label"
588
598
moduleLoaderFormerVersionDS .Status .DesiredNumberScheduled = int32 (moduleLoaderFormerDesired )
589
599
existingDS = append (existingDS , * moduleLoaderFormerVersionDS )
590
600
}
@@ -627,7 +637,7 @@ var _ = Describe("GarbageCollect", func() {
627
637
ObjectMeta : metav1.ObjectMeta {
628
638
Name : "moduleLoader" ,
629
639
Namespace : "namespace" ,
630
- Labels : map [string ]string {kernelLabel : notLegitKernelVersion , constants .DaemonSetRole : moduleLoaderRoleLabelValue , versionLabel : currentModuleVersion },
640
+ Labels : map [string ]string {kernelLabel : notLegitKernelVersion , constants .DaemonSetRole : moduleLoaderRoleLabelValue , moduleLoaderVersionLabel : currentModuleVersion },
631
641
},
632
642
}
633
643
clnt .EXPECT ().Delete (context .Background (), & deleteDS ).Return (fmt .Errorf ("some error" ))
@@ -637,7 +647,7 @@ var _ = Describe("GarbageCollect", func() {
637
647
_ , err := dc .GarbageCollect (context .Background (), mod , existingDS , sets.New [string ](legitKernelVersion ))
638
648
Expect (err ).To (HaveOccurred ())
639
649
640
- deleteDS .Labels [versionLabel ] = "former label"
650
+ deleteDS .Labels [moduleLoaderVersionLabel ] = "former label"
641
651
clnt .EXPECT ().Delete (context .Background (), & deleteDS ).Return (fmt .Errorf ("some error" ))
642
652
643
653
existingDS = []appsv1.DaemonSet {deleteDS }
0 commit comments