diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 6bb2e251..28f6fdba 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -74,6 +74,9 @@ spec: - --health-probe-bind-address=:8081 - --metrics-bind-address=127.0.0.1:8080 - --leader-elect + {{- if .Values.disableIngestionController }} + - --disable-ingestion-controller + {{- end }} {{- with .Values.extraArgs}} {{- toYaml . | nindent 12 }} {{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index 72792c88..9559a14d 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -100,5 +100,8 @@ crd: enabled: true keep: true +# Disable the DruidIngestion controller if the CRD is not installed +disableIngestionController: false + extraArgs: {} #- -zap-devel=false diff --git a/main.go b/main.go index a826a522..33cda78d 100644 --- a/main.go +++ b/main.go @@ -56,11 +56,14 @@ func main() { var metricsAddr string var enableLeaderElection bool var probeAddr string + var disableIngestionController bool flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") + flag.BoolVar(&disableIngestionController, "disable-ingestion-controller", false, + "Disable the DruidIngestion controller. Use this if the DruidIngestion CRD is not installed.") opts := zap.Options{ Development: true, } @@ -100,9 +103,13 @@ func main() { os.Exit(1) } - if err = (druidingestioncontrollers.NewDruidIngestionReconciler(mgr)).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "DruidIngestion") - os.Exit(1) + if !disableIngestionController { + if err = (druidingestioncontrollers.NewDruidIngestionReconciler(mgr)).SetupWithManager(mgr); err != nil { + setupLog.Error(err, "unable to create controller", "controller", "DruidIngestion") + os.Exit(1) + } + } else { + setupLog.Info("DruidIngestion controller is disabled") } //+kubebuilder:scaffold:builder