Skip to content

Commit 5872931

Browse files
committed
[WIP] Initial work to make split control plane work.
Got the IG creation working. Kubelet is coming up on the etcd IG. Currently having issues with getting the etcd to attach to peers.
1 parent 83dc088 commit 5872931

41 files changed

Lines changed: 1262 additions & 145 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/kops/create_cluster.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
193193
sshPublicKey := ""
194194
associatePublicIP := false
195195
encryptEtcdStorage := false
196+
var controlPlaneCount int32
196197

197198
cmd := &cobra.Command{
198199
Use: "cluster [CLUSTER]",
@@ -212,6 +213,10 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
212213
options.EncryptEtcdStorage = &encryptEtcdStorage
213214
}
214215

216+
if cmd.Flag("control-plane-count").Changed || cmd.Flag("master-count").Changed {
217+
options.ControlPlaneCount = &controlPlaneCount
218+
}
219+
215220
if err := checkProjectFlag(cmd.Flag("project").Changed, options.Project); err != nil {
216221
return err
217222
}
@@ -295,9 +300,9 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
295300
return []string{"pub"}, cobra.ShellCompDirectiveFilterFileExt
296301
})
297302

298-
cmd.Flags().Int32Var(&options.ControlPlaneCount, "master-count", options.ControlPlaneCount, "Number of control-plane nodes. Defaults to one control-plane node per control-plane-zone")
303+
cmd.Flags().Int32Var(&controlPlaneCount, "master-count", controlPlaneCount, "Number of control-plane nodes. Defaults to one control-plane node per control-plane-zone")
299304
cmd.Flags().MarkDeprecated("master-count", "use --control-plane-count instead")
300-
cmd.Flags().Int32Var(&options.ControlPlaneCount, "control-plane-count", options.ControlPlaneCount, "Number of control-plane nodes. Defaults to one control-plane node per control-plane-zone")
305+
cmd.Flags().Int32Var(&controlPlaneCount, "control-plane-count", controlPlaneCount, "Number of control-plane nodes. Defaults to one control-plane node per control-plane-zone")
301306
cmd.Flags().Int32Var(&options.NodeCount, "node-count", options.NodeCount, "Total number of worker nodes. Defaults to one node per zone")
302307
if featureflag.APIServerNodes.Enabled() {
303308
cmd.Flags().Int32Var(&options.APIServerCount, "api-server-count", options.APIServerCount, "Number of API server nodes. Defaults to 0.")

cmd/kops/create_cluster_integration_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,10 @@ func runCreateClusterIntegrationTest(t *testing.T, srcDir string, version string
376376
actualYAML := strings.Join(yamlAll, "\n\n---\n\n")
377377
golden.AssertMatchesFile(t, actualYAML, path.Join(srcDir, expectedClusterPath))
378378
}
379+
380+
// TestCreateClusterExperimentalRoles tests kops create cluster with ExperimentalRoles and control-plane-count=0
381+
func TestCreateClusterExperimentalRoles(t *testing.T) {
382+
featureflag.ParseFlags("+APIServerNodes,+ExperimentalRoles")
383+
defer featureflag.ParseFlags("-APIServerNodes,-ExperimentalRoles")
384+
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/experimental-roles", "v1alpha2")
385+
}

cmd/kops/create_instancegroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
142142
if r.HasCloudControllerManager() {
143143
continue
144144
}
145-
if r.HasKubControllerManager() {
145+
if r.HasKubeControllerManager() {
146146
continue
147147
}
148148
}

nodeup/pkg/model/bootstrap_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type BootstrapClientBuilder struct {
4545
}
4646

4747
func (b BootstrapClientBuilder) Build(c *fi.NodeupModelBuilderContext) error {
48-
if b.IsMaster {
48+
if b.IsMaster || b.BootConfig.InstanceGroupRole.IsControlPlaneType() {
4949
return nil
5050
}
5151

nodeup/pkg/model/channels.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type ChannelsBuilder struct {
4646
var _ fi.NodeupModelBuilder = &ChannelsBuilder{}
4747

4848
func (b *ChannelsBuilder) Build(c *fi.NodeupModelBuilderContext) error {
49-
if !b.IsMaster {
49+
if !b.IsMaster && !b.HasAPIServer {
5050
return nil
5151
}
5252

nodeup/pkg/model/discovery_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var _ fi.NodeupModelBuilder = &DiscoveryService{}
4242
func (b *DiscoveryService) Build(c *fi.NodeupModelBuilderContext) error {
4343
ctx := c.Context()
4444

45-
if !b.IsMaster {
45+
if !b.IsMaster && !b.HasAPIServer {
4646
return nil
4747
}
4848
discoveryServiceOptions := b.DiscoveryServiceOptions()

nodeup/pkg/model/etcd_manager_tls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var _ fi.NodeupModelBuilder = &EtcdManagerTLSBuilder{}
3232

3333
// Build is responsible for TLS configuration for etcd-manager
3434
func (b *EtcdManagerTLSBuilder) Build(ctx *fi.NodeupModelBuilderContext) error {
35-
if !b.IsMaster {
35+
if !b.IsMaster && !b.BootConfig.InstanceGroupRole.HasEtcd() {
3636
return nil
3737
}
3838

nodeup/pkg/model/kops_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var _ fi.NodeupModelBuilder = &KopsControllerBuilder{}
3434

3535
// Build is responsible for configuring keys that will be used by kops-controller (via hostPath)
3636
func (b *KopsControllerBuilder) Build(c *fi.NodeupModelBuilderContext) error {
37-
if !b.IsMaster {
37+
if !b.IsMaster && !b.HasAPIServer {
3838
return nil
3939
}
4040

nodeup/pkg/model/kube_controller_manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var _ fi.NodeupModelBuilder = &KubeControllerManagerBuilder{}
4646

4747
// Build is responsible for configuring the kube-controller-manager
4848
func (b *KubeControllerManagerBuilder) Build(c *fi.NodeupModelBuilderContext) error {
49-
if !b.IsMaster {
49+
if !b.IsMaster && !b.BootConfig.InstanceGroupRole.HasKubeControllerManager() {
5050
return nil
5151
}
5252

nodeup/pkg/model/kube_scheduler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var _ fi.NodeupModelBuilder = &KubeSchedulerBuilder{}
6262

6363
// Build is responsible for building the manifest for the kube-scheduler
6464
func (b *KubeSchedulerBuilder) Build(c *fi.NodeupModelBuilderContext) error {
65-
if !b.IsMaster {
65+
if !b.IsMaster && !b.BootConfig.InstanceGroupRole.HasScheduler() {
6666
return nil
6767
}
6868

0 commit comments

Comments
 (0)