Skip to content

Commit b51f2c1

Browse files
committed
kubeadm: Remove kubeadm config upload
`kubeadm config upload` is a GA command that has been deprecated and scheduled for removal since Kubernetes 1.15 (released 06/19/2019). This change will finally removed it in Kubernetes 1.19 (planned for August 2020). The original command has long since been replaced by a GA init phase: `kubeadm init phase upload-config` Signed-off-by: Rostislav M. Georgiev <[email protected]>
1 parent 1cbda24 commit b51f2c1

File tree

2 files changed

+0
-119
lines changed

2 files changed

+0
-119
lines changed

cmd/kubeadm/app/cmd/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ go_library(
2323
"//cmd/kubeadm/app/apis/output/v1alpha1:go_default_library",
2424
"//cmd/kubeadm/app/cmd/alpha:go_default_library",
2525
"//cmd/kubeadm/app/cmd/options:go_default_library",
26-
"//cmd/kubeadm/app/cmd/phases:go_default_library",
2726
"//cmd/kubeadm/app/cmd/phases/init:go_default_library",
2827
"//cmd/kubeadm/app/cmd/phases/join:go_default_library",
2928
"//cmd/kubeadm/app/cmd/phases/reset:go_default_library",
@@ -38,7 +37,6 @@ go_library(
3837
"//cmd/kubeadm/app/phases/bootstraptoken/node:go_default_library",
3938
"//cmd/kubeadm/app/phases/certs:go_default_library",
4039
"//cmd/kubeadm/app/phases/kubeconfig:go_default_library",
41-
"//cmd/kubeadm/app/phases/uploadconfig:go_default_library",
4240
"//cmd/kubeadm/app/util:go_default_library",
4341
"//cmd/kubeadm/app/util/apiclient:go_default_library",
4442
"//cmd/kubeadm/app/util/config:go_default_library",

cmd/kubeadm/app/cmd/config.go

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,11 @@ import (
4141
outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme"
4242
outputapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
4343
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
44-
phaseutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases"
4544
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
4645
"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs"
4746
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
4847
"k8s.io/kubernetes/cmd/kubeadm/app/features"
4948
"k8s.io/kubernetes/cmd/kubeadm/app/images"
50-
"k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
5149
configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
5250
kubeconfigutil "k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
5351
"k8s.io/kubernetes/cmd/kubeadm/app/util/output"
@@ -91,7 +89,6 @@ func NewCmdConfig(out io.Writer) *cobra.Command {
9189
kubeConfigFile = cmdutil.GetKubeConfigPath(kubeConfigFile)
9290
cmd.AddCommand(NewCmdConfigPrint(out))
9391
cmd.AddCommand(NewCmdConfigMigrate(out))
94-
cmd.AddCommand(NewCmdConfigUpload(out, &kubeConfigFile))
9592
cmd.AddCommand(NewCmdConfigView(out, &kubeConfigFile))
9693
cmd.AddCommand(NewCmdConfigImages(out))
9794
return cmd
@@ -303,21 +300,6 @@ func NewCmdConfigMigrate(out io.Writer) *cobra.Command {
303300
return cmd
304301
}
305302

306-
// NewCmdConfigUpload (Deprecated) returns cobra.Command for "kubeadm config upload" command
307-
// Deprecated: please see kubeadm init phase upload-config
308-
func NewCmdConfigUpload(out io.Writer, kubeConfigFile *string) *cobra.Command {
309-
cmd := &cobra.Command{
310-
Deprecated: "please see kubeadm init phase upload-config",
311-
Use: "upload",
312-
Short: "Upload configuration about the current state, so that 'kubeadm upgrade' can later know how to configure the upgraded cluster",
313-
RunE: cmdutil.SubCmdRunE("upload"),
314-
}
315-
316-
cmd.AddCommand(NewCmdConfigUploadFromFile(out, kubeConfigFile))
317-
cmd.AddCommand(NewCmdConfigUploadFromFlags(out, kubeConfigFile))
318-
return cmd
319-
}
320-
321303
// NewCmdConfigView returns cobra.Command for "kubeadm config view" command
322304
func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
323305
return &cobra.Command{
@@ -341,105 +323,6 @@ func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
341323
}
342324
}
343325

344-
// NewCmdConfigUploadFromFile verifies given Kubernetes config file and returns cobra.Command for
345-
// "kubeadm config upload from-file" command
346-
// Deprecated: please see kubeadm init phase upload-config
347-
func NewCmdConfigUploadFromFile(out io.Writer, kubeConfigFile *string) *cobra.Command {
348-
var cfgPath string
349-
cmd := &cobra.Command{
350-
Deprecated: "please see kubeadm init phase upload-config",
351-
Use: "from-file",
352-
Short: "Upload a configuration file to the in-cluster ConfigMap for kubeadm configuration",
353-
Long: fmt.Sprintf(dedent.Dedent(`
354-
Using this command, you can upload configuration to the ConfigMap in the cluster using the same config file you gave to 'kubeadm init'.
355-
If you initialized your cluster using a v1.7.x or lower kubeadm client and used the --config option, you need to run this command with the
356-
same config file before upgrading to v1.8 using 'kubeadm upgrade'.
357-
358-
The configuration is located in the %q namespace in the %q ConfigMap.
359-
`), metav1.NamespaceSystem, constants.KubeadmConfigConfigMap),
360-
RunE: func(cmd *cobra.Command, args []string) error {
361-
if len(cfgPath) == 0 {
362-
return errors.New("the --config flag is mandatory")
363-
}
364-
365-
klog.V(1).Infoln("[config] retrieving ClientSet from file")
366-
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
367-
if err != nil {
368-
return err
369-
}
370-
371-
// Default both statically and dynamically, convert to internal API type, and validate everything
372-
internalcfg, err := configutil.LoadInitConfigurationFromFile(cfgPath)
373-
if err != nil {
374-
return err
375-
}
376-
377-
// Upload the configuration using the file
378-
klog.V(1).Infof("[config] uploading configuration")
379-
return uploadconfig.UploadConfiguration(internalcfg, client)
380-
},
381-
Args: cobra.NoArgs,
382-
}
383-
options.AddConfigFlag(cmd.Flags(), &cfgPath)
384-
return cmd
385-
}
386-
387-
// NewCmdConfigUploadFromFlags returns cobra.Command for "kubeadm config upload from-flags" command
388-
// Deprecated: please see kubeadm init phase upload-config
389-
func NewCmdConfigUploadFromFlags(out io.Writer, kubeConfigFile *string) *cobra.Command {
390-
initCfg := &kubeadmapiv1beta2.InitConfiguration{}
391-
kubeadmscheme.Scheme.Default(initCfg)
392-
393-
clusterCfg := &kubeadmapiv1beta2.ClusterConfiguration{}
394-
kubeadmscheme.Scheme.Default(clusterCfg)
395-
396-
var featureGatesString string
397-
398-
cmd := &cobra.Command{
399-
Deprecated: "please see kubeadm init phase upload-config",
400-
Use: "from-flags",
401-
Short: "Create the in-cluster configuration file for the first time from using flags",
402-
Long: fmt.Sprintf(dedent.Dedent(`
403-
Using this command, you can upload configuration to the ConfigMap in the cluster using the same flags you gave to 'kubeadm init'.
404-
If you initialized your cluster using a v1.7.x or lower kubeadm client and set certain flags, you need to run this command with the
405-
same flags before upgrading to v1.8 using 'kubeadm upgrade'.
406-
407-
The configuration is located in the %q namespace in the %q ConfigMap.
408-
`), metav1.NamespaceSystem, constants.KubeadmConfigConfigMap),
409-
RunE: func(cmd *cobra.Command, args []string) error {
410-
var err error
411-
klog.V(1).Infoln("[config] creating new FeatureGates")
412-
if clusterCfg.FeatureGates, err = features.NewFeatureGate(&features.InitFeatureGates, featureGatesString); err != nil {
413-
return nil
414-
}
415-
klog.V(1).Infoln("[config] retrieving ClientSet from file")
416-
client, err := kubeconfigutil.ClientSetFromFile(*kubeConfigFile)
417-
if err != nil {
418-
return err
419-
}
420-
421-
// KubernetesVersion is not used, but we set it explicitly to avoid the lookup
422-
// of the version from the internet when executing DefaultedInitConfiguration
423-
phaseutil.SetKubernetesVersion(clusterCfg)
424-
425-
// Default both statically and dynamically, convert to internal API type, and validate everything
426-
klog.V(1).Infoln("[config] converting to internal API type")
427-
internalcfg, err := configutil.DefaultedInitConfiguration(initCfg, clusterCfg)
428-
if err != nil {
429-
return err
430-
}
431-
432-
// Finally, upload the configuration
433-
klog.V(1).Infof("[config] uploading configuration")
434-
return uploadconfig.UploadConfiguration(internalcfg, client)
435-
},
436-
Args: cobra.NoArgs,
437-
}
438-
AddInitConfigFlags(cmd.PersistentFlags(), initCfg)
439-
AddClusterConfigFlags(cmd.PersistentFlags(), clusterCfg, &featureGatesString)
440-
return cmd
441-
}
442-
443326
// RunConfigView gets the configuration persisted in the cluster
444327
func RunConfigView(out io.Writer, client clientset.Interface) error {
445328

0 commit comments

Comments
 (0)