Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit 8fbfee2

Browse files
author
Nikolas De Giorgis
authored
Fixed merging of host aliases (#321)
1 parent 576cf8b commit 8fbfee2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/util/merge/merge_podtemplate_spec.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package merge
22

33
import (
4+
"sort"
5+
46
"github.com/mongodb/mongodb-kubernetes-operator/pkg/util/contains"
57
corev1 "k8s.io/api/core/v1"
68
)
@@ -208,6 +210,10 @@ func HostAliases(originalAliases, overrideAliases []corev1.HostAlias) []corev1.H
208210
mergedHostAliases = append(mergedHostAliases, v)
209211
}
210212

213+
sort.SliceStable(mergedHostAliases, func(i, j int) bool {
214+
return mergedHostAliases[i].IP < mergedHostAliases[j].IP
215+
})
216+
211217
return mergedHostAliases
212218
}
213219

0 commit comments

Comments
 (0)