-
Notifications
You must be signed in to change notification settings - Fork 39
/
main.go
52 lines (40 loc) · 1.26 KB
/
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
45
46
47
48
49
50
51
52
package main
import (
"context"
"os"
"github.com/openshift/library-go/pkg/controller/controllercmd"
"github.com/spf13/cobra"
"k8s.io/component-base/cli"
"github.com/openshift/aws-ebs-csi-driver-operator/pkg/operator"
"github.com/openshift/aws-ebs-csi-driver-operator/pkg/version"
)
func main() {
command := NewOperatorCommand()
code := cli.Run(command)
os.Exit(code)
}
var guestKubeconfig *string
func NewOperatorCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "aws-ebs-csi-driver-operator",
Short: "OpenShift AWS EBS CSI Driver Operator",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
os.Exit(1)
},
}
ctrlCmd := controllercmd.NewControllerCommandConfig(
"aws-ebs-csi-driver-operator",
version.Get(),
// operator.RunOperator,
runOperatorWithGuestKubeconfig,
).NewCommand()
guestKubeconfig = ctrlCmd.Flags().String("guest-kubeconfig", "", "Path to the guest kubeconfig file. This flag enables hypershift integration.")
ctrlCmd.Use = "start"
ctrlCmd.Short = "Start the AWS EBS CSI Driver Operator"
cmd.AddCommand(ctrlCmd)
return cmd
}
func runOperatorWithGuestKubeconfig(ctx context.Context, controllerConfig *controllercmd.ControllerContext) error {
return operator.RunOperator(ctx, controllerConfig, *guestKubeconfig)
}