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 authored and openshift-merge-bot[bot] committed Nov 22, 2024
1 parent 41c0e0a commit e2caf72
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/nova/celldelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

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

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

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

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

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

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

Expand Down
5 changes: 1 addition & 4 deletions pkg/novaconductor/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion pkg/novncproxy/deployment.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

0 comments on commit e2caf72

Please sign in to comment.