Skip to content

Commit

Permalink
Make number of workers configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
dthomson25 committed Jul 15, 2019
1 parent f3b383a commit bb5592e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
8 changes: 7 additions & 1 deletion cmd/rollouts-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func newCommand() *cobra.Command {
logLevel string
glogLevel int
metricsPort int
rolloutThreads int
experimentThreads int
serviceThreads int
)
var command = cobra.Command{
Use: cliName,
Expand Down Expand Up @@ -90,7 +93,7 @@ func newCommand() *cobra.Command {
kubeInformerFactory.Start(stopCh)
argoRolloutsInformerFactory.Start(stopCh)

if err = cm.Run(1, 1, 1, stopCh); err != nil {
if err = cm.Run(rolloutThreads, serviceThreads, experimentThreads, stopCh); err != nil {
glog.Fatalf("Error running controller: %s", err.Error())
}
return nil
Expand All @@ -101,6 +104,9 @@ func newCommand() *cobra.Command {
command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.Flags().IntVar(&glogLevel, "gloglevel", 0, "Set the glog logging level")
command.Flags().IntVar(&metricsPort, "metricsport", controller.DefaultMetricsPort, "Set the port the metrics endpoint should be exposed over")
command.Flags().IntVar(&rolloutThreads, "rollout-threads", controller.DefaultRolloutThreads, "Set the number of worker threads for the Rollout controller")
command.Flags().IntVar(&experimentThreads, "experiment-threads", controller.DefaultExperimentThreads, "Set the number of worker threads for the Experimentd controller")
command.Flags().IntVar(&serviceThreads, "service-threads", controller.DefaultServiceThreads, "Set the number of worker threads for the Service controller")
return &command
}

Expand Down
9 changes: 9 additions & 0 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ const (

// DefaultMetricsPort Default port to expose the metrics endpoint
DefaultMetricsPort = 8090

// DefaultRolloutThreads Default numnber of worker threads to start with the controller
DefaultRolloutThreads = 1

// DefaultRolloutThreads Default numnber of worker threads to start with the controller
DefaultExperimentThreads = 1

// DefaultRolloutThreads Default numnber of worker threads to start with the controller
DefaultServiceThreads = 1
)

// Manager is the controller implementation for Argo-Rollout resources
Expand Down
7 changes: 3 additions & 4 deletions experiments/controller.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package experiments

import (
"time"
"fmt"
"time"

log "github.com/sirupsen/logrus"
appsv1 "k8s.io/api/apps/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1"
"k8s.io/client-go/kubernetes"
appslisters "k8s.io/client-go/listers/apps/v1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"

"github.com/argoproj/argo-rollouts/controller/metrics"
"github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
Expand All @@ -25,7 +25,6 @@ import (
listers "github.com/argoproj/argo-rollouts/pkg/client/listers/rollouts/v1alpha1"
controllerutil "github.com/argoproj/argo-rollouts/utils/controller"
logutil "github.com/argoproj/argo-rollouts/utils/log"

)

// ExperimentController is the controller implementation for Experiment resources
Expand Down

0 comments on commit bb5592e

Please sign in to comment.