mirror of https://github.com/k3s-io/k3s
Merge pull request #75874 from SataQiu/refactor-kubeadm-20190329
Refactor code about setting KubernetesVersionFlagk3s-v1.15.3
commit
214340256f
|
@ -514,10 +514,7 @@ func (i *ImagesList) Run(out io.Writer) error {
|
|||
|
||||
// AddImagesCommonConfigFlags adds the flags that configure kubeadm (and affect the images kubeadm will use)
|
||||
func AddImagesCommonConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1beta1.InitConfiguration, cfgPath *string, featureGatesString *string) {
|
||||
flagSet.StringVar(
|
||||
&cfg.ClusterConfiguration.KubernetesVersion, "kubernetes-version", cfg.ClusterConfiguration.KubernetesVersion,
|
||||
`Choose a specific Kubernetes version for the control plane.`,
|
||||
)
|
||||
options.AddKubernetesVersionFlag(flagSet, &cfg.ClusterConfiguration.KubernetesVersion)
|
||||
options.AddFeatureGatesStringFlag(flagSet, featureGatesString)
|
||||
flagSet.StringVar(cfgPath, "config", *cfgPath, "Path to kubeadm config file.")
|
||||
}
|
||||
|
|
|
@ -217,10 +217,9 @@ func AddInitConfigFlags(flagSet *flag.FlagSet, cfg *kubeadmapiv1beta1.InitConfig
|
|||
&cfg.Networking.DNSDomain, options.NetworkingDNSDomain, cfg.Networking.DNSDomain,
|
||||
`Use alternative domain for services, e.g. "myorg.internal".`,
|
||||
)
|
||||
flagSet.StringVar(
|
||||
&cfg.KubernetesVersion, options.KubernetesVersion, cfg.KubernetesVersion,
|
||||
`Choose a specific Kubernetes version for the control plane.`,
|
||||
)
|
||||
|
||||
options.AddKubernetesVersionFlag(flagSet, &cfg.KubernetesVersion)
|
||||
|
||||
flagSet.StringVar(
|
||||
&cfg.CertificatesDir, options.CertificatesDir, cfg.CertificatesDir,
|
||||
`The path where to save and store the certificates.`,
|
||||
|
|
|
@ -72,3 +72,11 @@ func AddFeatureGatesStringFlag(fs *pflag.FlagSet, featureGatesString *string) {
|
|||
"No feature gates are available in this release.")
|
||||
}
|
||||
}
|
||||
|
||||
// AddKubernetesVersionFlag adds the --kubernetes-version flag to the given flagset
|
||||
func AddKubernetesVersionFlag(fs *pflag.FlagSet, kubernetesVersion *string) {
|
||||
fs.StringVar(
|
||||
kubernetesVersion, KubernetesVersion, *kubernetesVersion,
|
||||
`Choose a specific Kubernetes version for the control plane.`,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue