Skip to content

Commit 4606c46

Browse files
authored
Merge pull request #5479 from k0sproject/revert-5376-remove-deprecated-subcommands
Revert "Remove default-config and validate sub-commands"
2 parents 70f1bcf + 5310ef9 commit 4606c46

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

cmd/root.go

+11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/k0sproject/k0s/cmd/stop"
3434
"github.com/k0sproject/k0s/cmd/sysinfo"
3535
"github.com/k0sproject/k0s/cmd/token"
36+
"github.com/k0sproject/k0s/cmd/validate"
3637
"github.com/k0sproject/k0s/cmd/version"
3738
"github.com/k0sproject/k0s/cmd/worker"
3839
internallog "github.com/k0sproject/k0s/internal/pkg/log"
@@ -86,10 +87,12 @@ func NewRootCmd() *cobra.Command {
8687
cmd.AddCommand(stop.NewStopCmd())
8788
cmd.AddCommand(sysinfo.NewSysinfoCmd())
8889
cmd.AddCommand(token.NewTokenCmd())
90+
cmd.AddCommand(validate.NewValidateCmd()) // hidden+deprecated
8991
cmd.AddCommand(version.NewVersionCmd())
9092
cmd.AddCommand(worker.NewWorkerCmd())
9193

9294
cmd.AddCommand(newCompletionCmd())
95+
cmd.AddCommand(newDefaultConfigCmd()) // hidden+deprecated
9396
cmd.AddCommand(newDocsCmd())
9497

9598
addPlatformSpecificCommands(cmd)
@@ -121,6 +124,14 @@ func newDocsCmd() *cobra.Command {
121124
}
122125
}
123126

127+
func newDefaultConfigCmd() *cobra.Command {
128+
cmd := configcmd.NewCreateCmd()
129+
cmd.Hidden = true
130+
cmd.Deprecated = "use 'k0s config create' instead"
131+
cmd.Use = "default-config"
132+
return cmd
133+
}
134+
124135
func newCompletionCmd() *cobra.Command {
125136
return &cobra.Command{
126137
Use: "completion {bash|zsh|fish|powershell}",

cmd/validate/validate.go

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2025 k0s authors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package validate
18+
19+
import (
20+
configcmd "github.com/k0sproject/k0s/cmd/config"
21+
22+
"github.com/spf13/cobra"
23+
)
24+
25+
// TODO deprecated, remove when appropriate
26+
func NewValidateCmd() *cobra.Command {
27+
cmd := &cobra.Command{
28+
Use: "validate",
29+
Short: "Validation related sub-commands",
30+
Hidden: true,
31+
Deprecated: "use 'k0s config validate' instead",
32+
}
33+
cmd.AddCommand(newConfigCmd())
34+
return cmd
35+
}
36+
37+
func newConfigCmd() *cobra.Command {
38+
cmd := configcmd.NewValidateCmd()
39+
cmd.Use = "config"
40+
cmd.Deprecated = "use 'k0s config validate' instead"
41+
cmd.Hidden = false
42+
return cmd
43+
}

0 commit comments

Comments
 (0)