kubeadm: Demote --self-hosted to master config file.

This commit is contained in:
Devan Goodwin 2017-02-23 14:52:41 -04:00
parent 17375fc59f
commit cf793e7c65
3 changed files with 13 additions and 12 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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...")