@@ -558,7 +558,7 @@ func softTopologyAndDuplicatesProfile(profileCustomizations *deschedulerv1.Profi
558
558
return profile , err
559
559
}
560
560
561
- func lifecycleAndUtilizationProfile (profileCustomizations * deschedulerv1.ProfileCustomizations , includedNamespaces , excludedNamespaces []string , ignorePVCPods , evictLocalStoragePods bool ) (* v1alpha2.DeschedulerProfile , error ) {
561
+ func lifecycleAndUtilizationProfile (profileCustomizations * deschedulerv1.ProfileCustomizations , includedNamespaces , excludedNamespaces , protectedNamespaces []string , ignorePVCPods , evictLocalStoragePods bool ) (* v1alpha2.DeschedulerProfile , error ) {
562
562
profile := & v1alpha2.DeschedulerProfile {
563
563
Name : string (deschedulerv1 .LifecycleAndUtilization ),
564
564
PluginConfigs : []v1alpha2.PluginConfig {
@@ -630,7 +630,12 @@ func lifecycleAndUtilizationProfile(profileCustomizations *deschedulerv1.Profile
630
630
}
631
631
if len (includedNamespaces ) > 0 {
632
632
// log a warning if user tries to enable ns inclusion with a profile that activates LowNodeUtilization
633
- klog .Warning ("LowNodeUtilization is enabled, however it does not support namespace inclusion. Namespace inclusion will only be considered by other strategies (like RemovePodsHavingTooManyRestarts and PodLifeTime)" )
633
+ klog .Warning ("LowNodeUtilization is enabled, however it does not support namespace inclusion. Namespace inclusion will only be considered by other strategies (like RemovePodsHavingTooManyRestarts and PodLifeTime). Falling back to a list of excluded protected namespaces." )
634
+ if len (excludedNamespaces ) == 0 {
635
+ profile .PluginConfigs [2 ].Args .Object .(* nodeutilization.LowNodeUtilizationArgs ).EvictableNamespaces = & deschedulerapi.Namespaces {
636
+ Exclude : protectedNamespaces ,
637
+ }
638
+ }
634
639
}
635
640
if len (excludedNamespaces ) > 0 {
636
641
profile .PluginConfigs [2 ].Args .Object .(* nodeutilization.LowNodeUtilizationArgs ).EvictableNamespaces = & deschedulerapi.Namespaces {
@@ -703,8 +708,8 @@ func lifecycleAndUtilizationProfile(profileCustomizations *deschedulerv1.Profile
703
708
return profile , nil
704
709
}
705
710
706
- func longLifecycleProfile (profileCustomizations * deschedulerv1.ProfileCustomizations , includedNamespaces , excludedNamespaces []string , ignorePVCPods , evictLocalStoragePods bool ) (* v1alpha2.DeschedulerProfile , error ) {
707
- profile , err := lifecycleAndUtilizationProfile (profileCustomizations , includedNamespaces , excludedNamespaces , ignorePVCPods , evictLocalStoragePods )
711
+ func longLifecycleProfile (profileCustomizations * deschedulerv1.ProfileCustomizations , includedNamespaces , excludedNamespaces , protectedNamespaces []string , ignorePVCPods , evictLocalStoragePods bool ) (* v1alpha2.DeschedulerProfile , error ) {
712
+ profile , err := lifecycleAndUtilizationProfile (profileCustomizations , includedNamespaces , excludedNamespaces , protectedNamespaces , ignorePVCPods , evictLocalStoragePods )
708
713
if err != nil {
709
714
return profile , err
710
715
}
@@ -907,11 +912,11 @@ func (c *TargetConfigReconciler) manageConfigMap(descheduler *deschedulerv1.Kube
907
912
case deschedulerv1 .SoftTopologyAndDuplicates :
908
913
profile , err = softTopologyAndDuplicatesProfile (descheduler .Spec .ProfileCustomizations , includedNamespaces , excludedNamespaces , ignorePVCPods , evictLocalStoragePods )
909
914
case deschedulerv1 .LifecycleAndUtilization :
910
- profile , err = lifecycleAndUtilizationProfile (descheduler .Spec .ProfileCustomizations , includedNamespaces , excludedNamespaces , ignorePVCPods , evictLocalStoragePods )
915
+ profile , err = lifecycleAndUtilizationProfile (descheduler .Spec .ProfileCustomizations , includedNamespaces , excludedNamespaces , c . protectedNamespaces , ignorePVCPods , evictLocalStoragePods )
911
916
case deschedulerv1 .EvictPodsWithLocalStorage , deschedulerv1 .EvictPodsWithPVC :
912
917
continue
913
918
case deschedulerv1 .DevPreviewLongLifecycle , deschedulerv1 .LongLifecycle :
914
- profile , err = longLifecycleProfile (descheduler .Spec .ProfileCustomizations , includedNamespaces , excludedNamespaces , ignorePVCPods , evictLocalStoragePods )
919
+ profile , err = longLifecycleProfile (descheduler .Spec .ProfileCustomizations , includedNamespaces , excludedNamespaces , c . protectedNamespaces , ignorePVCPods , evictLocalStoragePods )
915
920
case deschedulerv1 .CompactAndScale :
916
921
profile , err = compactAndScaleProfile (descheduler .Spec .ProfileCustomizations , includedNamespaces , excludedNamespaces , ignorePVCPods , evictLocalStoragePods )
917
922
default :
0 commit comments