mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
kubeadm: Inherit dry-run
flags for each sub-phases
- The sub-phases like `kubeadm reset phase cleanup-node` which could be run independently would be able to support the `dry-run` mode as well. - Consistent with the sub-phases which support the `dry-run` mode already, such as `kubeadm init phase control-plane apiserver`. - Prepare for the day when each of those sub-phases could be run independently. Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
575031b68f
commit
183a26f853
@ -127,6 +127,7 @@ func getAddonPhaseFlags(name string) []string {
|
||||
options.KubeconfigPath,
|
||||
options.KubernetesVersion,
|
||||
options.ImageRepository,
|
||||
options.DryRun,
|
||||
}
|
||||
if name == "all" || name == "kube-proxy" {
|
||||
flags = append(flags,
|
||||
|
@ -56,6 +56,7 @@ func NewBootstrapTokenPhase() workflow.Phase {
|
||||
options.CfgPath,
|
||||
options.KubeconfigPath,
|
||||
options.SkipTokenPrint,
|
||||
options.DryRun,
|
||||
},
|
||||
Run: runBootstrapToken,
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ func getCertPhaseFlags(name string) []string {
|
||||
options.CertificatesDir,
|
||||
options.CfgPath,
|
||||
options.KubernetesVersion,
|
||||
options.DryRun,
|
||||
}
|
||||
if name == "all" || name == "apiserver" {
|
||||
flags = append(flags,
|
||||
|
@ -72,6 +72,7 @@ func getEtcdPhaseFlags() []string {
|
||||
options.CfgPath,
|
||||
options.ImageRepository,
|
||||
options.Patches,
|
||||
options.DryRun,
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ func getKubeConfigPhaseFlags(name string) []string {
|
||||
options.CfgPath,
|
||||
options.KubeconfigDir,
|
||||
options.KubernetesVersion,
|
||||
options.DryRun,
|
||||
}
|
||||
if name == "all" || name == kubeadmconstants.KubeletKubeConfigFileName {
|
||||
flags = append(flags,
|
||||
|
@ -49,6 +49,7 @@ func NewKubeletStartPhase() workflow.Phase {
|
||||
options.NodeCRISocket,
|
||||
options.NodeName,
|
||||
options.Patches,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ func NewKubeletFinalizePhase() workflow.Phase {
|
||||
{
|
||||
Name: "all",
|
||||
Short: "Run all kubelet-finalize phases",
|
||||
InheritFlags: []string{options.CfgPath, options.CertificatesDir},
|
||||
InheritFlags: []string{options.CfgPath, options.CertificatesDir, options.DryRun},
|
||||
Example: kubeletFinalizePhaseExample,
|
||||
RunAllSiblings: true,
|
||||
},
|
||||
{
|
||||
Name: "experimental-cert-rotation",
|
||||
Short: "Enable kubelet client certificate rotation",
|
||||
InheritFlags: []string{options.CfgPath, options.CertificatesDir},
|
||||
InheritFlags: []string{options.CfgPath, options.CertificatesDir, options.DryRun},
|
||||
Run: runKubeletFinalizeCertRotation,
|
||||
},
|
||||
},
|
||||
|
@ -44,6 +44,7 @@ func NewMarkControlPlanePhase() workflow.Phase {
|
||||
InheritFlags: []string{
|
||||
options.NodeName,
|
||||
options.CfgPath,
|
||||
options.DryRun,
|
||||
},
|
||||
Run: runMarkControlPlane,
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ func NewPreflightPhase() workflow.Phase {
|
||||
InheritFlags: []string{
|
||||
options.CfgPath,
|
||||
options.IgnorePreflightErrors,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ func NewUploadCertsPhase() workflow.Phase {
|
||||
options.UploadCerts,
|
||||
options.CertificateKey,
|
||||
options.SkipCertificateKeyPrint,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ func getUploadConfigPhaseFlags() []string {
|
||||
return []string{
|
||||
options.CfgPath,
|
||||
options.KubeconfigPath,
|
||||
options.DryRun,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,9 @@ func getControlPlaneJoinPhaseFlags(name string) []string {
|
||||
if name != "mark-control-plane" {
|
||||
flags = append(flags, options.APIServerAdvertiseAddress)
|
||||
}
|
||||
if name != "update-status" {
|
||||
flags = append(flags, options.DryRun)
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ func getControlPlanePreparePhaseFlags(name string) []string {
|
||||
options.TokenStr,
|
||||
options.CertificateKey,
|
||||
options.Patches,
|
||||
options.DryRun,
|
||||
}
|
||||
case "download-certs":
|
||||
flags = []string{
|
||||
@ -93,6 +94,7 @@ func getControlPlanePreparePhaseFlags(name string) []string {
|
||||
options.TLSBootstrapToken,
|
||||
options.TokenStr,
|
||||
options.CertificateKey,
|
||||
options.DryRun,
|
||||
}
|
||||
case "certs":
|
||||
flags = []string{
|
||||
@ -118,6 +120,7 @@ func getControlPlanePreparePhaseFlags(name string) []string {
|
||||
options.TLSBootstrapToken,
|
||||
options.TokenStr,
|
||||
options.CertificateKey,
|
||||
options.DryRun,
|
||||
}
|
||||
case "control-plane":
|
||||
flags = []string{
|
||||
@ -126,6 +129,7 @@ func getControlPlanePreparePhaseFlags(name string) []string {
|
||||
options.CfgPath,
|
||||
options.ControlPlane,
|
||||
options.Patches,
|
||||
options.DryRun,
|
||||
}
|
||||
default:
|
||||
flags = []string{}
|
||||
|
@ -77,6 +77,7 @@ func NewKubeletStartPhase() workflow.Phase {
|
||||
options.TLSBootstrapToken,
|
||||
options.TokenStr,
|
||||
options.Patches,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ func NewPreflightPhase() workflow.Phase {
|
||||
options.TokenDiscoveryCAHash,
|
||||
options.TokenDiscoverySkipCAHash,
|
||||
options.CertificateKey,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ func NewCleanupNodePhase() workflow.Phase {
|
||||
options.CertificatesDir,
|
||||
options.NodeCRISocket,
|
||||
options.CleanupTmpDir,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ func NewPreflightPhase() workflow.Phase {
|
||||
InheritFlags: []string{
|
||||
options.IgnorePreflightErrors,
|
||||
options.ForceReset,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ func NewRemoveETCDMemberPhase() workflow.Phase {
|
||||
Run: runRemoveETCDMemberPhase,
|
||||
InheritFlags: []string{
|
||||
options.KubeconfigPath,
|
||||
options.DryRun,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user