mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
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:
parent
5c96e5321e
commit
879dad9c2f
@ -133,8 +133,10 @@ func newCmdConfigPrintActionDefaults(out io.Writer, action string, configBytesPr
|
|||||||
},
|
},
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
}
|
}
|
||||||
|
if action == "init" {
|
||||||
cmd.Flags().StringSliceVar(&kinds, "component-configs", kinds,
|
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()))
|
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,55 +426,15 @@ 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,
|
|
||||||
"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,
|
cmdProc: newCmdConfigPrintResetDefaults,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -484,9 +444,11 @@ func TestNewCmdConfigPrintActionDefaults(t *testing.T) {
|
|||||||
var output bytes.Buffer
|
var output bytes.Buffer
|
||||||
|
|
||||||
command := test.cmdProc(&output)
|
command := test.cmdProc(&output)
|
||||||
|
if test.componentConfigs != "" {
|
||||||
if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil {
|
if err := command.Flags().Set("component-configs", test.componentConfigs); err != nil {
|
||||||
t.Fatalf("failed to set component-configs flag")
|
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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user