mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 16:21:13 +00:00
kubeadm: improve some grammar issues
This commit is contained in:
parent
ea61d04db1
commit
da234c9b23
@ -106,7 +106,7 @@ func runCoreDNSAddon(c workflow.RunData) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// runKubeProxyAddon upgrades the KubeProxy addon.
|
||||
// runKubeProxyAddon upgrades the kube-proxy addon.
|
||||
func runKubeProxyAddon(c workflow.RunData) error {
|
||||
cfg, client, _, out, dryRun, err := getInitData(c)
|
||||
if err != nil {
|
||||
|
@ -30,7 +30,7 @@ import (
|
||||
|
||||
var (
|
||||
kubeletConfigLongDesc = cmdutil.LongDesc(`
|
||||
Download the kubelet configuration from the kubelet-config ConfigMap stored in the cluster
|
||||
Upgrade the kubelet configuration for this node by downloading it from the kubelet-config ConfigMap stored in the cluster
|
||||
`)
|
||||
)
|
||||
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
func NewPostUpgradePhase() workflow.Phase {
|
||||
return workflow.Phase{
|
||||
Name: "post-upgrade",
|
||||
Short: "Run the post upgrade tasks",
|
||||
Short: "Run post upgrade tasks",
|
||||
Run: runPostUpgrade,
|
||||
InheritFlags: []string{
|
||||
options.CfgPath,
|
||||
@ -43,7 +43,7 @@ func runPostUpgrade(c workflow.RunData) error {
|
||||
if !ok {
|
||||
return errors.New("preflight phase invoked with an invalid data struct")
|
||||
}
|
||||
// TODO: add the post upgrade tasks here when needed
|
||||
// PLACEHOLDER: this phase should contain any release specific post-upgrade tasks.
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -68,30 +68,30 @@ func runPreflight(c workflow.RunData) error {
|
||||
|
||||
initCfg, client, ignorePreflightErrors := data.InitCfg(), data.Client(), data.IgnorePreflightErrors()
|
||||
|
||||
// First, check if we're root separately from the other preflight checks and fail fast
|
||||
// First, check if we're root separately from the other preflight checks and fail fast.
|
||||
if err := preflight.RunRootCheckOnly(ignorePreflightErrors); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Run CoreDNS migration check
|
||||
// Run CoreDNS migration check.
|
||||
if err := upgrade.RunCoreDNSMigrationCheck(client, ignorePreflightErrors); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Run healthchecks against the cluster
|
||||
// Run healthchecks against the cluster.
|
||||
klog.V(1).Infoln("[upgrade/preflight] Verifying the cluster health")
|
||||
if err := upgrade.CheckClusterHealth(client, &initCfg.ClusterConfiguration, ignorePreflightErrors, printer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check if feature gate flags used in the cluster are consistent with the set of features currently supported by kubeadm
|
||||
// Check if feature gate flags used in the cluster are consistent with the set of features currently supported by kubeadm.
|
||||
if msg := features.CheckDeprecatedFlags(&features.InitFeatureGates, initCfg.FeatureGates); len(msg) > 0 {
|
||||
for _, m := range msg {
|
||||
_, _ = printer.Printf("[upgrade/preflight] %s\n", m)
|
||||
}
|
||||
}
|
||||
|
||||
// Validate requested and validate actual version
|
||||
// Validate requested and validate actual version.
|
||||
klog.V(1).Infoln("[upgrade/preflight] Validating requested and actual version")
|
||||
if err := configutil.NormalizeKubernetesVersion(&initCfg.ClusterConfiguration); err != nil {
|
||||
return err
|
||||
@ -132,8 +132,8 @@ func runPreflight(c workflow.RunData) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// enforceVersionPolicies makes sure that the version the user specified is valid to upgrade to
|
||||
// There are both fatal and skippable (with --force) errors
|
||||
// enforceVersionPolicies makes sure that the version the user specified is valid to upgrade to.
|
||||
// It handles both fatal and skippable (with --force) errors.
|
||||
func enforceVersionPolicies(newK8sVersionStr string, newK8sVersion *version.Version, allowExperimentalUpgrades, allowRCUpgrades, force bool, versionGetter upgrade.VersionGetter) error {
|
||||
fmt.Printf("[upgrade/preflight] You have chosen to upgrade the cluster version to %q\n", newK8sVersionStr)
|
||||
|
||||
@ -146,12 +146,12 @@ func enforceVersionPolicies(newK8sVersionStr string, newK8sVersion *version.Vers
|
||||
}
|
||||
|
||||
if len(versionSkewErrs.Skippable) > 0 {
|
||||
// Return the error if the user hasn't specified the --force flag
|
||||
// Return the error if the user hasn't specified the --force flag.
|
||||
if !force {
|
||||
return errors.Errorf("the version argument is invalid due to these errors:\n\n%v\nCan be bypassed if you pass the --force flag",
|
||||
kubeadmutil.FormatErrMsg(versionSkewErrs.Skippable))
|
||||
}
|
||||
// Soft errors found, but --force was specified
|
||||
// Soft errors found, but --force was specified.
|
||||
fmt.Printf("[upgrade/preflight] Found %d potential version compatibility errors but skipping since the --force flag is set: \n\n%v", len(versionSkewErrs.Skippable), kubeadmutil.FormatErrMsg(versionSkewErrs.Skippable))
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ func getUploadConfigPhaseFlags() []string {
|
||||
}
|
||||
}
|
||||
|
||||
// runUploadKubeadmConfig uploads the kubeadm configuration to a ConfigMap
|
||||
// runUploadKubeadmConfig uploads the kubeadm configuration to a ConfigMap.
|
||||
func runUploadKubeadmConfig(c workflow.RunData) error {
|
||||
cfg, client, dryRun, err := getUploadConfigData(c)
|
||||
if err != nil {
|
||||
@ -91,7 +91,7 @@ func runUploadKubeadmConfig(c workflow.RunData) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// runUploadKubeletConfig uploads the kubelet configuration to a ConfigMap
|
||||
// runUploadKubeletConfig uploads the kubelet configuration to a ConfigMap.
|
||||
func runUploadKubeletConfig(c workflow.RunData) error {
|
||||
cfg, client, dryRun, err := getUploadConfigData(c)
|
||||
if err != nil {
|
||||
@ -109,7 +109,7 @@ func runUploadKubeletConfig(c workflow.RunData) error {
|
||||
return errors.Wrap(err, "error creating kubelet configuration ConfigMap")
|
||||
}
|
||||
|
||||
klog.V(1).Infoln("[upgrade/upload-config] Preserving the CRISocket information for the control-plane node")
|
||||
klog.V(1).Infoln("[upgrade/upload-config] Preserving the CRISocket information for this control-plane node")
|
||||
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")
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ func newCmdApply(apf *applyPlanFlags) *cobra.Command {
|
||||
applyRunner.AppendPhase(phases.NewAddonPhase())
|
||||
applyRunner.AppendPhase(phases.NewPostUpgradePhase())
|
||||
|
||||
// Sets the data builder function, that will be used by the runner
|
||||
// both when running the entire workflow or single phases
|
||||
// Sets the data builder function, that will be used by the runner,
|
||||
// both when running the entire workflow or single phases.
|
||||
applyRunner.SetDataInitializer(func(cmd *cobra.Command, args []string) (workflow.RunData, error) {
|
||||
data, err := newApplyData(cmd, args, flags)
|
||||
if err != nil {
|
||||
@ -154,7 +154,7 @@ func newCmdApply(apf *applyPlanFlags) *cobra.Command {
|
||||
})
|
||||
|
||||
// Binds the Runner to kubeadm upgrade apply command by altering
|
||||
// command help, adding --skip-phases flag and by adding phases subcommands
|
||||
// command help, adding --skip-phases flag and by adding phases subcommands.
|
||||
applyRunner.BindToCommand(cmd)
|
||||
|
||||
return cmd
|
||||
@ -170,7 +170,7 @@ func newApplyData(cmd *cobra.Command, args []string, applyFlags *applyFlags) (*a
|
||||
}
|
||||
|
||||
upgradeVersion := upgradeCfg.Apply.KubernetesVersion
|
||||
// The version arg is mandatory, unless it's specified in the config file
|
||||
// The version arg is mandatory, unless it's specified in the config file.
|
||||
if upgradeVersion == "" {
|
||||
if err := cmdutil.ValidateExactArgNumber(args, []string{"version"}); err != nil {
|
||||
return nil, err
|
||||
@ -229,7 +229,7 @@ func newApplyData(cmd *cobra.Command, args []string, applyFlags *applyFlags) (*a
|
||||
|
||||
printer := &output.TextPrinter{}
|
||||
|
||||
// Fetches the cluster configuration
|
||||
// Fetches the cluster configuration.
|
||||
klog.V(1).Infoln("[upgrade] retrieving configuration from cluster")
|
||||
initCfg, err := configutil.FetchInitConfigurationFromCluster(client, nil, "upgrade", false, false)
|
||||
if err != nil {
|
||||
@ -238,7 +238,7 @@ func newApplyData(cmd *cobra.Command, args []string, applyFlags *applyFlags) (*a
|
||||
_, _ = printer.Printf("[upgrade] Use 'kubeadm init phase upload-config --config your-config.yaml' to re-upload it.\n")
|
||||
err = errors.Errorf("the ConfigMap %q in the %q namespace was not found", constants.KubeadmConfigConfigMap, metav1.NamespaceSystem)
|
||||
}
|
||||
return nil, errors.Wrap(err, "[upgrade/init config] FATAL")
|
||||
return nil, errors.Wrap(err, "[upgrade] FATAL")
|
||||
}
|
||||
|
||||
// Also set the union of pre-flight errors to InitConfiguration, to provide a consistent view of the runtime configuration:
|
||||
|
@ -112,7 +112,7 @@ func TestNewApplyData(t *testing.T) {
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// initialize an external apply flags and inject it to the apply cmd
|
||||
// Initialize an external apply flags and inject it to the apply cmd.
|
||||
apf := &applyPlanFlags{
|
||||
kubeConfigPath: kubeadmconstants.GetAdminKubeConfigPath(),
|
||||
cfgPath: "",
|
||||
@ -125,7 +125,7 @@ func TestNewApplyData(t *testing.T) {
|
||||
|
||||
cmd := newCmdApply(apf)
|
||||
|
||||
// sets cmd flags (that will be reflected on the init options)
|
||||
// Sets cmd flags (that will be reflected on the init options).
|
||||
for f, v := range tc.flags {
|
||||
_ = cmd.Flags().Set(f, v)
|
||||
}
|
||||
@ -136,7 +136,7 @@ func TestNewApplyData(t *testing.T) {
|
||||
renewCerts: true,
|
||||
}
|
||||
|
||||
// test newApplyData method
|
||||
// Test newApplyData method.
|
||||
data, err := newApplyData(cmd, tc.args, flags)
|
||||
if err == nil && len(tc.expectedError) != 0 {
|
||||
t.Error("Expected error, but got success")
|
||||
@ -145,7 +145,7 @@ func TestNewApplyData(t *testing.T) {
|
||||
t.Fatalf("newApplyData returned unexpected error, expected: %s, got %v", tc.expectedError, err)
|
||||
}
|
||||
|
||||
// exec additional validation on the returned value
|
||||
// Exec additional validation on the returned value.
|
||||
if tc.validate != nil {
|
||||
tc.validate(t, data)
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func AllowBootstrapTokensToPostCSRs(client clientset.Interface) error {
|
||||
})
|
||||
}
|
||||
|
||||
// AllowBootstrapTokensToGetNodes creates RBAC rules to allow Node Bootstrap Tokens to list nodes
|
||||
// AllowBootstrapTokensToGetNodes creates RBAC rules to allow Node Bootstrap Tokens to list nodes.
|
||||
func AllowBootstrapTokensToGetNodes(client clientset.Interface) error {
|
||||
fmt.Println("[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes")
|
||||
|
||||
|
@ -109,7 +109,7 @@ func PerformAddonsUpgrade(client clientset.Interface, cfg *kubeadmapi.InitConfig
|
||||
return errorsutil.NewAggregate(errs)
|
||||
}
|
||||
|
||||
// UnupgradedControlPlaneInstances returns a list of control palne instances that have not yet been upgraded.
|
||||
// UnupgradedControlPlaneInstances returns a list of control plane instances that have not yet been upgraded.
|
||||
//
|
||||
// NB. This function can only be called after the current control plane instance has been upgraded already.
|
||||
// Because it determines whether the other control plane instances have been upgraded by checking whether
|
||||
|
Loading…
Reference in New Issue
Block a user