From 77bfabbe24b2b13cf6686ca639ea4d9997201e80 Mon Sep 17 00:00:00 2001 From: Piyush Darshan Date: Tue, 3 Feb 2026 01:34:19 +0530 Subject: [PATCH] Add flag to disable DruidIngestion controller Add --disable-ingestion-controller flag to allow running the operator without the DruidIngestion CRD installed. This is useful for users who only need the Druid CR functionality. Changes: - main.go: Add flag and conditional controller setup - chart/values.yaml: Add disableIngestionController option - chart/templates/deployment.yaml: Pass flag when enabled --- chart/templates/deployment.yaml | 3 +++ chart/values.yaml | 3 +++ main.go | 13 ++++++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) 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