Skip to content

Commit

Permalink
Do not duplicate the slice with pods
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvoncek committed Nov 29, 2024
1 parent 417b98a commit ca96675
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/medusa/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package medusa

import (
"context"
"errors"

"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
Expand All @@ -21,8 +22,8 @@ func GetCassandraDatacenterPods(ctx context.Context, cassdc *cassdcapi.Cassandra
return nil, err
}

pods := make([]corev1.Pod, 0)
pods = append(pods, podList.Items...)

return pods, nil
if podList.Items != nil {
return podList.Items, nil
}
return nil, errors.New("podList came with nil Items field")
}

0 comments on commit ca96675

Please sign in to comment.