-
Notifications
You must be signed in to change notification settings - Fork 1
/
compliance.go
59 lines (48 loc) · 1.74 KB
/
compliance.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package cmd
import (
"io"
"github.com/heptio/sonobuoy/pkg/buildinfo"
"github.com/spf13/cobra"
)
// TODO change the name of the namespace to something more jx specific (e.g. jx-compliance), but
// at this time the Sonobuoy does not run properly into a custom namespace.
const complianceNamespace = "heptio-sonobuoy"
// kubeConformanceImage is the URL of the docker image to run for the kube conformance tests
const kubeConformanceImage = "gcr.io/heptio-images/kube-conformance:latest"
// compliance is the URL of the docker image to run for the Sonobuoy aggregator and workers
var complianceImage = "gcr.io/heptio-images/sonobuoy:" + buildinfo.Version
// ComplianceOptions options for compliance command
type ComplianceOptions struct {
CommonOptions
}
// NewCompliance creates a command object for the generic "compliance" action, which
// executes the compliance tests against a Kubernetes cluster
func NewCompliance(f Factory, out io.Writer, errOut io.Writer) *cobra.Command {
options := &ComplianceOptions{
CommonOptions: CommonOptions{
Factory: f,
Out: out,
Err: errOut,
},
}
cmd := &cobra.Command{
Use: "compliance ACTION [flags]",
Short: "Run compliance tests against Kubernetes cluster",
Run: func(cmd *cobra.Command, args []string) {
options.Cmd = cmd
options.Args = args
err := options.Run()
CheckErr(err)
},
}
cmd.AddCommand(NewCmdComplianceStatus(f, out, errOut))
cmd.AddCommand(NewCmdComplianceResults(f, out, errOut))
cmd.AddCommand(NewCmdComplianceRun(f, out, errOut))
cmd.AddCommand(NewCmdComplianceDelete(f, out, errOut))
cmd.AddCommand(NewCmdComplianceLogs(f, out, errOut))
return cmd
}
// Run implements the compliance root command
func (o *ComplianceOptions) Run() error {
return o.Cmd.Help()
}