1
0
mirror of https://github.com/rancher/os.git synced 2025-08-18 06:49:02 +00:00
os/cmd/ros-operator/main.go
Darren Shepherd 5675644d9f Add operator
2021-10-20 10:58:54 -07:00

31 lines
594 B
Go

package main
import (
"context"
"flag"
"os"
"github.com/rancher/os/pkg/operator"
"github.com/rancher/wrangler/pkg/signals"
"github.com/sirupsen/logrus"
)
var (
namespace = flag.String("namespace", "cattle-rancheros-operator-system", "Namespace of the pod")
)
func main() {
flag.Parse()
logrus.Info("Starting controller")
ctx := signals.SetupSignalHandler(context.Background())
if os.Getenv("NAMESPACE") != "" {
*namespace = os.Getenv("NAMESPACE")
}
if err := operator.Run(ctx, *namespace); err != nil {
logrus.Fatalf("Error starting: %s", err.Error())
}
<-ctx.Done()
}