Skip to content

Commit

Permalink
Merge pull request #41 from almaslennikov/update-empty-spec-condition
Browse files Browse the repository at this point in the history
fix: update device's status accordingly if spec becomes empty
  • Loading branch information
almaslennikov authored Nov 8, 2024
2 parents e278e46 + 3a5c567 commit de7d739
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/controller/nicdevice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ func (r *NicDeviceReconciler) getDevices(ctx context.Context) (nicDeviceConfigur

for i, device := range devices.Items {
if device.Spec.Configuration == nil {
statusCondition := meta.FindStatusCondition(device.Status.Conditions, consts.ConfigUpdateInProgressCondition)
if statusCondition.Reason != consts.DeviceConfigSpecEmptyReason {
err = r.updateDeviceStatusCondition(ctx, &device, consts.DeviceConfigSpecEmptyReason, metav1.ConditionFalse, "")
if err != nil {
log.Log.Error(err, "failed to update status condition", "device", device.Name)
return nil, err
}
}
continue
}

Expand Down

0 comments on commit de7d739

Please sign in to comment.