Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow settting vCenter cluster per Machine Pool #2519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions apis/hive/v1/vsphere/machinepools.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ type MachinePool struct {
// +optional
ResourcePool string `json:"resourcePool,omitempty"`

// Cluster is the name of the cluster virtual machines will be cloned into.
// If it is not present, the value in the ClusterDeployment will be used.
// +optional
Cluster string `json:"cluster,omitempty"`

// NumCPUs is the total number of virtual processor cores to assign a vm.
NumCPUs int32 `json:"cpus"`

Expand Down
7 changes: 6 additions & 1 deletion pkg/controller/machinepool/vsphereactuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ func (a *VSphereActuator) GenerateMachineSets(cd *hivev1.ClusterDeployment, pool
},
}

vCenterCluster := cd.Spec.Platform.VSphere.Cluster
if pool.Spec.Platform.VSphere.Cluster != "" {
vCenterCluster = pool.Spec.Platform.VSphere.Cluster
}

// Fake an install config as we do with other actuators. We only populate what we know is needed today.
// WARNING: changes to use more of installconfig in the MachineSets function can break here. Hopefully
// will be caught by unit tests.
Expand All @@ -89,7 +94,7 @@ func (a *VSphereActuator) GenerateMachineSets(cd *hivev1.ClusterDeployment, pool
Datacenter: cd.Spec.Platform.VSphere.Datacenter,
Datastore: setDatastorePath(cd.Spec.Platform.VSphere.DefaultDatastore, cd.Spec.Platform.VSphere.Datacenter, logger),
Folder: setFolderPath(cd.Spec.Platform.VSphere.Folder, cd.Spec.Platform.VSphere.Datacenter, logger),
ComputeCluster: setComputeClusterPath(cd.Spec.Platform.VSphere.Cluster, cd.Spec.Platform.VSphere.Datacenter, logger),
ComputeCluster: setComputeClusterPath(vCenterCluster, cd.Spec.Platform.VSphere.Datacenter, logger),
Networks: []string{cd.Spec.Platform.VSphere.Network},
Template: a.osImage,
ResourcePool: pool.Spec.Platform.VSphere.ResourcePool,
Expand Down