diff --git a/cmd/main.go b/cmd/main.go index d72fdc5..7e99f8d 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -18,7 +18,6 @@ package main import ( "flag" - "fmt" "os" // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) @@ -52,18 +51,18 @@ func init() { } // getWatchNamespace returns the Namespace the operator should be watching for changes -func getWatchNamespace() string { - // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE - // which specifies the Namespace to watch. - // An empty value means the operator will fail to start. - watchNamespaceEnvVar := "CONTROLLER_NAMESPACE" - - ns, found := os.LookupEnv(watchNamespaceEnvVar) - if !found { - panic(fmt.Sprintf("env var '%s' must be set", watchNamespaceEnvVar)) - } - return ns -} +// func getWatchNamespace() string { +// // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE +// // which specifies the Namespace to watch. +// // An empty value means the operator will fail to start. +// watchNamespaceEnvVar := "CONTROLLER_NAMESPACE" + +// ns, found := os.LookupEnv(watchNamespaceEnvVar) +// if !found { +// panic(fmt.Sprintf("env var '%s' must be set", watchNamespaceEnvVar)) +// } +// return ns +// } func main() { var metricsAddr string diff --git a/internal/controller/shim_controller.go b/internal/controller/shim_controller.go index f02d364..337e904 100644 --- a/internal/controller/shim_controller.go +++ b/internal/controller/shim_controller.go @@ -119,7 +119,10 @@ func (sr *ShimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl // 4. Deploy job to each node in list if len(nodes.Items) != 0 { - sr.handleDeployJob(ctx, &shimResource, nodes, req) + _, err = sr.handleDeployJob(ctx, &shimResource, nodes, req) + if err != nil { + return ctrl.Result{}, err + } } else { log.Info().Msg("No nodes found") }