Skip to content

Commit ccf78c6

Browse files
dhaiducekopenshift-merge-bot[bot]
authored andcommitted
Make MatchExpressions deterministic
Signed-off-by: Dale Haiducek <[email protected]>
1 parent 5037fb4 commit ccf78c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/plugin.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,11 @@ func (p *Plugin) generateSelector(
17031703
resolvedSelectorsLS.MatchExpressions = append(resolvedSelectorsLS.MatchExpressions, lsReq)
17041704
}
17051705

1706+
// Sort the MatchExpressions to make the result deterministic
1707+
sort.Slice(resolvedSelectorsLS.MatchExpressions, func(i, j int) bool {
1708+
return resolvedSelectorsLS.MatchExpressions[i].Key < resolvedSelectorsLS.MatchExpressions[j].Key
1709+
})
1710+
17061711
resolved, err := runtime.DefaultUnstructuredConverter.ToUnstructured(&resolvedSelectorsLS)
17071712
if err != nil {
17081713
panic(err)

0 commit comments

Comments
 (0)