diff --git a/pkg/keystone/bootstrap.go b/pkg/keystone/bootstrap.go index 381bdfde..ae99440d 100644 --- a/pkg/keystone/bootstrap.go +++ b/pkg/keystone/bootstrap.go @@ -117,7 +117,7 @@ func BootstrapJob( } job.Spec.Template.Spec.Containers[0].Env = env.MergeEnvs(job.Spec.Template.Spec.Containers[0].Env, envVars) - 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/keystone/cronjob.go b/pkg/keystone/cronjob.go index 778e4a28..7036bac6 100644 --- a/pkg/keystone/cronjob.go +++ b/pkg/keystone/cronjob.go @@ -98,7 +98,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 } return cronjob diff --git a/pkg/keystone/dbsync.go b/pkg/keystone/dbsync.go index 0bd562a9..cacfbb79 100644 --- a/pkg/keystone/dbsync.go +++ b/pkg/keystone/dbsync.go @@ -90,7 +90,7 @@ func DbSyncJob( }, } - 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/keystone/deployment.go b/pkg/keystone/deployment.go index 37cec1d1..c5fdecfd 100644 --- a/pkg/keystone/deployment.go +++ b/pkg/keystone/deployment.go @@ -158,8 +158,10 @@ func Deployment( }, corev1.LabelHostname, ) - if instance.Spec.NodeSelector != nil && len(*instance.Spec.NodeSelector) > 0 { + + if instance.Spec.NodeSelector != nil { deployment.Spec.Template.Spec.NodeSelector = *instance.Spec.NodeSelector } + return deployment, nil }