Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into ds/f-fixmakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Azadehkhojandi authored Feb 17, 2020
2 parents 62743ae + 984e6ed commit f11b077
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ spec:
secretKeyRef:
name: dbrickssettings
key: DatabricksToken
- name: MAX_CONCURRENT_RUN_RECONCILES
value: "1"
18 changes: 18 additions & 0 deletions controllers/run_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package controllers
import (
"context"
"fmt"
"os"
"strconv"
"time"

"github.com/go-logr/logr"
Expand All @@ -31,8 +33,11 @@ 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"
)

const maxConcurrentReconcilesEnvName = "MAX_CONCURRENT_RUN_RECONCILES"

// RunReconciler reconciles a Run object
type RunReconciler struct {
client.Client
Expand Down Expand Up @@ -110,5 +115,18 @@ 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: getMaxConcurrentReconciles(),
}).
Complete(r)
}

func getMaxConcurrentReconciles() int {
concurrentReconciles, err := strconv.Atoi(os.Getenv(maxConcurrentReconcilesEnvName))

if err != nil || concurrentReconciles < 1 {
return 1
}

return concurrentReconciles
}
12 changes: 12 additions & 0 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,6 +42,16 @@ kubectl --namespace azure-databricks-operator-system \
kubectl apply -f release/config
```

## Configure maximum number of run 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:
Expand Down

0 comments on commit f11b077

Please sign in to comment.