Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions slice/internal/controller/workload_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ func (r *WorkloadReconciler) findWorkloadSlices(ctx context.Context, wl *kueue.W
}

type groupedSlices struct {
deleted []v1beta1.Slice
toDelete []v1beta1.Slice
initializing []v1beta1.Slice
active []v1beta1.Slice
deleted []*v1beta1.Slice
toDelete []*v1beta1.Slice
initializing []*v1beta1.Slice
active []*v1beta1.Slice
}

// groupSlices categorizes a list of Slice objects into four groups based on their state.
Expand All @@ -347,8 +347,9 @@ type groupedSlices struct {
// A groupedSlices struct containing categorized slices.
func (r *WorkloadReconciler) groupSlices(slices []v1beta1.Slice) groupedSlices {
gs := groupedSlices{}
for _, slice := range slices {
switch core.GetSliceState(slice, r.activationTimeout) {
for i := range slices {
slice := &slices[i]
switch core.GetSliceState(*slice, r.activationTimeout) {
case core.SliceStateDeleted:
gs.deleted = append(gs.deleted, slice)
case core.SliceStateFailed, core.SliceStateStale:
Expand All @@ -362,12 +363,12 @@ func (r *WorkloadReconciler) groupSlices(slices []v1beta1.Slice) groupedSlices {
return gs
}

func (r *WorkloadReconciler) deleteSlices(ctx context.Context, slices []v1beta1.Slice) error {
func (r *WorkloadReconciler) deleteSlices(ctx context.Context, slices []*v1beta1.Slice) error {
log := ctrl.LoggerFrom(ctx)
for _, slice := range slices {
log = log.WithValues("slice", klog.KObj(&slice))
log = log.WithValues("slice", klog.KObj(slice))
Comment on lines -368 to +369
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this is any different?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another place where we were passing the []slice, and now pass []*slice?

Copy link
Collaborator Author

@pajakd pajakd Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, exactly. In the lines displaying log "Waiting for Slices to be initialized" (or "Deleting Slices" or "Waiting for deleted Slices to be cleaned up") are calling klog.KObjSlice(grouped.initializing), but since grouped.initializing contained Slices (and not *Slices) it was displaying an error message "KObjSlice needs a slice of values implementing KMetadata, got type v1beta1.Slice" instead of anything useful.

I think it makes more sense to just change groupedSlices to be a struct of pointer slices.

log.V(3).Info("Deleting the Slice")
err := r.client.Delete(ctx, &slice)
err := r.client.Delete(ctx, slice)
if client.IgnoreNotFound(err) != nil {
log.Error(err, "Failed to delete the Slice")
return err
Expand Down
Loading