mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
kubeadm: Demote --self-hosted to master config file.
This commit is contained in:
parent
17375fc59f
commit
cf793e7c65
@ -40,6 +40,10 @@ type MasterConfiguration struct {
|
|||||||
KubernetesVersion string
|
KubernetesVersion string
|
||||||
CloudProvider string
|
CloudProvider string
|
||||||
AuthorizationMode 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 {
|
type API struct {
|
||||||
|
@ -30,6 +30,10 @@ type MasterConfiguration struct {
|
|||||||
KubernetesVersion string `json:"kubernetesVersion"`
|
KubernetesVersion string `json:"kubernetesVersion"`
|
||||||
CloudProvider string `json:"cloudProvider"`
|
CloudProvider string `json:"cloudProvider"`
|
||||||
AuthorizationMode string `json:"authorizationMode"`
|
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 {
|
type API struct {
|
||||||
|
@ -69,12 +69,11 @@ func NewCmdInit(out io.Writer) *cobra.Command {
|
|||||||
|
|
||||||
var cfgPath string
|
var cfgPath string
|
||||||
var skipPreFlight bool
|
var skipPreFlight bool
|
||||||
var selfHosted bool
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "init",
|
Use: "init",
|
||||||
Short: "Run this in order to set up the Kubernetes master",
|
Short: "Run this in order to set up the Kubernetes master",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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(err)
|
||||||
kubeadmutil.CheckErr(i.Validate())
|
kubeadmutil.CheckErr(i.Validate())
|
||||||
kubeadmutil.CheckErr(i.Run(out))
|
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",
|
"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
|
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.")
|
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
|
// Try to start the kubelet service in case it's inactive
|
||||||
preflight.TryStartKubelet()
|
preflight.TryStartKubelet()
|
||||||
|
|
||||||
return &Init{cfg: cfg, selfHosted: selfHosted}, nil
|
return &Init{cfg: cfg}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type Init struct {
|
type Init struct {
|
||||||
cfg *kubeadmapi.MasterConfiguration
|
cfg *kubeadmapi.MasterConfiguration
|
||||||
selfHosted bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates configuration passed to "kubeadm init"
|
// Validate validates configuration passed to "kubeadm init"
|
||||||
@ -225,7 +218,7 @@ func (i *Init) Run(out io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is deployment type self-hosted?
|
// Is deployment type self-hosted?
|
||||||
if i.selfHosted {
|
if i.cfg.SelfHosted {
|
||||||
// Temporary control plane is up, now we create our self hosted control
|
// Temporary control plane is up, now we create our self hosted control
|
||||||
// plane components and remove the static manifests:
|
// plane components and remove the static manifests:
|
||||||
fmt.Println("[init] Creating self-hosted control plane...")
|
fmt.Println("[init] Creating self-hosted control plane...")
|
||||||
|
Loading…
Reference in New Issue
Block a user