Skip to content

Commit

Permalink
fixup! Create and delete machines via controller (#36) (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbzzz authored Feb 6, 2024
1 parent c2b2378 commit f1bc15e
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,16 @@ func init() {
}

func main() {
linodeToken := os.Getenv("LINODE_TOKEN")
if linodeToken == "" {
setupLog.Error(errors.New("failed to get LINODE_TOKEN environment variable"), "unable to start operator")
os.Exit(1)
}

var machineWatchFilter string
var clusterWatchFilter string
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var (
// Environment variables
linodeToken string = os.Getenv("LINODE_TOKEN")

machineWatchFilter string
clusterWatchFilter string
metricsAddr string
enableLeaderElection bool
probeAddr string
)
flag.StringVar(&machineWatchFilter, "machine-watch-filter", "", "The machines to watch by label.")
flag.StringVar(&clusterWatchFilter, "cluster-watch-filter", "", "The clusters to watch by label.")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
Expand All @@ -81,6 +80,12 @@ func main() {

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))

// Check environment variables
if linodeToken == "" {
setupLog.Error(errors.New("failed to get LINODE_TOKEN environment variable"), "unable to start operator")
os.Exit(1)
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: metricsserver.Options{BindAddress: metricsAddr},
Expand Down

0 comments on commit f1bc15e

Please sign in to comment.