-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
installconfig: separate control plane and compute machine pools #1157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error { | |
} | ||
|
||
ic := installconfig.Config | ||
pool := workerPool(ic.Machines) | ||
pool := workerPool(ic.Compute) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be: for _, pool := range ic.Compute { couldn't it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ultimately, yes. But baby steps. And the validator only accepts a single compute machine pool named "worker" at the moment anyway. |
||
switch ic.Platform.Name() { | ||
case awstypes.Name: | ||
mpool := defaultAWSMachinePoolPlatform() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ import ( | |
libvirtdefaults "github.com/openshift/installer/pkg/types/libvirt/defaults" | ||
nonedefaults "github.com/openshift/installer/pkg/types/none/defaults" | ||
openstackdefaults "github.com/openshift/installer/pkg/types/openstack/defaults" | ||
"k8s.io/utils/pointer" | ||
) | ||
|
||
var ( | ||
|
@@ -43,39 +42,27 @@ func SetInstallConfigDefaults(c *types.InstallConfig) { | |
}, | ||
} | ||
} | ||
numberOfMasters := int64(3) | ||
numberOfWorkers := int64(3) | ||
defaultReplicaCount := int64(3) | ||
if c.Platform.Libvirt != nil { | ||
numberOfMasters = 1 | ||
numberOfWorkers = 1 | ||
defaultReplicaCount = 1 | ||
} | ||
if len(c.Machines) == 0 { | ||
c.Machines = []types.MachinePool{ | ||
{ | ||
Name: "master", | ||
Replicas: &numberOfMasters, | ||
}, | ||
if c.ControlPlane == nil { | ||
c.ControlPlane = &types.MachinePool{ | ||
Replicas: &defaultReplicaCount, | ||
} | ||
} | ||
c.ControlPlane.Name = "master" | ||
if len(c.Compute) == 0 { | ||
c.Compute = []types.MachinePool{ | ||
{ | ||
Name: "worker", | ||
Replicas: &numberOfWorkers, | ||
Replicas: &defaultReplicaCount, | ||
}, | ||
} | ||
} else { | ||
for i := range c.Machines { | ||
switch c.Machines[i].Name { | ||
case "master": | ||
if c.Machines[i].Replicas == nil { | ||
c.Machines[i].Replicas = &numberOfMasters | ||
} | ||
case "worker": | ||
if c.Machines[i].Replicas == nil { | ||
c.Machines[i].Replicas = &numberOfWorkers | ||
} | ||
default: | ||
if c.Machines[i].Replicas == nil { | ||
c.Machines[i].Replicas = pointer.Int64Ptr(0) | ||
} | ||
} | ||
} | ||
for i, p := range c.Compute { | ||
if p.Replicas == nil { | ||
c.Compute[i].Replicas = &defaultReplicaCount | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to default to 1 (on libvirt) or 3 (elsewhere) for compute pools we don't recognize? I think the previous zero default may be more appropriate as long as at least one compute pool has a non-zero There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment, the only compute machine pool accepted by the validator is "worker". My expectation in the future is that the installer will not care what the name of the compute machine pools are. The installer will not treat the "worker" or "compute" machine pool any different than any other compute machine pool. Do you have different expectations? |
||
} | ||
} | ||
switch { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import ( | |
|
||
const ( | ||
// InstallConfigVersion is the version supported by this package. | ||
InstallConfigVersion = "v1beta2" | ||
InstallConfigVersion = "v1beta3" | ||
) | ||
|
||
var ( | ||
|
@@ -47,11 +47,14 @@ type InstallConfig struct { | |
// Networking defines the pod network provider in the cluster. | ||
*Networking `json:"networking,omitempty"` | ||
|
||
// Machines is the list of MachinePools that need to be installed. | ||
// ControlPlane is the configuration for the machines that comprise the | ||
// control plane. | ||
// +optional | ||
// Default on AWS and OpenStack is 3 masters and 3 workers. | ||
// Default on Libvirt is 1 master and 1 worker. | ||
Machines []MachinePool `json:"machines,omitempty"` | ||
ControlPlane *MachinePool `json:"controlPlane,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to bump There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't sure whether the version needed to be bumped with every change. Or whether the version change covered the collections of API changes between beta1 and beta2. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cut 0.12.0 with v1beta2, so I think we need another bump. But I'm fine combining future changes that land between releases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. I will bump up to v1beta3. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this omitempty? and nilable. from the commit message There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the installer can fill in the default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is omitempty and nilable because the user does not have to provide it. If it is omitted, then the installer will add default values to the InstallConfig used. The validator will ensure that the field is not nil in the final InstallConfig. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😕 sure |
||
|
||
// Compute is the list of compute MachinePools that need to be installed. | ||
// +optional | ||
Compute []MachinePool `json:"compute,omitempty"` | ||
|
||
// Platform is the configuration for the specific platform upon which to | ||
// perform the installation. | ||
|
@@ -61,17 +64,6 @@ type InstallConfig struct { | |
PullSecret string `json:"pullSecret"` | ||
} | ||
|
||
// MasterCount returns the number of replicas in the master machine pool, | ||
// defaulting to one if no machine pool was found. | ||
func (c *InstallConfig) MasterCount() int { | ||
for _, m := range c.Machines { | ||
if m.Name == "master" && m.Replicas != nil { | ||
return int(*m.Replicas) | ||
} | ||
} | ||
return 1 | ||
} | ||
|
||
// Platform is the configuration for the specific platform upon which to perform | ||
// the installation. Only one of the platform configuration should be set. | ||
type Platform struct { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import ( | |
// MachinePool is a pool of machines to be installed. | ||
type MachinePool struct { | ||
// Name is the name of the machine pool. | ||
// For the control plane machine pool, the name will always be "master". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we care what they name it? I'm fine leaving this up to the user. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ultimately, we may not care what they name it. For now, (1) the installer does care, or (2) I don't care to rationalize about whether we really do care. As the rest of the changes from master and worker to control plane and compute play out, this restriction may be relaxed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a data point, we had this conversation in hive back when I was on that team. We could not come up with a compelling use case for the user to provide a custom name for the control plane machines. |
||
// For the compute machine pools, the only valid name is "worker". | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to lift this restriction. All we're doing for compute nodes is pushing MachineSets which reference an installer-created worker IAM instance profile, right? We can do that regardless of the name we set in the MachineSet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this restriction will be lifted. This is just the first step in a larger transition that will include that lifted restriction. |
||
Name string `json:"name"` | ||
|
||
// Replicas is the count of machines for this machine pool. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a desire to eliminate the term "master" generally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just asking as that is a broader change to push through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The broader change of replacing the terms master and worker with control-plane and compute are tackled in #1227.