Skip to content

deprecate the flag --max-worker and replace it for max-concurrent-reconciles and use the num of CPU as default value.  #3360

@camilamacedo86

Description

@camilamacedo86

The --max-workers flag does not align well with the name of the option it configures on the controllers and the new layout. So, we need to deprecate the flag --max-worker and replace it for max-concurrent-reconciles. Also, note the default size should runtime.NumCPU().

Note that we need to update the implementation in cmd/helm|ansible-operator/main.go which is used to generate bin. See: #3331

Example:

	//   (MaxConcurrentReconciles). Flag `--max-concurrent-reconciles` should be used instead.
	pflag.IntVar(&defaultMaxWorkers, "max-workers", runtime.NumCPU(), "Default maximum number of concurrent reconciles for controllers.")
	if err := pflag.CommandLine.MarkHidden("max-workers"); err != nil {
		setupLog.Error(err, "failed to hide --max-workers flag")
		os.Exit(1)
	}

....

	// Deprecated: --max-workers flag does not align well with the name of the option it configures on the controller
	//   (MaxConcurrentReconciles). Flag `--max-concurrent-reconciles` should be used instead.
	if pflag.Lookup("max-workers").Changed {
		setupLog.Info("flag --max-workers has been deprecated, use --max-concurrent-reconciles instead")
		if pflag.Lookup("max-concurrent-reconciles").Changed {
			setupLog.Info("ignoring --max-workers since --max-concurrent-reconciles is set")
		} else {
			defaultMaxConcurrentReconciles = defaultMaxWorkers
		}
	}

...

Metadata

Metadata

Labels

kubebuilder-integrationRelates to rewriting the SDK in Kubebuilder plugin formlanguage/ansibleIssue is related to an Ansible operator projectlanguage/helmIssue is related to a Helm operator project

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions