-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
daemonset.go
31 lines (28 loc) · 886 Bytes
/
daemonset.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cmd
import (
"github.com/spf13/cobra"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"github.com/Ladicle/kubectl-check/pkg/checker"
"github.com/Ladicle/kubectl-check/pkg/pritty"
dcmdutil "github.com/Ladicle/kubectl-check/pkg/util/cmd"
)
func NewDaemonSetCmd(f cmdutil.Factory, printer *pritty.Printer) *cobra.Command {
opts := CmdOptions{
Resource: "DaemonSet",
createCheckerFn: func(opts *checker.Options) checker.Checker {
return checker.NewDaemonSetChecker(opts)
},
}
cmd := &cobra.Command{
Use: "daemonset [flags...] <name>",
Aliases: []string{"ds"},
DisableFlagsInUseLine: true,
Short: "Check DaemonSet resource",
Run: func(cmd *cobra.Command, args []string) {
dcmdutil.CheckErr(opts.Validate(args))
dcmdutil.CheckErr(opts.Complete(f))
dcmdutil.CheckErr(opts.Run(printer))
},
}
return cmd
}