Skip to content

Commit

Permalink
fix: removes use of slices.DeleteFunc because it zeros the elements a…
Browse files Browse the repository at this point in the history
…nd doesn't remove those from obj list
  • Loading branch information
faiq committed Nov 4, 2024
1 parent a29c6ce commit dfc6382
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/clusterctl/client/cluster/cert_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package cluster
import (
"context"
_ "embed"
"slices"
"time"

"github.com/blang/semver/v4"
Expand Down Expand Up @@ -346,9 +345,13 @@ func (cm *certManagerClient) shouldUpgrade(desiredVersion string, objs, installO
// removes resources that are generated by the kubernetes API
// this is relevant if the versions are the same, because we compare
// the number of objects when version of objects are equal
objs = slices.DeleteFunc(objs, func(obj unstructured.Unstructured) bool {
return obj.GetKind() == "Endpoints" || obj.GetKind() == "EndpointSlice"
})
newObjs := []unstructured.Unstructured{}
for _, o := range objs {
if !(o.GetKind() == "Endpoints" || o.GetKind() == "EndpointSlice") {
newObjs = append(newObjs, o)
}
}
objs = newObjs
for i := range objs {
obj := objs[i]

Expand Down

0 comments on commit dfc6382

Please sign in to comment.