diff --git a/pkg/nova/celldelete.go b/pkg/nova/celldelete.go index dd8fbcf52..c6033ee23 100644 --- a/pkg/nova/celldelete.go +++ b/pkg/nova/celldelete.go @@ -82,7 +82,7 @@ func CellDeleteJob( }, } - if cell.Spec.NodeSelector != nil && len(*cell.Spec.NodeSelector) > 0 { + if cell.Spec.NodeSelector != nil { job.Spec.Template.Spec.NodeSelector = *cell.Spec.NodeSelector } diff --git a/pkg/nova/cellmapping.go b/pkg/nova/cellmapping.go index 222ef15b8..e5349e401 100644 --- a/pkg/nova/cellmapping.go +++ b/pkg/nova/cellmapping.go @@ -82,7 +82,7 @@ func CellMappingJob( }, } - if cell.Spec.NodeSelector != nil && len(*cell.Spec.NodeSelector) > 0 { + if cell.Spec.NodeSelector != nil { job.Spec.Template.Spec.NodeSelector = *cell.Spec.NodeSelector } diff --git a/pkg/nova/host_discover.go b/pkg/nova/host_discover.go index 05d9247ff..471316a24 100644 --- a/pkg/nova/host_discover.go +++ b/pkg/nova/host_discover.go @@ -94,7 +94,7 @@ func HostDiscoveryJob( }, } - 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/novaapi/deployment.go b/pkg/novaapi/deployment.go index 7c990280e..ef2e293fd 100644 --- a/pkg/novaapi/deployment.go +++ b/pkg/novaapi/deployment.go @@ -197,7 +197,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/novacompute/deployment.go b/pkg/novacompute/deployment.go index 57a8a478e..2f176ba90 100644 --- a/pkg/novacompute/deployment.go +++ b/pkg/novacompute/deployment.go @@ -137,7 +137,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/novaconductor/dbpurge.go b/pkg/novaconductor/dbpurge.go index c025102d5..6c84947c5 100644 --- a/pkg/novaconductor/dbpurge.go +++ b/pkg/novaconductor/dbpurge.go @@ -95,7 +95,7 @@ func DBPurgeCronJob( }, } - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + if instance.Spec.NodeSelector != nil { cron.Spec.JobTemplate.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } diff --git a/pkg/novaconductor/dbsync.go b/pkg/novaconductor/dbsync.go index 5d169aa9e..63070a13f 100644 --- a/pkg/novaconductor/dbsync.go +++ b/pkg/novaconductor/dbsync.go @@ -94,7 +94,7 @@ func CellDBSyncJob( }, } - 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/novaconductor/deployment.go b/pkg/novaconductor/deployment.go index eb762e53e..3eedd0785 100644 --- a/pkg/novaconductor/deployment.go +++ b/pkg/novaconductor/deployment.go @@ -67,8 +67,6 @@ func StatefulSet( }, } - nodeSelector := map[string]string{} - envVars := map[string]env.Setter{} envVars["KOLLA_CONFIG_STRATEGY"] = env.SetValue("COPY_ALWAYS") // NOTE(gibi): The statefulset does not use this hash directly. We store it @@ -130,7 +128,6 @@ func StatefulSet( LivenessProbe: livenessProbe, }, }, - NodeSelector: nodeSelector, // If possible two pods of the same service should not // run on the same worker node. If this is not possible // the get still created on the same worker node. @@ -146,7 +143,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/novametadata/deployment.go b/pkg/novametadata/deployment.go index 9b1795d82..29d91e0d7 100644 --- a/pkg/novametadata/deployment.go +++ b/pkg/novametadata/deployment.go @@ -185,7 +185,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/novascheduler/deployment.go b/pkg/novascheduler/deployment.go index 0278b06bb..9a66cbea1 100644 --- a/pkg/novascheduler/deployment.go +++ b/pkg/novascheduler/deployment.go @@ -148,7 +148,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/novncproxy/deployment.go b/pkg/novncproxy/deployment.go index 1b8447997..a12f89591 100644 --- a/pkg/novncproxy/deployment.go +++ b/pkg/novncproxy/deployment.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 }