Merge pull request #41991 from dgoodwin/demote-self-hosted

Automatic merge from submit-queue (batch tested with PRs 41857, 41864, 40522, 41835, 41991)

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

**What this PR does / why we need it**:

kubeadm init --self-hosted was meant to be a short lived hack to enable self-hosted deployments until we're ready to make them the default. Rather than shipping this in 1.6 (for the first time) we will move this to the config file as it is presently only an advanced feature, leaving us with more well supported ways to remove it in the future.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

CC @luxas @pires @errordeveloper @dmmcquay 

**Release note**:

```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-02-26 11:13:58 -08:00 committed by GitHub
commit 3cc14290ad
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...")