Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sort custom resources by metadata.name #988

Merged
merged 1 commit into from
Nov 14, 2023
Merged
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
12 changes: 11 additions & 1 deletion apis/fluentd/v1alpha1/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"fmt"
"sort"
"strings"

"github.com/fluent/fluent-operator/v2/apis/fluentd/v1alpha1/plugins"
Expand Down Expand Up @@ -120,7 +121,16 @@ func (pgr *PluginResources) PatchAndFilterClusterLevelResources(
cfgResources := NewCfgResources()

errs := make([]string, 0)

// sort all the CRs by metadata.name
sort.SliceStable(clusterInputs[:], func(i, j int) bool {
return clusterInputs[i].Name < clusterInputs[j].Name
})
sort.SliceStable(clusterfilters[:], func(i, j int) bool {
return clusterfilters[i].Name < clusterfilters[j].Name
})
sort.SliceStable(clusteroutputs[:], func(i, j int) bool {
return clusteroutputs[i].Name < clusteroutputs[j].Name
})
// List all inputs matching the label selector.
for _, i := range clusterInputs {
// patch filterId
Expand Down
Loading