ignoreErrors.Insert(strings.ToLower(item))// parameters are case insensitive
}
// TODO: remove once deprecated flag --skip-preflight-checks is removed.
ifskipPreflightChecks{
ifignoreErrors.Has("all"){
allErrs=append(allErrs,field.Invalid(field.NewPath("ignore-checks-errors"),strings.Join(ignoreErrors.List(),","),"'all' is used together with deprecated flag --skip-preflight-checks. Remove deprecated flag"))
}
ignoreErrors.Insert("all")
}
ifignoreErrors.Has("all")&&ignoreErrors.Len()>1{
allErrs=append(allErrs,field.Invalid(field.NewPath("ignore-checks-errors"),strings.Join(ignoreErrors.List(),","),"don't specify individual checks if 'all' is used"))
allErrs=append(allErrs,field.Invalid(field.NewPath("ignore-preflight-errors"),strings.Join(ignoreErrors.List(),","),"don't specify individual checks if 'all' is used"))
t.Errorf("ValidateIgnoreChecksErrors: unexpected error for input (%s, %v), error: %v",rt.ignoreChecksErrors,rt.skipPreflightChecks,err)
t.Errorf("ValidateIgnorePreflightErrors: unexpected error for input (%s, %v), error: %v",rt.ignorePreflightErrors,rt.skipPreflightChecks,err)
caseerr==nil&&rt.expectedError:
t.Errorf("ValidateIgnoreChecksErrors: expected error for input (%s, %v) but got: %v",rt.ignoreChecksErrors,rt.skipPreflightChecks,result)
t.Errorf("ValidateIgnorePreflightErrors: expected error for input (%s, %v) but got: %v",rt.ignorePreflightErrors,rt.skipPreflightChecks,result)
caseresult.Len()!=rt.expectedLen:
t.Errorf("ValidateIgnoreChecksErrors: expected Len = %d for input (%s, %v) but got: %v, %v",rt.expectedLen,rt.ignoreChecksErrors,rt.skipPreflightChecks,result.Len(),result)
t.Errorf("ValidateIgnorePreflightErrors: expected Len = %d for input (%s, %v) but got: %v, %v",rt.expectedLen,rt.ignorePreflightErrors,rt.skipPreflightChecks,result.Len(),result)
cmd.PersistentFlags().BoolVar(&flags.allowExperimentalUpgrades,"allow-experimental-upgrades",flags.allowExperimentalUpgrades,"Show unstable versions of Kubernetes as an upgrade alternative and allow upgrading to an alpha/beta/release candidate versions of Kubernetes.")
cmd.PersistentFlags().BoolVar(&flags.allowRCUpgrades,"allow-release-candidate-upgrades",flags.allowRCUpgrades,"Show release candidate versions of Kubernetes as an upgrade alternative and allow upgrading to a release candidate versions of Kubernetes.")
cmd.PersistentFlags().BoolVar(&flags.printConfig,"print-config",flags.printConfig,"Specifies whether the configuration file that will be used in the upgrade should be printed or not.")
cmd.PersistentFlags().StringSliceVar(&flags.ignoreChecksErrors,"ignore-checks-errors",flags.ignoreChecksErrors,"A list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.")
cmd.PersistentFlags().StringSliceVar(&flags.ignorePreflightErrors,"ignore-preflight-errors",flags.ignorePreflightErrors,"A list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.")
cmd.PersistentFlags().BoolVar(&flags.skipPreFlight,"skip-preflight-checks",flags.skipPreFlight,"Skip preflight checks that normally run before modifying the system.")
cmd.PersistentFlags().MarkDeprecated("skip-preflight-checks","it is now equivalent to --ignore-checks-errors=all")
cmd.PersistentFlags().MarkDeprecated("skip-preflight-checks","it is now equivalent to --ignore-preflight-errors=all")
cmd.PersistentFlags().StringVar(&flags.featureGatesString,"feature-gates",flags.featureGatesString,"A set of key=value pairs that describe feature gates for various features."+
returnfmt.Sprintf("[preflight] Some fatal errors occurred:\n%s%s",e.Msg,"[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-checks-errors=...`")
returnfmt.Sprintf("[preflight] Some fatal errors occurred:\n%s%s",e.Msg,"[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`")
}
// Checker validates the state of the system to ensure kubeadm will be