From e4c1ba679d225c9b96bf29e7d8f4f4fc105f7d0b Mon Sep 17 00:00:00 2001 From: Oliver Walsh Date: Mon, 18 Nov 2024 16:16:31 +0000 Subject: [PATCH] Pass-through empty nodeSelector to podSpecs There is no need drop empty nodeSelector maps, omitempty already does this --- pkg/placement/dbsync.go | 2 +- pkg/placement/deployment.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/placement/dbsync.go b/pkg/placement/dbsync.go index 8de09fa..667b1fc 100644 --- a/pkg/placement/dbsync.go +++ b/pkg/placement/dbsync.go @@ -83,7 +83,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/placement/deployment.go b/pkg/placement/deployment.go index e839b56..179b001 100644 --- a/pkg/placement/deployment.go +++ b/pkg/placement/deployment.go @@ -174,7 +174,7 @@ 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 }