-
Notifications
You must be signed in to change notification settings - Fork 1.5k
installconfig: separate control plane and compute machine pools #1157
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
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) | ||
|
||
| 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 | ||
|
||
| } | ||
| } | ||
| 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"` | ||
|
||
|
|
||
| // 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". | ||
|
||
| // For the compute machine pools, the only valid name is "worker". | ||
|
||
| 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.