From c955ec56557af535a1ea5db325019f9f4666c790 Mon Sep 17 00:00:00 2001 From: Eliise S Date: Tue, 28 Jan 2020 15:03:37 +0000 Subject: [PATCH 1/5] Add a static value for MaxConcurrentReconciles --- controllers/run_controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/run_controller.go b/controllers/run_controller.go index 2251027..966f41c 100644 --- a/controllers/run_controller.go +++ b/controllers/run_controller.go @@ -31,6 +31,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" databricksv1alpha1 "github.com/microsoft/azure-databricks-operator/api/v1alpha1" + ctrl_controller "sigs.k8s.io/controller-runtime/pkg/controller" ) // RunReconciler reconciles a Run object @@ -102,5 +103,8 @@ func (r *RunReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { func (r *RunReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&databricksv1alpha1.Run{}). + WithOptions(ctrl_controller.Options{ + MaxConcurrentReconciles: 10, + }). Complete(r) } From be22bd938f6a68d1aef506570eeb1f4ba190fe93 Mon Sep 17 00:00:00 2001 From: Eliise S Date: Tue, 28 Jan 2020 15:18:38 +0000 Subject: [PATCH 2/5] make MaxConcurrentReconciles configurable --- controllers/run_controller.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/controllers/run_controller.go b/controllers/run_controller.go index 966f41c..7ff4e90 100644 --- a/controllers/run_controller.go +++ b/controllers/run_controller.go @@ -19,6 +19,8 @@ package controllers import ( "context" "fmt" + "os" + "strconv" "time" "github.com/go-logr/logr" @@ -34,6 +36,8 @@ import ( ctrl_controller "sigs.k8s.io/controller-runtime/pkg/controller" ) +const maxConcurrentReconcilesEnvName = "MAX_CONCURRENT_RUN_RECONCILERS" + // RunReconciler reconciles a Run object type RunReconciler struct { client.Client @@ -104,7 +108,17 @@ func (r *RunReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&databricksv1alpha1.Run{}). WithOptions(ctrl_controller.Options{ - MaxConcurrentReconciles: 10, + MaxConcurrentReconciles: getMaxConcurrentReconciles(), }). Complete(r) } + +func getMaxConcurrentReconciles() int { + concurrentReconciles, err := strconv.Atoi(os.Getenv(maxConcurrentReconcilesEnvName)) + + if err != nil || concurrentReconciles < 1 { + return 1 + } + + return concurrentReconciles +} From 74d2fe97a08687bd2c1c404e408c02008ff64fbb Mon Sep 17 00:00:00 2001 From: Eliise S Date: Wed, 29 Jan 2020 16:48:06 +0000 Subject: [PATCH 3/5] Add docs --- controllers/run_controller.go | 2 +- docs/deploy.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/controllers/run_controller.go b/controllers/run_controller.go index 7ff4e90..c16fa19 100644 --- a/controllers/run_controller.go +++ b/controllers/run_controller.go @@ -36,7 +36,7 @@ import ( ctrl_controller "sigs.k8s.io/controller-runtime/pkg/controller" ) -const maxConcurrentReconcilesEnvName = "MAX_CONCURRENT_RUN_RECONCILERS" +const maxConcurrentReconcilesEnvName = "MAX_CONCURRENT_RUN_RECONCILES" // RunReconciler reconciles a Run object type RunReconciler struct { diff --git a/docs/deploy.md b/docs/deploy.md index 0fb98fc..e461873 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -19,6 +19,8 @@ wget https://github.com/microsoft/azure-databricks-operator/releases/latest/down unzip release.zip ``` +> (optional) [Configure maximum number of run reconcilers](##configure-maximum-number-of-run-reconcilers) + 2. Create the `azure-databricks-operator-system` namespace: ```sh @@ -40,6 +42,14 @@ kubectl --namespace azure-databricks-operator-system \ kubectl apply -f release/config ``` +## Configure maximum number of run reconcilers + +1. Append the below enviroment variable to `config/default/manager_image_patch.yaml` under the `env` section with the desired number of reconcilers +```yaml + - name: MAX_CONCURRENT_RUN_RECONCILES + value: "1" +``` + ## Use kustomize to customise your deployment 1. Clone the source code: From 973029659e988181f443386e1f1c41ddf3f148ff Mon Sep 17 00:00:00 2001 From: Eliise S Date: Wed, 5 Feb 2020 10:28:15 +0000 Subject: [PATCH 4/5] Add MAX_CONCURRENT_RUN_RECONCILES to yaml --- config/default/manager_image_patch.yaml | 2 ++ docs/deploy.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/default/manager_image_patch.yaml b/config/default/manager_image_patch.yaml index 627d68b..fd37b8d 100644 --- a/config/default/manager_image_patch.yaml +++ b/config/default/manager_image_patch.yaml @@ -21,3 +21,5 @@ spec: secretKeyRef: name: dbrickssettings key: DatabricksToken + - name: MAX_CONCURRENT_RUN_RECONCILES + value: "1" diff --git a/docs/deploy.md b/docs/deploy.md index e461873..e75385b 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -44,7 +44,7 @@ kubectl apply -f release/config ## Configure maximum number of run reconcilers -1. Append the below enviroment variable to `config/default/manager_image_patch.yaml` under the `env` section with the desired number of reconcilers +1. Change the `MAX_CONCURRENT_RUN_RECONCILES` value to `config/default/manager_image_patch.yaml` under the `env` section with the desired number of reconcilers ```yaml - name: MAX_CONCURRENT_RUN_RECONCILES value: "1" From 02d70760b44ab726402409c34b6362d8e590320a Mon Sep 17 00:00:00 2001 From: Eliise S Date: Wed, 5 Feb 2020 10:32:39 +0000 Subject: [PATCH 5/5] Fix sentence structure --- docs/deploy.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/deploy.md b/docs/deploy.md index e75385b..7fa78d4 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -44,12 +44,14 @@ kubectl apply -f release/config ## Configure maximum number of run reconcilers -1. Change the `MAX_CONCURRENT_RUN_RECONCILES` value to `config/default/manager_image_patch.yaml` under the `env` section with the desired number of reconcilers +1. Change the `MAX_CONCURRENT_RUN_RECONCILES` value in `config/default/manager_image_patch.yaml` under the `env` section with the desired number of reconcilers ```yaml - name: MAX_CONCURRENT_RUN_RECONCILES value: "1" ``` +> By default `MAX_CONCURRENT_RUN_RECONCILES` is set to 1 + ## Use kustomize to customise your deployment 1. Clone the source code: