@@ -15,7 +15,7 @@ import (
1515 "github.com/rancher/wrangler/v3/pkg/kubeconfig"
1616 "github.com/rancher/wrangler/v3/pkg/signals"
1717 "github.com/sirupsen/logrus"
18- "github.com/urfave/cli"
18+ "github.com/urfave/cli/v2 "
1919
2020 "log"
2121 "net/http"
@@ -60,79 +60,79 @@ func main() {
6060 app .Version = fmt .Sprintf ("%s (%s)" , Version , GitCommit )
6161 app .Usage = "cis-operator needs help!"
6262 app .Flags = []cli.Flag {
63- cli.StringFlag {
63+ & cli.StringFlag {
6464 Name : "kubeconfig" ,
65- EnvVar : "KUBECONFIG" ,
65+ EnvVars : [] string { "KUBECONFIG" } ,
6666 Destination : & kubeConfig ,
6767 },
68- cli.IntFlag {
68+ & cli.IntFlag {
6969 Name : "threads" ,
70- EnvVar : "CIS_OPERATOR_THREADS" ,
70+ EnvVars : [] string { "CIS_OPERATOR_THREADS" } ,
7171 Value : 2 ,
7272 Destination : & threads ,
7373 },
74- cli.StringFlag {
74+ & cli.StringFlag {
7575 Name : "name" ,
76- EnvVar : "CIS_OPERATOR_NAME" ,
76+ EnvVars : [] string { "CIS_OPERATOR_NAME" } ,
7777 Value : "cis-operator" ,
7878 Destination : & name ,
7979 },
80- cli.StringFlag {
80+ & cli.StringFlag {
8181 Name : "security-scan-image" ,
82- EnvVar : "SECURITY_SCAN_IMAGE" ,
82+ EnvVars : [] string { "SECURITY_SCAN_IMAGE" } ,
8383 Value : "rancher/security-scan" ,
8484 Destination : & securityScanImage ,
8585 },
86- cli.StringFlag {
86+ & cli.StringFlag {
8787 Name : "security-scan-image-tag" ,
88- EnvVar : "SECURITY_SCAN_IMAGE_TAG" ,
88+ EnvVars : [] string { "SECURITY_SCAN_IMAGE_TAG" } ,
8989 Value : "latest" ,
9090 Destination : & securityScanImageTag ,
9191 },
92- cli.StringFlag {
92+ & cli.StringFlag {
9393 Name : "sonobuoy-image" ,
94- EnvVar : "SONOBUOY_IMAGE" ,
94+ EnvVars : [] string { "SONOBUOY_IMAGE" } ,
9595 Value : "rancher/sonobuoy-sonobuoy" ,
9696 Destination : & sonobuoyImage ,
9797 },
98- cli.StringFlag {
98+ & cli.StringFlag {
9999 Name : "sonobuoy-image-tag" ,
100- EnvVar : "SONOBUOY_IMAGE_TAG" ,
100+ EnvVars : [] string { "SONOBUOY_IMAGE_TAG" } ,
101101 Value : "latest" ,
102102 Destination : & sonobuoyImageTag ,
103103 },
104- cli.StringFlag {
104+ & cli.StringFlag {
105105 Name : "cis_metrics_port" ,
106- EnvVar : "CIS_METRICS_PORT" ,
106+ EnvVars : [] string { "CIS_METRICS_PORT" } ,
107107 Value : "8080" ,
108108 Destination : & metricsPort ,
109109 },
110- cli.BoolFlag {
110+ & cli.BoolFlag {
111111 Name : "debug" ,
112- EnvVar : "CIS_OPERATOR_DEBUG" ,
112+ EnvVars : [] string { "CIS_OPERATOR_DEBUG" } ,
113113 Destination : & debug ,
114114 },
115- cli.StringFlag {
115+ & cli.StringFlag {
116116 Name : "alertSeverity" ,
117- EnvVar : "CIS_ALERTS_SEVERITY" ,
117+ EnvVars : [] string { "CIS_ALERTS_SEVERITY" } ,
118118 Value : "warning" ,
119119 Destination : & alertSeverity ,
120120 },
121- cli.StringFlag {
121+ & cli.StringFlag {
122122 Name : "clusterName" ,
123- EnvVar : "CLUSTER_NAME" ,
123+ EnvVars : [] string { "CLUSTER_NAME" } ,
124124 Value : "" ,
125125 Destination : & clusterName ,
126126 },
127- cli.StringFlag {
127+ & cli.StringFlag {
128128 Name : "security-scan-job-tolerations" ,
129- EnvVar : "SECURITY_SCAN_JOB_TOLERATIONS" ,
129+ EnvVars : [] string { "SECURITY_SCAN_JOB_TOLERATIONS" } ,
130130 Value : "" ,
131131 Destination : & securityScanJobTolerationsVal ,
132132 },
133- cli.BoolFlag {
134- Name : "alertEnabled" ,
135- EnvVar : "CIS_ALERTS_ENABLED" ,
133+ & cli.BoolFlag {
134+ Name : "alertEnabled" ,
135+ EnvVars : [] string { "CIS_ALERTS_ENABLED" } ,
136136 },
137137 }
138138 app .Action = run
@@ -142,7 +142,7 @@ func main() {
142142 }
143143}
144144
145- func run (c * cli.Context ) {
145+ func run (c * cli.Context ) error {
146146 logrus .Info ("Starting CIS-Operator" )
147147
148148 ctx := context .Background ()
@@ -212,6 +212,7 @@ func run(c *cli.Context) {
212212 <- handler
213213 ctx .Done ()
214214 logrus .Info ("Registered CIS controller" )
215+ return nil
215216}
216217
217218func validateConfig (imgConfig * cisoperatorapiv1.ScanImageConfig ) error {
0 commit comments