Skip to content

Commit f99e3d5

Browse files
committed
Simplify dependency ready filters to use IsAvailable directly
Since IsAvailable implies Status.ID is set, the redundant check for Status.ID != nil can be removed. Pass orcv1alpha1.IsAvailable directly as the filter function for the ServerGroup and boot Volume dependencies, consistent with the changes made in all other controllers.
1 parent 92dffa5 commit f99e3d5

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

internal/controllers/server/actuator.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,10 @@ func (actuator serverActuator) getSchedulerHints(ctx context.Context, obj *orcv1
162162
reconcileStatus := progress.NewReconcileStatus()
163163

164164
// Resolve ServerGroupRef to server group ID
165-
sg, sgReconcileStatus := dependency.FetchDependency(
165+
sg, sgReconcileStatus := dependency.FetchDependency[*orcv1alpha1.ServerGroup](
166166
ctx, actuator.k8sClient, obj.Namespace,
167167
schedHints.ServerGroupRef, "ServerGroup",
168-
func(sg *orcv1alpha1.ServerGroup) bool {
169-
return orcv1alpha1.IsAvailable(sg) && sg.Status.ID != nil
170-
},
168+
orcv1alpha1.IsAvailable,
171169
)
172170
reconcileStatus = reconcileStatus.WithReconcileStatus(sgReconcileStatus)
173171
if sg.Status.ID != nil {
@@ -274,9 +272,7 @@ func (actuator serverActuator) CreateResource(ctx context.Context, obj *orcv1alp
274272
var blockDevices []servers.BlockDevice
275273
if bootFromVolume {
276274
bootVolume, bvReconcileStatus := bootVolumeDependency.GetDependency(
277-
ctx, actuator.k8sClient, obj, func(volume *orcv1alpha1.Volume) bool {
278-
return orcv1alpha1.IsAvailable(volume) && volume.Status.ID != nil
279-
},
275+
ctx, actuator.k8sClient, obj, orcv1alpha1.IsAvailable,
280276
)
281277
reconcileStatus = reconcileStatus.WithReconcileStatus(bvReconcileStatus)
282278

0 commit comments

Comments
 (0)