fix: produce stable order of bonds with equinix

Fixes the problem when bonds can be listed in random order.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
This commit is contained in:
Andrey Smirnov 2024-05-24 17:47:03 +04:00
parent 6406193f46
commit 8a1371337f
No known key found for this signature in database
GPG Key ID: FE042E3D4085A811

View File

@ -14,10 +14,12 @@ import (
"log"
"net/http"
"net/netip"
"slices"
"time"
"github.com/cosi-project/runtime/pkg/safe"
"github.com/cosi-project/runtime/pkg/state"
"github.com/siderolabs/gen/maps"
"github.com/siderolabs/go-procfs/procfs"
"github.com/siderolabs/go-retry/retry"
@ -203,7 +205,10 @@ func (p *EquinixMetal) ParseMetadata(ctx context.Context, equinixMetadata *Metad
}
}
for bondName := range bondSlaveIndexes {
bondNames := maps.Keys(bondSlaveIndexes)
slices.Sort(bondNames)
for _, bondName := range bondNames {
bondLink := network.LinkSpecSpec{
ConfigLayer: network.ConfigPlatform,
Name: bondName,