kubeadm: Remove the usage to print the default component configs for reset and join
				
					
				
			component configs is only needed for `kubeadm init`, the `join` and `reset` doesn't need to provid the config with component configs. Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
		| @@ -133,8 +133,10 @@ func newCmdConfigPrintActionDefaults(out io.Writer, action string, configBytesPr | |||||||
| 		}, | 		}, | ||||||
| 		Args: cobra.NoArgs, | 		Args: cobra.NoArgs, | ||||||
| 	} | 	} | ||||||
| 	cmd.Flags().StringSliceVar(&kinds, "component-configs", kinds, | 	if action == "init" { | ||||||
| 		fmt.Sprintf("A comma-separated list for component config API objects to print the default values for. Available values: %v. If this flag is not set, no component configs will be printed.", getSupportedComponentConfigKinds())) | 		cmd.Flags().StringSliceVar(&kinds, "component-configs", kinds, | ||||||
|  | 			fmt.Sprintf("A comma-separated list for component config API objects to print the default values for. Available values: %v. If this flag is not set, no component configs will be printed.", getSupportedComponentConfigKinds())) | ||||||
|  | 	} | ||||||
| 	return cmd | 	return cmd | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -426,56 +426,16 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) { | |||||||
| 			cmdProc:          newCmdConfigPrintInitDefaults, | 			cmdProc:          newCmdConfigPrintInitDefaults, | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			name: "JoinConfiguration: No component configs", | 			name: "JoinConfiguration", | ||||||
| 			expectedKinds: []string{ | 			expectedKinds: []string{ | ||||||
| 				constants.JoinConfigurationKind, | 				constants.JoinConfigurationKind, | ||||||
| 			}, | 			}, | ||||||
| 			cmdProc: newCmdConfigPrintJoinDefaults, | 			cmdProc: newCmdConfigPrintJoinDefaults, | ||||||
| 		}, | 		}, | ||||||
| 		{ | 		{ | ||||||
| 			name: "JoinConfiguration: KubeProxyConfiguration", | 			name:          "ResetConfiguration", | ||||||
| 			expectedKinds: []string{ | 			expectedKinds: []string{constants.ResetConfigurationKind}, | ||||||
| 				constants.JoinConfigurationKind, | 			cmdProc:       newCmdConfigPrintResetDefaults, | ||||||
| 				"KubeProxyConfiguration", |  | ||||||
| 			}, |  | ||||||
| 			componentConfigs: "KubeProxyConfiguration", |  | ||||||
| 			cmdProc:          newCmdConfigPrintJoinDefaults, |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			name: "JoinConfiguration: KubeProxyConfiguration and KubeletConfiguration", |  | ||||||
| 			expectedKinds: []string{ |  | ||||||
| 				constants.JoinConfigurationKind, |  | ||||||
| 				"KubeProxyConfiguration", |  | ||||||
| 				"KubeletConfiguration", |  | ||||||
| 			}, |  | ||||||
| 			componentConfigs: "KubeProxyConfiguration,KubeletConfiguration", |  | ||||||
| 			cmdProc:          newCmdConfigPrintJoinDefaults, |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			name: "ResetConfiguration: No component configs", |  | ||||||
| 			expectedKinds: []string{ |  | ||||||
| 				constants.ResetConfigurationKind, |  | ||||||
| 			}, |  | ||||||
| 			cmdProc: newCmdConfigPrintResetDefaults, |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			name: "JoinConfiguration: KubeProxyConfiguration", |  | ||||||
| 			expectedKinds: []string{ |  | ||||||
| 				"KubeProxyConfiguration", |  | ||||||
| 				constants.ResetConfigurationKind, |  | ||||||
| 			}, |  | ||||||
| 			componentConfigs: "KubeProxyConfiguration", |  | ||||||
| 			cmdProc:          newCmdConfigPrintResetDefaults, |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			name: "JoinConfiguration: KubeProxyConfiguration and KubeletConfiguration", |  | ||||||
| 			expectedKinds: []string{ |  | ||||||
| 				"KubeProxyConfiguration", |  | ||||||
| 				"KubeletConfiguration", |  | ||||||
| 				constants.ResetConfigurationKind, |  | ||||||
| 			}, |  | ||||||
| 			componentConfigs: "KubeProxyConfiguration,KubeletConfiguration", |  | ||||||
| 			cmdProc:          newCmdConfigPrintResetDefaults, |  | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -484,8 +444,10 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) { | |||||||
| 			var output bytes.Buffer | 			var output bytes.Buffer | ||||||
|  |  | ||||||
| 			command := test.cmdProc(&output) | 			command := test.cmdProc(&output) | ||||||
| 			if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil { | 			if test.componentConfigs != "" { | ||||||
| 				t.Fatalf("failed to set component-configs flag") | 				if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil { | ||||||
|  | 					t.Fatalf("failed to set component-configs flag") | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 			if err := command.RunE(nil, nil); err != nil { | 			if err := command.RunE(nil, nil); err != nil { | ||||||
| 				t.Fatalf("Error from running the print command: %v", err) | 				t.Fatalf("Error from running the print command: %v", err) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dave Chen
					Dave Chen