Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkg/asset/machines/openstack/machinesets.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/ptr"

clusterapi "github.com/openshift/api/machine/v1beta1"
"github.com/openshift/installer/pkg/types"
Expand All @@ -32,16 +33,21 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach
}
mpool := pool.Platform.OpenStack

// In installer CLI code paths, the replica number is set to 3 by default
// when install-config does not have any Compute machine-pool, or when the
// Compute machine-pool does not have the `replicas` property.
// However, external consumers of this func may not be so kind...
if pool.Replicas == nil {
pool.Replicas = ptr.To[int64](0)
}

failureDomains := failureDomainsFromSpec(*mpool)
numberOfFailureDomains := int64(len(failureDomains))

machinesets := make([]*clusterapi.MachineSet, len(failureDomains))
for idx := range machinesets {
var replicaNumber int32
{
// The replica number is set to 3 by default when install-config does not have
// any Compute machine-pool, or when the Compute machine-pool does not have the
// `replicas` property. As a consequence, pool.Replicas is never nil
replicas := *pool.Replicas / numberOfFailureDomains
if int64(idx) < *pool.Replicas%numberOfFailureDomains {
replicas++
Expand Down