Skip to content

Commit

Permalink
Merge pull request #27 from adyanth/bug-26
Browse files Browse the repository at this point in the history
🐛 Sort the service list slice
  • Loading branch information
adyanth authored Feb 25, 2022
2 parents 93eeb6a + 9728464 commit b846cb1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/service_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"crypto/md5"
"encoding/hex"
"fmt"
"sort"
"strings"

networkingv1alpha1 "github.com/adyanth/cloudflare-operator/api/v1alpha1"
Expand Down Expand Up @@ -320,6 +321,10 @@ func (r *ServiceReconciler) getRelevantServices() ([]corev1.Service, error) {
r.log.Info("No services found, tunnel not in use", "listOpts", listOpts)
}

sort.Slice(serviceList.Items, func(i, j int) bool {
return serviceList.Items[i].Name < serviceList.Items[j].Name
})

return serviceList.Items, nil
}

Expand Down

0 comments on commit b846cb1

Please sign in to comment.