From 7672d8c2f19d680dd96b6fb5b0b11dcad3aee308 Mon Sep 17 00:00:00 2001 From: vmudadla Date: Fri, 13 Oct 2023 11:53:24 -0500 Subject: [PATCH 1/3] Parameterize DSPO max concurrency count --- config/manager/manager.yaml | 1 + controllers/dspipeline_controller.go | 9 +++++---- main.go | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index d765088d0..6870563f3 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -29,6 +29,7 @@ spec: args: - --leader-elect - --zap-log-level=$(ZAP_LOG_LEVEL) + - --MaxConcurrentReconciles=20 - --config - /home/config image: $(IMAGES_DSPO) diff --git a/controllers/dspipeline_controller.go b/controllers/dspipeline_controller.go index 5f87a8545..db981f158 100644 --- a/controllers/dspipeline_controller.go +++ b/controllers/dspipeline_controller.go @@ -48,9 +48,10 @@ const finalizerName = "datasciencepipelinesapplications.opendatahub.io/finalizer // DSPAReconciler reconciles a DSPAParams object type DSPAReconciler struct { client.Client - Scheme *runtime.Scheme - Log logr.Logger - TemplatesPath string + Scheme *runtime.Scheme + Log logr.Logger + TemplatesPath string + MaxConcurrentReconcilesParam int } func (r *DSPAReconciler) Apply(owner mf.Owner, params *DSPAParams, template string, fns ...mf.Transformer) error { @@ -576,7 +577,7 @@ func (r *DSPAReconciler) SetupWithManager(mgr ctrl.Manager) error { })). // TODO: Add watcher for ui cluster rbac since it has no owner WithOptions(controller.Options{ - MaxConcurrentReconciles: config.DefaultMaxConcurrentReconciles, + MaxConcurrentReconciles: r.MaxConcurrentReconcilesParam, }). Complete(r) } diff --git a/main.go b/main.go index 36c72c694..4a6cc6b6b 100644 --- a/main.go +++ b/main.go @@ -103,12 +103,14 @@ func main() { var enableLeaderElection bool var probeAddr string var configPath string + var maxConcurrentReconciles int 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.StringVar(&configPath, "config", "", "Path to JSON file containing config") flag.BoolVar(&enableLeaderElection, "leader-elect", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") + flag.IntVar(&maxConcurrentReconciles, "MaxConcurrentReconciles", config.DefaultMaxConcurrentReconciles, "Maximum concurrent reconciles") opts := zap.Options{ Development: true, TimeEncoder: zapcore.TimeEncoderOfLayout(time.RFC3339), @@ -137,10 +139,11 @@ func main() { } if err = (&controllers.DSPAReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - Log: ctrl.Log, - TemplatesPath: "config/internal/", + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Log: ctrl.Log, + TemplatesPath: "config/internal/", + MaxConcurrentReconcilesParam: maxConcurrentReconciles, }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "DSPAParams") os.Exit(1) From 896453ee945f093e4d200eb8fd20941c286895a8 Mon Sep 17 00:00:00 2001 From: vmudadla Date: Fri, 13 Oct 2023 15:52:30 -0500 Subject: [PATCH 2/3] Added MAX_CONCURRENT_RECONCILES env var and in params --- config/base/kustomization.yaml | 7 +++++++ config/base/params.env | 1 + config/manager/manager.yaml | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/base/kustomization.yaml b/config/base/kustomization.yaml index fc6450c20..80749b52a 100644 --- a/config/base/kustomization.yaml +++ b/config/base/kustomization.yaml @@ -106,5 +106,12 @@ vars: apiVersion: v1 fieldref: fieldpath: data.ZAP_LOG_LEVEL + - name: MAX_CONCURRENT_RECONCILES + objref: + kind: ConfigMap + name: dspo-parameters + apiVersion: v1 + fieldref: + fieldpath: data.MAX_CONCURRENT_RECONCILES configurations: - params.yaml diff --git a/config/base/params.env b/config/base/params.env index 0ad210d41..40e3eddec 100644 --- a/config/base/params.env +++ b/config/base/params.env @@ -11,3 +11,4 @@ IMAGES_MOVERESULTSIMAGE=registry.access.redhat.com/ubi8/ubi-micro:8.8 IMAGES_MARIADB=registry.redhat.io/rhel8/mariadb-103:1 IMAGES_OAUTHPROXY=registry.redhat.io/openshift4/ose-oauth-proxy@sha256:ab112105ac37352a2a4916a39d6736f5db6ab4c29bad4467de8d613e80e9bb33 ZAP_LOG_LEVEL=info +MAX_CONCURRENT_RECONCILES=20 diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 6870563f3..27b136259 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -29,7 +29,7 @@ spec: args: - --leader-elect - --zap-log-level=$(ZAP_LOG_LEVEL) - - --MaxConcurrentReconciles=20 + - --MaxConcurrentReconciles=$(MAX_CONCURRENT_RECONCILES) - --config - /home/config image: $(IMAGES_DSPO) @@ -60,6 +60,8 @@ spec: value: $(IMAGES_MLMDWRITER) - name: ZAP_LOG_LEVEL value: $(ZAP_LOG_LEVEL) + - name: MAX_CONCURRENT_RECONCILES + value: $(MAX_CONCURRENT_RECONCILES) securityContext: allowPrivilegeEscalation: false capabilities: From d57153ff55ab1f1ce0b5ef2a8ec2c14b445173ce Mon Sep 17 00:00:00 2001 From: vmudadla Date: Mon, 16 Oct 2023 15:23:13 -0500 Subject: [PATCH 3/3] Update variable name --- config/base/params.env | 2 +- controllers/dspipeline_controller.go | 10 +++++----- main.go | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/base/params.env b/config/base/params.env index 40e3eddec..3ab9edd3f 100644 --- a/config/base/params.env +++ b/config/base/params.env @@ -11,4 +11,4 @@ IMAGES_MOVERESULTSIMAGE=registry.access.redhat.com/ubi8/ubi-micro:8.8 IMAGES_MARIADB=registry.redhat.io/rhel8/mariadb-103:1 IMAGES_OAUTHPROXY=registry.redhat.io/openshift4/ose-oauth-proxy@sha256:ab112105ac37352a2a4916a39d6736f5db6ab4c29bad4467de8d613e80e9bb33 ZAP_LOG_LEVEL=info -MAX_CONCURRENT_RECONCILES=20 +MAX_CONCURRENT_RECONCILES=10 diff --git a/controllers/dspipeline_controller.go b/controllers/dspipeline_controller.go index db981f158..ced47dce0 100644 --- a/controllers/dspipeline_controller.go +++ b/controllers/dspipeline_controller.go @@ -48,10 +48,10 @@ const finalizerName = "datasciencepipelinesapplications.opendatahub.io/finalizer // DSPAReconciler reconciles a DSPAParams object type DSPAReconciler struct { client.Client - Scheme *runtime.Scheme - Log logr.Logger - TemplatesPath string - MaxConcurrentReconcilesParam int + Scheme *runtime.Scheme + Log logr.Logger + TemplatesPath string + MaxConcurrentReconciles int } func (r *DSPAReconciler) Apply(owner mf.Owner, params *DSPAParams, template string, fns ...mf.Transformer) error { @@ -577,7 +577,7 @@ func (r *DSPAReconciler) SetupWithManager(mgr ctrl.Manager) error { })). // TODO: Add watcher for ui cluster rbac since it has no owner WithOptions(controller.Options{ - MaxConcurrentReconciles: r.MaxConcurrentReconcilesParam, + MaxConcurrentReconciles: r.MaxConcurrentReconciles, }). Complete(r) } diff --git a/main.go b/main.go index 4a6cc6b6b..324b1225e 100644 --- a/main.go +++ b/main.go @@ -139,11 +139,11 @@ func main() { } if err = (&controllers.DSPAReconciler{ - Client: mgr.GetClient(), - Scheme: mgr.GetScheme(), - Log: ctrl.Log, - TemplatesPath: "config/internal/", - MaxConcurrentReconcilesParam: maxConcurrentReconciles, + Client: mgr.GetClient(), + Scheme: mgr.GetScheme(), + Log: ctrl.Log, + TemplatesPath: "config/internal/", + MaxConcurrentReconciles: maxConcurrentReconciles, }).SetupWithManager(mgr); err != nil { setupLog.Error(err, "unable to create controller", "controller", "DSPAParams") os.Exit(1)