diff --git a/cmd/ansible-operator/main.go b/cmd/ansible-operator/main.go index 61e6200872..192796b709 100644 --- a/cmd/ansible-operator/main.go +++ b/cmd/ansible-operator/main.go @@ -67,13 +67,9 @@ func printVersion() { func main() { f := &flags.Flags{} - err := f.AddTo(pflag.CommandLine) - if err != nil { - log.Error(err, "Failed to add ansible command line flags") - } + f.AddTo(pflag.CommandLine) pflag.Parse() logf.SetLogger(zap.Logger()) - warningMsgForDeprecatedFlags() printVersion() @@ -300,15 +296,3 @@ func getAnsibleDebugLog() bool { } return val } - -// warningMsgForDeprecatedFlags logs warning messages if deprecated flags are used. Currently, -// "--max-workers" is deprecated. Any value provided using this flags will not be used. Instead -// users are directed to use "--max-concurrent-reconciles". -func warningMsgForDeprecatedFlags() { - if pflag.Lookup("max-workers").Changed { - log.Info("Flag --max-workers has been deprecated, use --max-concurrent-reconciles instead") - if pflag.Lookup("max-concurrent-reconciles").Changed { - log.Info("Ignoring --max-workers since --max-concurrent-reconciles is set") - } - } -} diff --git a/pkg/ansible/flags/flag.go b/pkg/ansible/flags/flag.go index abe4c7528c..2b304b68b1 100644 --- a/pkg/ansible/flags/flag.go +++ b/pkg/ansible/flags/flag.go @@ -15,7 +15,6 @@ package flags import ( - "fmt" "runtime" "time" @@ -30,7 +29,6 @@ type Flags struct { WatchesFile string InjectOwnerRef bool MaxConcurrentReconciles int - MaxWorkers int AnsibleVerbosity int AnsibleRolesPath string AnsibleCollectionsPath string @@ -40,7 +38,7 @@ const AnsibleRolesPathEnvVar = "ANSIBLE_ROLES_PATH" const AnsibleCollectionsPathEnvVar = "ANSIBLE_COLLECTIONS_PATH" // AddTo - Add the ansible operator flags to the the flagset -func (f *Flags) AddTo(flagSet *pflag.FlagSet) error { +func (f *Flags) AddTo(flagSet *pflag.FlagSet) { flagSet.AddFlagSet(zap.FlagSet()) flagSet.DurationVar(&f.ReconcilePeriod, "reconcile-period", @@ -57,11 +55,6 @@ func (f *Flags) AddTo(flagSet *pflag.FlagSet) error { true, "The ansible operator will inject owner references unless this flag is false", ) - flagSet.IntVar(&f.MaxWorkers, - "max-workers", - runtime.NumCPU(), - "Maximum number of workers to use. Overridden by environment variable.", - ) flagSet.IntVar(&f.MaxConcurrentReconciles, "max-concurrent-reconciles", runtime.NumCPU(), @@ -82,9 +75,4 @@ func (f *Flags) AddTo(flagSet *pflag.FlagSet) error { "", "Path to installed Ansible Collections. If set, collections should be located in {{value}}/ansible_collections/. If unset, collections are assumed to be in ~/.ansible/collections or /usr/share/ansible/collections.", ) - err := flagSet.MarkDeprecated("max-workers", "use --max-concurrent-reconciles instead.") - if err != nil { - return fmt.Errorf("flag cannot be deprecated %v", err) - } - return nil }