-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
44 lines (37 loc) · 947 Bytes
/
main.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
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"os"
"github.com/openshift/crd-schema-checker/pkg/cmd/checkadmission"
"github.com/openshift/crd-schema-checker/pkg/cmd/checkmanifests"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/component-base/cli"
)
func main() {
command := newCommand()
code := cli.Run(command)
os.Exit(code)
}
func newCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "crd-schema-checker",
Short: "Check CRD schemas for compatibility",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
os.Exit(1)
},
}
//if v := version.Get().String(); len(v) == 0 {
// cmd.Version = "<unknown>"
//} else {
// cmd.Version = v
//}
streams := genericclioptions.IOStreams{
In: os.Stdin,
Out: os.Stdout,
ErrOut: os.Stderr,
}
cmd.AddCommand(checkmanifests.NewCheckManifestsCommand(streams))
cmd.AddCommand(checkadmission.NewCommandStartAdmissionServer(streams))
return cmd
}