mirror of
https://github.com/rancher/os.git
synced 2025-09-10 19:20:55 +00:00
Add operator
This commit is contained in:
30
cmd/ros-operator/main.go
Normal file
30
cmd/ros-operator/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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()
|
||||
}
|
Reference in New Issue
Block a user