Skip to content

Commit

Permalink
Pass-through empty nodeSelector to podSpecs
Browse files Browse the repository at this point in the history
There is no need drop empty nodeSelector maps, omitempty already does this
  • Loading branch information
olliewalsh committed Nov 19, 2024
1 parent 62c0ff0 commit 0fd9df2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/cinder/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cinder/dbsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cinderapi/statefuleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cinderbackup/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cinderscheduler/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cindervolume/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 0fd9df2

Please sign in to comment.