@@ -68,30 +68,30 @@ func runPreflight(c workflow.RunData) error {
68
68
69
69
initCfg , client , ignorePreflightErrors := data .InitCfg (), data .Client (), data .IgnorePreflightErrors ()
70
70
71
- // First, check if we're root separately from the other preflight checks and fail fast
71
+ // First, check if we're root separately from the other preflight checks and fail fast.
72
72
if err := preflight .RunRootCheckOnly (ignorePreflightErrors ); err != nil {
73
73
return err
74
74
}
75
75
76
- // Run CoreDNS migration check
76
+ // Run CoreDNS migration check.
77
77
if err := upgrade .RunCoreDNSMigrationCheck (client , ignorePreflightErrors ); err != nil {
78
78
return err
79
79
}
80
80
81
- // Run healthchecks against the cluster
81
+ // Run healthchecks against the cluster.
82
82
klog .V (1 ).Infoln ("[upgrade/preflight] Verifying the cluster health" )
83
83
if err := upgrade .CheckClusterHealth (client , & initCfg .ClusterConfiguration , ignorePreflightErrors , printer ); err != nil {
84
84
return err
85
85
}
86
86
87
- // Check if feature gate flags used in the cluster are consistent with the set of features currently supported by kubeadm
87
+ // Check if feature gate flags used in the cluster are consistent with the set of features currently supported by kubeadm.
88
88
if msg := features .CheckDeprecatedFlags (& features .InitFeatureGates , initCfg .FeatureGates ); len (msg ) > 0 {
89
89
for _ , m := range msg {
90
90
_ , _ = printer .Printf ("[upgrade/preflight] %s\n " , m )
91
91
}
92
92
}
93
93
94
- // Validate requested and validate actual version
94
+ // Validate requested and validate actual version.
95
95
klog .V (1 ).Infoln ("[upgrade/preflight] Validating requested and actual version" )
96
96
if err := configutil .NormalizeKubernetesVersion (& initCfg .ClusterConfiguration ); err != nil {
97
97
return err
@@ -132,8 +132,8 @@ func runPreflight(c workflow.RunData) error {
132
132
return nil
133
133
}
134
134
135
- // enforceVersionPolicies makes sure that the version the user specified is valid to upgrade to
136
- // There are both fatal and skippable (with --force) errors
135
+ // enforceVersionPolicies makes sure that the version the user specified is valid to upgrade to.
136
+ // It handles both fatal and skippable (with --force) errors.
137
137
func enforceVersionPolicies (newK8sVersionStr string , newK8sVersion * version.Version , allowExperimentalUpgrades , allowRCUpgrades , force bool , versionGetter upgrade.VersionGetter ) error {
138
138
fmt .Printf ("[upgrade/preflight] You have chosen to upgrade the cluster version to %q\n " , newK8sVersionStr )
139
139
@@ -146,12 +146,12 @@ func enforceVersionPolicies(newK8sVersionStr string, newK8sVersion *version.Vers
146
146
}
147
147
148
148
if len (versionSkewErrs .Skippable ) > 0 {
149
- // Return the error if the user hasn't specified the --force flag
149
+ // Return the error if the user hasn't specified the --force flag.
150
150
if ! force {
151
151
return errors .Errorf ("the version argument is invalid due to these errors:\n \n %v\n Can be bypassed if you pass the --force flag" ,
152
152
kubeadmutil .FormatErrMsg (versionSkewErrs .Skippable ))
153
153
}
154
- // Soft errors found, but --force was specified
154
+ // Soft errors found, but --force was specified.
155
155
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 ))
156
156
}
157
157
}
0 commit comments