Skip to content

Commit

Permalink
Sort nicMappings to have consistent data for ObjectHash
Browse files Browse the repository at this point in the history
Currently the nicMappings data passed to the job spec
is not ordered and leads to different Object Hash
calculated and causes ovn-config job to be retriggered
and with higher number of nicMappings the job could
get triggered indefinitely.
Passing the ordered list fixes the issue.

Closes-Issue: OSPRH-7480
  • Loading branch information
karelyatin committed Jun 10, 2024
1 parent 2847b4c commit 749bc3b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/ovncontroller/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package ovncontroller
import (
"context"
"fmt"
"sort"
"strings"

"github.com/openstack-k8s-operators/lib-common/modules/common/env"
Expand All @@ -31,9 +32,10 @@ func getPhysicalNetworks(
// the same name as "br-<physical network>"
// NOTE(slaweq): interface names aren't important as inside Pod they will be
// named based on the NicMappings keys
return strings.Join(
maps.Keys(instance.Spec.NicMappings), " ",
)
// Need to pass sorted data as Map is unordered
nicMappings := maps.Keys(instance.Spec.NicMappings)
sort.Strings(nicMappings)
return strings.Join(nicMappings, " ")
}

func getOVNControllerPods(
Expand Down

0 comments on commit 749bc3b

Please sign in to comment.