diff --git a/pkg/asset/machines/clusterapi.go b/pkg/asset/machines/clusterapi.go index 697ee96327..a82ec071e0 100644 --- a/pkg/asset/machines/clusterapi.go +++ b/pkg/asset/machines/clusterapi.go @@ -159,6 +159,9 @@ func (c *ClusterAPI) Generate(ctx context.Context, dependencies asset.Parents) e if err != nil { logrus.Warn(errors.Wrap(err, "failed to filter zone list")) } + // Sort the zones by lexical order to ensure CAPI and MAPI machines + // are distributed to zones in the same order. + slices.Sort(mpool.Zones) } tags, err := aws.CapaTagsFromUserTags(clusterID.InfraID, installConfig.Config.Platform.AWS.UserTags) diff --git a/pkg/asset/machines/master.go b/pkg/asset/machines/master.go index d27f0c1c7b..d7fc2d58ec 100644 --- a/pkg/asset/machines/master.go +++ b/pkg/asset/machines/master.go @@ -253,6 +253,9 @@ func (m *Master) Generate(ctx context.Context, dependencies asset.Parents) error if err != nil { logrus.Warn(errors.Wrap(err, "failed to filter zone list")) } + // Sort the zones by lexical order to ensure CAPI and MAPI machines + // are distributed to zones in the same order. + slices.Sort(mpool.Zones) } pool.Platform.AWS = &mpool