Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup! Missing LINODE_TOKEN error message #82

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading