From cf793e7c652aeacf678b2c689d0fabe868938971 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 23 Feb 2017 14:52:41 -0400 Subject: [PATCH] kubeadm: Demote --self-hosted to master config file. --- cmd/kubeadm/app/apis/kubeadm/types.go | 4 ++++ cmd/kubeadm/app/apis/kubeadm/v1alpha1/types.go | 4 ++++ cmd/kubeadm/app/cmd/init.go | 17 +++++------------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/cmd/kubeadm/app/apis/kubeadm/types.go b/cmd/kubeadm/app/apis/kubeadm/types.go index aa6f6e004f8..1101b0abc4a 100644 --- a/cmd/kubeadm/app/apis/kubeadm/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/types.go @@ -40,6 +40,10 @@ type MasterConfiguration struct { KubernetesVersion string CloudProvider string AuthorizationMode string + // SelfHosted enables an alpha deployment type where the apiserver, scheduler, and + // controller manager are managed by Kubernetes itself. This option is likely to + // become the default in the future. + SelfHosted bool } type API struct { diff --git a/cmd/kubeadm/app/apis/kubeadm/v1alpha1/types.go b/cmd/kubeadm/app/apis/kubeadm/v1alpha1/types.go index 91dca1f9360..f07c236e394 100644 --- a/cmd/kubeadm/app/apis/kubeadm/v1alpha1/types.go +++ b/cmd/kubeadm/app/apis/kubeadm/v1alpha1/types.go @@ -30,6 +30,10 @@ type MasterConfiguration struct { KubernetesVersion string `json:"kubernetesVersion"` CloudProvider string `json:"cloudProvider"` AuthorizationMode string `json:"authorizationMode"` + // SelfHosted enables an alpha deployment type where the apiserver, scheduler, and + // controller manager are managed by Kubernetes itself. This option is likely to + // become the default in the future. + SelfHosted bool `json:"selfHosted"` } type API struct { diff --git a/cmd/kubeadm/app/cmd/init.go b/cmd/kubeadm/app/cmd/init.go index 1da11c70cad..28feae6df48 100644 --- a/cmd/kubeadm/app/cmd/init.go +++ b/cmd/kubeadm/app/cmd/init.go @@ -69,12 +69,11 @@ func NewCmdInit(out io.Writer) *cobra.Command { var cfgPath string var skipPreFlight bool - var selfHosted bool cmd := &cobra.Command{ Use: "init", Short: "Run this in order to set up the Kubernetes master", Run: func(cmd *cobra.Command, args []string) { - i, err := NewInit(cfgPath, &cfg, skipPreFlight, selfHosted) + i, err := NewInit(cfgPath, &cfg, skipPreFlight) kubeadmutil.CheckErr(err) kubeadmutil.CheckErr(i.Validate()) kubeadmutil.CheckErr(i.Run(out)) @@ -122,15 +121,10 @@ func NewCmdInit(out io.Writer) *cobra.Command { "The discovery method kubeadm will use for connecting nodes to the master", ) - cmd.PersistentFlags().BoolVar( - &selfHosted, "self-hosted", selfHosted, - "Enable self-hosted control plane", - ) - return cmd } -func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight bool, selfHosted bool) (*Init, error) { +func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight bool) (*Init, error) { fmt.Println("[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.") @@ -169,12 +163,11 @@ func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, skipPreFlight // Try to start the kubelet service in case it's inactive preflight.TryStartKubelet() - return &Init{cfg: cfg, selfHosted: selfHosted}, nil + return &Init{cfg: cfg}, nil } type Init struct { - cfg *kubeadmapi.MasterConfiguration - selfHosted bool + cfg *kubeadmapi.MasterConfiguration } // Validate validates configuration passed to "kubeadm init" @@ -225,7 +218,7 @@ func (i *Init) Run(out io.Writer) error { } // Is deployment type self-hosted? - if i.selfHosted { + if i.cfg.SelfHosted { // Temporary control plane is up, now we create our self hosted control // plane components and remove the static manifests: fmt.Println("[init] Creating self-hosted control plane...")