diff --git a/pkg/cinder/cronjob.go b/pkg/cinder/cronjob.go index e358cf77..059d72f7 100644 --- a/pkg/cinder/cronjob.go +++ b/pkg/cinder/cronjob.go @@ -135,7 +135,7 @@ func CronJob( }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { cronjob.Spec.JobTemplate.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } diff --git a/pkg/cinder/dbsync.go b/pkg/cinder/dbsync.go index b124324d..351b2820 100644 --- a/pkg/cinder/dbsync.go +++ b/pkg/cinder/dbsync.go @@ -115,7 +115,7 @@ func DbSyncJob(instance *cinderv1beta1.Cinder, labels map[string]string, annotat }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { job.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } diff --git a/pkg/cinderapi/statefuleset.go b/pkg/cinderapi/statefuleset.go index 69554b0d..05c9e6c1 100644 --- a/pkg/cinderapi/statefuleset.go +++ b/pkg/cinderapi/statefuleset.go @@ -172,7 +172,7 @@ func StatefulSet( }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { statefulset.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } diff --git a/pkg/cinderbackup/statefulset.go b/pkg/cinderbackup/statefulset.go index aca221d2..95a9eb52 100644 --- a/pkg/cinderbackup/statefulset.go +++ b/pkg/cinderbackup/statefulset.go @@ -153,7 +153,7 @@ func StatefulSet( }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { statefulset.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } diff --git a/pkg/cinderscheduler/statefulset.go b/pkg/cinderscheduler/statefulset.go index 16c9c43a..b5851873 100644 --- a/pkg/cinderscheduler/statefulset.go +++ b/pkg/cinderscheduler/statefulset.go @@ -138,7 +138,7 @@ func StatefulSet( }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { statefulset.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } diff --git a/pkg/cindervolume/statefulset.go b/pkg/cindervolume/statefulset.go index 5f08bef3..e939488c 100644 --- a/pkg/cindervolume/statefulset.go +++ b/pkg/cindervolume/statefulset.go @@ -160,7 +160,7 @@ func StatefulSet( }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { statefulset.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector }