Skip to content

Commit 51856cd

Browse files
authored
Try to ensure ordering of referenced source CMs, by name... (#1264)
Signed-off-by: Matthias Wessendorf <[email protected]>
1 parent 4f9600f commit 51856cd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/eventingtls/trust_bundle.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,18 @@ func CombinedBundlePresent(trustBundleLister corev1listers.ConfigMapLister) (boo
212212
return combinedBundle.Len() > 0, nil
213213
}
214214

215+
// AddTrustBundleVolumes adds the trust bundle volumes to the given PodSpec.
215216
func AddTrustBundleVolumes(trustBundleLister corev1listers.ConfigMapLister, obj kmeta.Accessor, pt *corev1.PodSpec) (*corev1.PodSpec, error) {
216217
cms, err := trustBundleLister.ConfigMaps(obj.GetNamespace()).List(TrustBundleSelector)
217218
if err != nil {
218219
return nil, fmt.Errorf("failed to list trust bundles ConfigMaps in %q: %w", obj.GetNamespace(), err)
219220
}
220221

222+
// Sort ConfigMaps by name to ensure consistent ordering
223+
sort.SliceStable(cms, func(i, j int) bool {
224+
return cms[i].Name < cms[j].Name
225+
})
226+
221227
pt = pt.DeepCopy()
222228
sources := make([]corev1.VolumeProjection, 0, len(cms))
223229
for _, cm := range cms {

0 commit comments

Comments
 (0)