@@ -41,13 +41,11 @@ import (
41
41
outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme"
42
42
outputapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
43
43
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
44
- phaseutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases"
45
44
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
46
45
"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs"
47
46
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
48
47
"k8s.io/kubernetes/cmd/kubeadm/app/features"
49
48
"k8s.io/kubernetes/cmd/kubeadm/app/images"
50
- "k8s.io/kubernetes/cmd/kubeadm/app/phases/uploadconfig"
51
49
configutil "k8s.io/kubernetes/cmd/kubeadm/app/util/config"
52
50
kubeconfigutil "k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
53
51
"k8s.io/kubernetes/cmd/kubeadm/app/util/output"
@@ -91,7 +89,6 @@ func NewCmdConfig(out io.Writer) *cobra.Command {
91
89
kubeConfigFile = cmdutil .GetKubeConfigPath (kubeConfigFile )
92
90
cmd .AddCommand (NewCmdConfigPrint (out ))
93
91
cmd .AddCommand (NewCmdConfigMigrate (out ))
94
- cmd .AddCommand (NewCmdConfigUpload (out , & kubeConfigFile ))
95
92
cmd .AddCommand (NewCmdConfigView (out , & kubeConfigFile ))
96
93
cmd .AddCommand (NewCmdConfigImages (out ))
97
94
return cmd
@@ -303,21 +300,6 @@ func NewCmdConfigMigrate(out io.Writer) *cobra.Command {
303
300
return cmd
304
301
}
305
302
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
-
321
303
// NewCmdConfigView returns cobra.Command for "kubeadm config view" command
322
304
func NewCmdConfigView (out io.Writer , kubeConfigFile * string ) * cobra.Command {
323
305
return & cobra.Command {
@@ -341,105 +323,6 @@ func NewCmdConfigView(out io.Writer, kubeConfigFile *string) *cobra.Command {
341
323
}
342
324
}
343
325
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
-
443
326
// RunConfigView gets the configuration persisted in the cluster
444
327
func RunConfigView (out io.Writer , client clientset.Interface ) error {
445
328
0 commit comments