Skip to content

Bug: SliceGateway reconciler returns err (which is nil) for NONET slices, masking the intentΒ #474

Description

@mdryaan

πŸ“œ Description

controllers/slicegateway/reconciler.go lines 134–138:

if slice.Status.SliceConfig != nil &&
    slice.Status.SliceConfig.SliceOverlayNetworkDeploymentMode == v1alpha1.NONET {
    log.Info("No communication slice. Skipping slicegw reconcilation")
    return ctrl.Result{}, err  // err is nil here but variable reuse is confusing
}

err at this point holds the result from controllers.GetSlice (line 122), which is nil if the slice was found. While this works correctly, using err in the return obscures that this is an intentional early exit with no error. Future readers may not trace back to verify err is nil, and a refactor that moves this block could silently break.

πŸ‘Ÿ Reproduction steps

Read controllers/slicegateway/reconciler.go lines 122–138.

πŸ‘ Expected behavior

return ctrl.Result{}, nil to make the intent explicit.

πŸ‘Ž Actual Behavior

return ctrl.Result{}, err where err happens to be nil but is not obviously so.

🐚 Relevant log output

Version

No response

πŸ–₯️ What operating system are you seeing the problem on?

No response

βœ… Proposed Solution

Replace return ctrl.Result{}, err with return ctrl.Result{}, nil.

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find any similar issue

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions