1
0
mirror of https://github.com/rancher/os.git synced 2025-08-18 14:58:32 +00:00
os/cmd/ros-operator/main.go

31 lines
594 B
Go
Raw Normal View History

2021-10-20 17:58:54 +00:00
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()
}