Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
77375766
Unverified
Commit
77375766
authored
Nov 06, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70405 from yagonobre/upload-config
kubeadm graduate upload-config phase
parents
95014b26
79f1b66f
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
119 additions
and
189 deletions
+119
-189
alpha.go
cmd/kubeadm/app/cmd/alpha/alpha.go
+0
-1
init.go
cmd/kubeadm/app/cmd/init.go
+1
-20
kubelet.go
cmd/kubeadm/app/cmd/phases/kubelet.go
+0
-127
uploadconfig.go
cmd/kubeadm/app/cmd/phases/uploadconfig.go
+96
-39
phase.go
cmd/kubeadm/app/cmd/phases/workflow/phase.go
+3
-0
runner.go
cmd/kubeadm/app/cmd/phases/workflow/runner.go
+1
-0
.generated_docs
docs/.generated_docs
+6
-2
kubeadm_init_phase_upload-config.md
docs/admin/kubeadm_init_phase_upload-config.md
+0
-0
kubeadm_init_phase_upload-config_kubeadm.md
docs/admin/kubeadm_init_phase_upload-config_kubeadm.md
+0
-0
kubeadm_init_phase_upload-config_kubelet.md
docs/admin/kubeadm_init_phase_upload-config_kubelet.md
+3
-0
kubeadm-init-phase-upload-config-kubeadm.1
docs/man/man1/kubeadm-init-phase-upload-config-kubeadm.1
+3
-0
kubeadm-init-phase-upload-config-kubelet.1
docs/man/man1/kubeadm-init-phase-upload-config-kubelet.1
+3
-0
kubeadm-init-phase-upload-config.1
docs/man/man1/kubeadm-init-phase-upload-config.1
+3
-0
No files found.
cmd/kubeadm/app/cmd/alpha/alpha.go
View file @
77375766
...
@@ -55,7 +55,6 @@ func newCmdPhase(out io.Writer) *cobra.Command {
...
@@ -55,7 +55,6 @@ func newCmdPhase(out io.Writer) *cobra.Command {
cmd
.
AddCommand
(
phases
.
NewCmdBootstrapToken
())
cmd
.
AddCommand
(
phases
.
NewCmdBootstrapToken
())
cmd
.
AddCommand
(
phases
.
NewCmdMarkMaster
())
cmd
.
AddCommand
(
phases
.
NewCmdMarkMaster
())
cmd
.
AddCommand
(
phases
.
NewCmdSelfhosting
())
cmd
.
AddCommand
(
phases
.
NewCmdSelfhosting
())
cmd
.
AddCommand
(
phases
.
NewCmdUploadConfig
())
return
cmd
return
cmd
}
}
cmd/kubeadm/app/cmd/init.go
View file @
77375766
...
@@ -50,9 +50,7 @@ import (
...
@@ -50,9 +50,7 @@ import (
kubeconfigphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig"
kubeconfigphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig"
kubeletphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
kubeletphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
markmasterphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/markmaster"
markmasterphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/markmaster"
patchnodephase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/patchnode"
selfhostingphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/selfhosting"
selfhostingphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/selfhosting"
uploadconfigphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
"k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient"
"k8s.io/kubernetes/cmd/kubeadm/app/util/apiclient"
...
@@ -183,6 +181,7 @@ func NewCmdInit(out io.Writer) *cobra.Command {
...
@@ -183,6 +181,7 @@ func NewCmdInit(out io.Writer) *cobra.Command {
initRunner
.
AppendPhase
(
phases
.
NewControlPlanePhase
())
initRunner
.
AppendPhase
(
phases
.
NewControlPlanePhase
())
initRunner
.
AppendPhase
(
phases
.
NewEtcdPhase
())
initRunner
.
AppendPhase
(
phases
.
NewEtcdPhase
())
initRunner
.
AppendPhase
(
phases
.
NewWaitControlPlanePhase
())
initRunner
.
AppendPhase
(
phases
.
NewWaitControlPlanePhase
())
initRunner
.
AppendPhase
(
phases
.
NewUploadConfigPhase
())
// TODO: add other phases to the runner.
// TODO: add other phases to the runner.
// sets the data builder function, that will be used by the runner
// sets the data builder function, that will be used by the runner
...
@@ -487,30 +486,12 @@ func runInit(i *initData, out io.Writer) error {
...
@@ -487,30 +486,12 @@ func runInit(i *initData, out io.Writer) error {
return
errors
.
Wrap
(
err
,
"failed to create waiter"
)
return
errors
.
Wrap
(
err
,
"failed to create waiter"
)
}
}
// Upload currently used configuration to the cluster
// Note: This is done right in the beginning of cluster initialization; as we might want to make other phases
// depend on centralized information from this source in the future
glog
.
V
(
1
)
.
Infof
(
"[init] uploading currently used configuration to the cluster"
)
if
err
:=
uploadconfigphase
.
UploadConfiguration
(
i
.
cfg
,
client
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error uploading configuration"
)
}
glog
.
V
(
1
)
.
Infof
(
"[init] creating kubelet configuration configmap"
)
if
err
:=
kubeletphase
.
CreateConfigMap
(
i
.
cfg
,
client
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error creating kubelet configuration ConfigMap"
)
}
// PHASE 4: Mark the master with the right label/taint
// PHASE 4: Mark the master with the right label/taint
glog
.
V
(
1
)
.
Infof
(
"[init] marking the master with right label"
)
glog
.
V
(
1
)
.
Infof
(
"[init] marking the master with right label"
)
if
err
:=
markmasterphase
.
MarkMaster
(
client
,
i
.
cfg
.
NodeRegistration
.
Name
,
i
.
cfg
.
NodeRegistration
.
Taints
);
err
!=
nil
{
if
err
:=
markmasterphase
.
MarkMaster
(
client
,
i
.
cfg
.
NodeRegistration
.
Name
,
i
.
cfg
.
NodeRegistration
.
Taints
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error marking master"
)
return
errors
.
Wrap
(
err
,
"error marking master"
)
}
}
glog
.
V
(
1
)
.
Infof
(
"[init] preserving the crisocket information for the master"
)
if
err
:=
patchnodephase
.
AnnotateCRISocket
(
client
,
i
.
cfg
.
NodeRegistration
.
Name
,
i
.
cfg
.
NodeRegistration
.
CRISocket
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error uploading crisocket"
)
}
// This feature is disabled by default
// This feature is disabled by default
if
features
.
Enabled
(
i
.
cfg
.
FeatureGates
,
features
.
DynamicKubeletConfig
)
{
if
features
.
Enabled
(
i
.
cfg
.
FeatureGates
,
features
.
DynamicKubeletConfig
)
{
kubeletVersion
,
err
:=
preflight
.
GetKubeletVersion
(
utilsexec
.
New
())
kubeletVersion
,
err
:=
preflight
.
GetKubeletVersion
(
utilsexec
.
New
())
...
...
cmd/kubeadm/app/cmd/phases/kubelet.go
View file @
77375766
...
@@ -19,18 +19,10 @@ package phases
...
@@ -19,18 +19,10 @@ package phases
import
(
import
(
"github.com/golang/glog"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/spf13/cobra"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
kubeadmapiv1beta1
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
cmdutil
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
kubeletphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
kubeletphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
patchnodephase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/patchnode"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
configutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/config"
kubeconfigutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
"k8s.io/kubernetes/pkg/util/normalizer"
"k8s.io/kubernetes/pkg/util/normalizer"
)
)
...
@@ -39,24 +31,6 @@ var (
...
@@ -39,24 +31,6 @@ var (
# Writes a dynamic environment file with kubelet flags from a InitConfiguration file.
# Writes a dynamic environment file with kubelet flags from a InitConfiguration file.
kubeadm init phase kubelet-start --config masterconfig.yaml
kubeadm init phase kubelet-start --config masterconfig.yaml
`
)
`
)
kubeletConfigUploadLongDesc
=
normalizer
.
LongDesc
(
`
Uploads kubelet configuration extracted from the kubeadm InitConfiguration object to a ConfigMap
of the form kubelet-config-1.X in the cluster, where X is the minor version of the current (API Server) Kubernetes version.
`
+
cmdutil
.
AlphaDisclaimer
)
kubeletConfigUploadExample
=
normalizer
.
Examples
(
`
# Uploads the kubelet configuration from the kubeadm Config file to a ConfigMap in the cluster.
kubeadm alpha phase kubelet config upload --config kubeadm.yaml
`
)
kubeletConfigAnnotateCRILongDesc
=
normalizer
.
LongDesc
(
`
Adds an annotation to the current node with the CRI socket specified in the kubeadm InitConfiguration object.
`
+
cmdutil
.
AlphaDisclaimer
)
kubeletConfigAnnotateCRIExample
=
normalizer
.
Examples
(
`
kubeadm alpha phase kubelet config annotate-cri --config kubeadm.yaml
`
)
)
)
// kubeletStartData defines the behavior that a runtime data struct passed to the kubelet start phase
// kubeletStartData defines the behavior that a runtime data struct passed to the kubelet start phase
...
@@ -118,104 +92,3 @@ func runKubeletStart(c workflow.RunData) error {
...
@@ -118,104 +92,3 @@ func runKubeletStart(c workflow.RunData) error {
return
nil
return
nil
}
}
// NewCmdKubelet returns command for `kubeadm phase kubelet`
func
NewCmdKubelet
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"kubelet"
,
Short
:
"Commands related to handling the kubelet."
,
Long
:
cmdutil
.
MacroCommandLongDescription
,
}
cmd
.
AddCommand
(
NewCmdKubeletConfig
())
return
cmd
}
// NewCmdKubeletConfig returns command for `kubeadm phase kubelet config`
func
NewCmdKubeletConfig
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"config"
,
Short
:
"Handles kubelet configuration."
,
Long
:
cmdutil
.
MacroCommandLongDescription
,
}
cmd
.
AddCommand
(
NewCmdKubeletConfigUpload
())
cmd
.
AddCommand
(
NewCmdKubeletAnnotateCRI
())
return
cmd
}
// NewCmdKubeletConfigUpload calls cobra.Command for uploading dynamic kubelet configuration
func
NewCmdKubeletConfigUpload
()
*
cobra
.
Command
{
cfg
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{}
var
cfgPath
string
kubeConfigFile
:=
constants
.
GetAdminKubeConfigPath
()
cmd
:=
&
cobra
.
Command
{
Use
:
"upload"
,
Short
:
"Uploads kubelet configuration to a ConfigMap based on a kubeadm InitConfiguration file."
,
Long
:
kubeletConfigUploadLongDesc
,
Example
:
kubeletConfigUploadExample
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
if
len
(
cfgPath
)
==
0
{
kubeadmutil
.
CheckErr
(
errors
.
New
(
"The --config argument is required"
))
}
// KubernetesVersion is not used, but we set it explicitly to avoid the lookup
// of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
SetKubernetesVersion
(
cfg
)
// This call returns the ready-to-use configuration based on the configuration file
internalcfg
,
err
:=
configutil
.
ConfigFileAndDefaultsToInternalConfig
(
cfgPath
,
cfg
)
kubeadmutil
.
CheckErr
(
err
)
kubeConfigFile
=
cmdutil
.
FindExistingKubeConfig
(
kubeConfigFile
)
client
,
err
:=
kubeconfigutil
.
ClientSetFromFile
(
kubeConfigFile
)
kubeadmutil
.
CheckErr
(
err
)
err
=
kubeletphase
.
CreateConfigMap
(
internalcfg
,
client
)
kubeadmutil
.
CheckErr
(
err
)
},
}
options
.
AddKubeConfigFlag
(
cmd
.
Flags
(),
&
kubeConfigFile
)
options
.
AddConfigFlag
(
cmd
.
Flags
(),
&
cfgPath
)
return
cmd
}
// NewCmdKubeletAnnotateCRI calls cobra.Command for annotating the node with the given crisocket
func
NewCmdKubeletAnnotateCRI
()
*
cobra
.
Command
{
cfg
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{}
var
cfgPath
string
kubeConfigFile
:=
constants
.
GetAdminKubeConfigPath
()
cmd
:=
&
cobra
.
Command
{
Use
:
"annotate-cri"
,
Short
:
"annotates the node with the given crisocket"
,
Long
:
kubeletConfigAnnotateCRILongDesc
,
Example
:
kubeletConfigAnnotateCRIExample
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
if
len
(
cfgPath
)
==
0
{
kubeadmutil
.
CheckErr
(
errors
.
New
(
"The --config argument is required"
))
}
// KubernetesVersion is not used, but we set it explicitly to avoid the lookup
// of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
SetKubernetesVersion
(
cfg
)
// This call returns the ready-to-use configuration based on the configuration file
internalcfg
,
err
:=
configutil
.
ConfigFileAndDefaultsToInternalConfig
(
cfgPath
,
cfg
)
kubeadmutil
.
CheckErr
(
err
)
kubeConfigFile
=
cmdutil
.
FindExistingKubeConfig
(
kubeConfigFile
)
client
,
err
:=
kubeconfigutil
.
ClientSetFromFile
(
kubeConfigFile
)
kubeadmutil
.
CheckErr
(
err
)
err
=
patchnodephase
.
AnnotateCRISocket
(
client
,
internalcfg
.
NodeRegistration
.
Name
,
internalcfg
.
NodeRegistration
.
CRISocket
)
kubeadmutil
.
CheckErr
(
err
)
},
}
options
.
AddKubeConfigFlag
(
cmd
.
Flags
(),
&
kubeConfigFile
)
options
.
AddConfigFlag
(
cmd
.
Flags
(),
&
cfgPath
)
return
cmd
}
cmd/kubeadm/app/cmd/phases/uploadconfig.go
View file @
77375766
...
@@ -19,70 +19,127 @@ package phases
...
@@ -19,70 +19,127 @@ package phases
import
(
import
(
"fmt"
"fmt"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/pkg/errors"
"github.com/spf13/cobra"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
kubeadmapiv1beta1
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
clientset
"k8s.io/client-go/kubernetes"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
cmdutil
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
cmdutil
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
kubeadmconstants
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
kubeadmconstants
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
kubeletphase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/kubelet"
patchnodephase
"k8s.io/kubernetes/cmd/kubeadm/app/phases/patchnode"
"k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
"k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
kubeadmutil
"k8s.io/kubernetes/cmd/kubeadm/app/util"
configutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/config"
kubeconfigutil
"k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
"k8s.io/kubernetes/pkg/util/normalizer"
"k8s.io/kubernetes/pkg/util/normalizer"
)
)
var
(
var
(
uploadConfigLongDesc
=
fmt
.
Sprintf
(
normalizer
.
LongDesc
(
`
upload
Kubeadm
ConfigLongDesc
=
fmt
.
Sprintf
(
normalizer
.
LongDesc
(
`
Uploads the kubeadm
init configuration of your cluster
to a ConfigMap called %s in the %s namespace.
Uploads the kubeadm
ClusterConfiguration
to a ConfigMap called %s in the %s namespace.
This enables correct configuration of system components and a seamless user experience when upgrading.
This enables correct configuration of system components and a seamless user experience when upgrading.
Alternatively, you can use kubeadm config.
Alternatively, you can use kubeadm config.
`
+
cmdutil
.
AlphaDisclaimer
),
kubeadmconstants
.
KubeadmConfigConfigMap
,
metav1
.
NamespaceSystem
)
`
),
kubeadmconstants
.
KubeadmConfigConfigMap
,
metav1
.
NamespaceSystem
)
uploadConfigExample
=
normalizer
.
Examples
(
`
upload
Kubeadm
ConfigExample
=
normalizer
.
Examples
(
`
# uploads the configuration of your cluster
# uploads the configuration of your cluster
kubeadm alpha phase upload-config --config=myConfig.yaml
kubeadm alpha phase upload-config --config=myConfig.yaml
`
)
`
)
uploadKubeletConfigLongDesc
=
normalizer
.
LongDesc
(
`
Uploads kubelet configuration extracted from the kubeadm InitConfiguration object to a ConfigMap
of the form kubelet-config-1.X in the cluster, where X is the minor version of the current (API Server) Kubernetes version.
`
)
uploadKubeletConfigExample
=
normalizer
.
Examples
(
`
# Uploads the kubelet configuration from the kubeadm Config file to a ConfigMap in the cluster.
kubeadm init phase upload-config kubelet --config kubeadm.yaml
`
)
)
)
// NewCmdUploadConfig returns the Cobra command for running the uploadconfig phase
type
uploadConfigData
interface
{
func
NewCmdUploadConfig
()
*
cobra
.
Command
{
Cfg
()
*
kubeadmapi
.
InitConfiguration
cfg
:=
&
kubeadmapiv1beta1
.
InitConfiguration
{}
Client
()
(
clientset
.
Interface
,
error
)
kubeConfigFile
:=
kubeadmconstants
.
GetAdminKubeConfigPath
()
}
var
cfgPath
string
// NewUploadConfigPhase returns the phase to uploadConfig
cmd
:=
&
cobra
.
Command
{
func
NewUploadConfigPhase
()
workflow
.
Phase
{
Use
:
"upload-config"
,
return
workflow
.
Phase
{
Short
:
"Uploads the currently used configuration for kubeadm to a ConfigMap"
,
Name
:
"upload-config"
,
Long
:
uploadConfigLongDesc
,
Example
:
uploadConfigExample
,
Aliases
:
[]
string
{
"uploadconfig"
},
Aliases
:
[]
string
{
"uploadconfig"
},
Run
:
func
(
_
*
cobra
.
Command
,
args
[]
string
)
{
Short
:
"Uploads the kubeadm and kubelet configuration to a ConfigMap"
,
if
len
(
cfgPath
)
==
0
{
Long
:
cmdutil
.
MacroCommandLongDescription
,
kubeadmutil
.
CheckErr
(
errors
.
New
(
"the --config flag is mandatory"
))
Phases
:
[]
workflow
.
Phase
{
}
{
Name
:
"kubeadm"
,
Short
:
"Uploads the kubeadm ClusterConfiguration to a ConfigMap"
,
Long
:
uploadKubeadmConfigLongDesc
,
Example
:
uploadKubeadmConfigExample
,
Run
:
runUploadKubeadmConfig
,
CmdFlags
:
getUploadConfigPhaseFlags
(),
},
{
Name
:
"kubelet"
,
Short
:
"Uploads the kubelet component config to a ConfigMap"
,
Long
:
uploadKubeletConfigLongDesc
,
Example
:
uploadKubeletConfigExample
,
Run
:
runUploadKubeletConfig
,
CmdFlags
:
getUploadConfigPhaseFlags
(),
},
},
}
}
func
getUploadConfigPhaseFlags
()
[]
string
{
return
[]
string
{
options
.
CfgPath
,
options
.
KubeconfigPath
,
}
}
kubeConfigFile
=
cmdutil
.
FindExistingKubeConfig
(
kubeConfigFile
)
// runUploadKubeadmConfig uploads the kubeadm configuration to a ConfigMap
client
,
err
:=
kubeconfigutil
.
ClientSetFromFile
(
kubeConfigFile
)
func
runUploadKubeadmConfig
(
c
workflow
.
RunData
)
error
{
kubeadmutil
.
CheckErr
(
err
)
cfg
,
client
,
err
:=
getUploadConfigData
(
c
)
if
err
!=
nil
{
return
err
}
// KubernetesVersion is not used, but we set it explicitly to avoid the lookup
glog
.
V
(
1
)
.
Infof
(
"[upload-config] Uploading the kubeadm ClusterConfiguration to a ConfigMap"
)
// of the version from the internet when executing ConfigFileAndDefaultsToInternalConfig
if
err
:=
uploadconfig
.
UploadConfiguration
(
cfg
,
client
);
err
!=
nil
{
SetKubernetesVersion
(
cfg
)
return
errors
.
Wrap
(
err
,
"error uploading the kubeadm ClusterConfiguration"
)
}
return
nil
}
internalcfg
,
err
:=
configutil
.
ConfigFileAndDefaultsToInternalConfig
(
cfgPath
,
cfg
)
// runUploadKubeletConfig uploads the kubelet configuration to a ConfigMap
kubeadmutil
.
CheckErr
(
err
)
func
runUploadKubeletConfig
(
c
workflow
.
RunData
)
error
{
cfg
,
client
,
err
:=
getUploadConfigData
(
c
)
if
err
!=
nil
{
return
err
}
err
=
uploadconfig
.
UploadConfiguration
(
internalcfg
,
client
)
glog
.
V
(
1
)
.
Infof
(
"[upload-config] Uploading the kubelet component config to a ConfigMap"
)
kubeadmutil
.
CheckErr
(
err
)
if
err
=
kubeletphase
.
CreateConfigMap
(
cfg
,
client
);
err
!=
nil
{
},
return
errors
.
Wrap
(
err
,
"error creating kubelet configuration ConfigMap"
)
}
}
options
.
AddKubeConfigFlag
(
cmd
.
Flags
(),
&
kubeConfigFile
)
glog
.
V
(
1
)
.
Infof
(
"[upload-config] Preserving the CRISocket information for the control-plane node"
)
cmd
.
Flags
()
.
StringVar
(
&
cfgPath
,
"config"
,
""
,
"Path to a kubeadm config file. WARNING: Usage of a configuration file is experimental"
)
if
err
:=
patchnodephase
.
AnnotateCRISocket
(
client
,
cfg
.
NodeRegistration
.
Name
,
cfg
.
NodeRegistration
.
CRISocket
);
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"Error writing Crisocket information for the control-plane node"
)
}
return
nil
}
return
cmd
func
getUploadConfigData
(
c
workflow
.
RunData
)
(
*
kubeadmapi
.
InitConfiguration
,
clientset
.
Interface
,
error
)
{
data
,
ok
:=
c
.
(
uploadConfigData
)
if
!
ok
{
return
nil
,
nil
,
errors
.
New
(
"upload-config phase invoked with an invalid data struct"
)
}
cfg
:=
data
.
Cfg
()
client
,
err
:=
data
.
Client
()
if
err
!=
nil
{
return
nil
,
nil
,
err
}
return
cfg
,
client
,
err
}
}
cmd/kubeadm/app/cmd/phases/workflow/phase.go
View file @
77375766
...
@@ -24,6 +24,9 @@ type Phase struct {
...
@@ -24,6 +24,9 @@ type Phase struct {
// the same workflow or phases belonging to the same parent phase).
// the same workflow or phases belonging to the same parent phase).
Name
string
Name
string
// Aliases returns the aliases for the phase.
Aliases
[]
string
// Short description of the phase.
// Short description of the phase.
Short
string
Short
string
...
...
cmd/kubeadm/app/cmd/phases/workflow/runner.go
View file @
77375766
...
@@ -312,6 +312,7 @@ func (e *Runner) BindToCommand(cmd *cobra.Command) {
...
@@ -312,6 +312,7 @@ func (e *Runner) BindToCommand(cmd *cobra.Command) {
Short
:
p
.
Short
,
Short
:
p
.
Short
,
Long
:
p
.
Long
,
Long
:
p
.
Long
,
Example
:
p
.
Example
,
Example
:
p
.
Example
,
Aliases
:
p
.
Aliases
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
e
.
Options
.
FilterPhases
=
[]
string
{
p
.
generatedName
}
e
.
Options
.
FilterPhases
=
[]
string
{
p
.
generatedName
}
if
err
:=
e
.
Run
();
err
!=
nil
{
if
err
:=
e
.
Run
();
err
!=
nil
{
...
...
docs/.generated_docs
View file @
77375766
...
@@ -37,7 +37,6 @@ docs/admin/kubeadm_alpha_phase_bootstrap-token_node_allow-post-csrs.md
...
@@ -37,7 +37,6 @@ docs/admin/kubeadm_alpha_phase_bootstrap-token_node_allow-post-csrs.md
docs/admin/kubeadm_alpha_phase_mark-master.md
docs/admin/kubeadm_alpha_phase_mark-master.md
docs/admin/kubeadm_alpha_phase_selfhosting.md
docs/admin/kubeadm_alpha_phase_selfhosting.md
docs/admin/kubeadm_alpha_phase_selfhosting_convert-from-staticpods.md
docs/admin/kubeadm_alpha_phase_selfhosting_convert-from-staticpods.md
docs/admin/kubeadm_alpha_phase_upload-config.md
docs/admin/kubeadm_alpha_preflight.md
docs/admin/kubeadm_alpha_preflight.md
docs/admin/kubeadm_alpha_preflight_node.md
docs/admin/kubeadm_alpha_preflight_node.md
docs/admin/kubeadm_completion.md
docs/admin/kubeadm_completion.md
...
@@ -80,6 +79,9 @@ docs/admin/kubeadm_init_phase_kubeconfig_kubelet.md
...
@@ -80,6 +79,9 @@ docs/admin/kubeadm_init_phase_kubeconfig_kubelet.md
docs/admin/kubeadm_init_phase_kubeconfig_scheduler.md
docs/admin/kubeadm_init_phase_kubeconfig_scheduler.md
docs/admin/kubeadm_init_phase_kubelet-start.md
docs/admin/kubeadm_init_phase_kubelet-start.md
docs/admin/kubeadm_init_phase_preflight.md
docs/admin/kubeadm_init_phase_preflight.md
docs/admin/kubeadm_init_phase_upload-config.md
docs/admin/kubeadm_init_phase_upload-config_kubeadm.md
docs/admin/kubeadm_init_phase_upload-config_kubelet.md
docs/admin/kubeadm_join.md
docs/admin/kubeadm_join.md
docs/admin/kubeadm_reset.md
docs/admin/kubeadm_reset.md
docs/admin/kubeadm_token.md
docs/admin/kubeadm_token.md
...
@@ -131,7 +133,6 @@ docs/man/man1/kubeadm-alpha-phase-bootstrap-token.1
...
@@ -131,7 +133,6 @@ docs/man/man1/kubeadm-alpha-phase-bootstrap-token.1
docs/man/man1/kubeadm-alpha-phase-mark-master.1
docs/man/man1/kubeadm-alpha-phase-mark-master.1
docs/man/man1/kubeadm-alpha-phase-selfhosting-convert-from-staticpods.1
docs/man/man1/kubeadm-alpha-phase-selfhosting-convert-from-staticpods.1
docs/man/man1/kubeadm-alpha-phase-selfhosting.1
docs/man/man1/kubeadm-alpha-phase-selfhosting.1
docs/man/man1/kubeadm-alpha-phase-upload-config.1
docs/man/man1/kubeadm-alpha-phase.1
docs/man/man1/kubeadm-alpha-phase.1
docs/man/man1/kubeadm-alpha-preflight-node.1
docs/man/man1/kubeadm-alpha-preflight-node.1
docs/man/man1/kubeadm-alpha-preflight.1
docs/man/man1/kubeadm-alpha-preflight.1
...
@@ -175,6 +176,9 @@ docs/man/man1/kubeadm-init-phase-kubeconfig-scheduler.1
...
@@ -175,6 +176,9 @@ docs/man/man1/kubeadm-init-phase-kubeconfig-scheduler.1
docs/man/man1/kubeadm-init-phase-kubeconfig.1
docs/man/man1/kubeadm-init-phase-kubeconfig.1
docs/man/man1/kubeadm-init-phase-kubelet-start.1
docs/man/man1/kubeadm-init-phase-kubelet-start.1
docs/man/man1/kubeadm-init-phase-preflight.1
docs/man/man1/kubeadm-init-phase-preflight.1
docs/man/man1/kubeadm-init-phase-upload-config-kubeadm.1
docs/man/man1/kubeadm-init-phase-upload-config-kubelet.1
docs/man/man1/kubeadm-init-phase-upload-config.1
docs/man/man1/kubeadm-init-phase.1
docs/man/man1/kubeadm-init-phase.1
docs/man/man1/kubeadm-init.1
docs/man/man1/kubeadm-init.1
docs/man/man1/kubeadm-join.1
docs/man/man1/kubeadm-join.1
...
...
docs/admin/kubeadm_
alpha
_phase_upload-config.md
→
docs/admin/kubeadm_
init
_phase_upload-config.md
View file @
77375766
File moved
docs/
man/man1/kubeadm-alpha-phase-upload-config.1
→
docs/
admin/kubeadm_init_phase_upload-config_kubeadm.md
View file @
77375766
File moved
docs/admin/kubeadm_init_phase_upload-config_kubelet.md
0 → 100644
View file @
77375766
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
docs/man/man1/kubeadm-init-phase-upload-config-kubeadm.1
0 → 100644
View file @
77375766
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
docs/man/man1/kubeadm-init-phase-upload-config-kubelet.1
0 → 100644
View file @
77375766
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
docs/man/man1/kubeadm-init-phase-upload-config.1
0 → 100644
View file @
77375766
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment