diff --git a/controllers/configurationpolicy_controller.go b/controllers/configurationpolicy_controller.go index 89d113e0..12d71e75 100644 --- a/controllers/configurationpolicy_controller.go +++ b/controllers/configurationpolicy_controller.go @@ -103,7 +103,7 @@ func init() { // SetupWithManager sets up the controller with the Manager. func (r *ConfigurationPolicyReconciler) SetupWithManager( - mgr ctrl.Manager, evaluationConcurrency uint8, rawSources ...source.TypedSource[reconcile.Request], + mgr ctrl.Manager, evaluationConcurrency uint16, rawSources ...source.TypedSource[reconcile.Request], ) error { builder := ctrl.NewControllerManagedBy(mgr). Named(ControllerName). @@ -199,7 +199,7 @@ type ConfigurationPolicyReconciler struct { UninstallMode bool // The number of seconds before a policy is eligible for reevaluation in watch mode (throttles frequently evaluated // policies) - EvalBackoffSeconds uint + EvalBackoffSeconds uint32 // lastEvaluatedCache contains the value of ConfigurationPolicyStatus.LastEvaluated per ConfigurationPolicy UID. // This is a workaround to account for race conditions where the status is updated but the controller-runtime cache // has not updated yet. diff --git a/main.go b/main.go index 2915d738..43bf3699 100644 --- a/main.go +++ b/main.go @@ -95,10 +95,10 @@ type ctrlOpts struct { probeAddr string operatorPolDefaultNS string clientQPS float32 - clientBurst uint - evalBackoffSeconds uint + clientBurst uint16 + evalBackoffSeconds uint32 decryptionConcurrency uint8 - evaluationConcurrency uint8 + evaluationConcurrency uint16 enableLease bool enableLeaderElection bool enableMetrics bool @@ -668,7 +668,7 @@ func handleTriggerUninstall() { triggerUninstallFlagSet := pflag.NewFlagSet("trigger-uninstall", pflag.ExitOnError) var deploymentName, deploymentNamespace, policyNamespace string - var timeoutSeconds uint + var timeoutSeconds uint32 triggerUninstallFlagSet.StringVar( &deploymentName, "deployment-name", "config-policy-controller", "The name of the controller Deployment object", @@ -682,7 +682,7 @@ func handleTriggerUninstall() { triggerUninstallFlagSet.StringVar( &policyNamespace, "policy-namespace", "", "The namespace of where ConfigurationPolicy objects are stored", ) - triggerUninstallFlagSet.UintVar( + triggerUninstallFlagSet.Uint32Var( &timeoutSeconds, "timeout-seconds", 300, "The number of seconds before the operation is canceled", ) triggerUninstallFlagSet.AddGoFlagSet(flag.CommandLine) @@ -721,7 +721,7 @@ func handleTriggerUninstall() { func parseOpts(flags *pflag.FlagSet, args []string) *ctrlOpts { opts := &ctrlOpts{} - flags.UintVar( + flags.Uint32Var( &opts.evalBackoffSeconds, "evaluation-backoff", 10, @@ -793,7 +793,7 @@ func parseOpts(flags *pflag.FlagSet, args []string) *ctrlOpts { "The max number of concurrent policy template decryptions", ) - flags.Uint8Var( + flags.Uint16Var( &opts.evaluationConcurrency, "evaluation-concurrency", // Set a low default to not add too much load to the Kubernetes API server in resource constrained deployments. @@ -816,7 +816,7 @@ func parseOpts(flags *pflag.FlagSet, args []string) *ctrlOpts { "Will scale with concurrency, if not explicitly set.", ) - flags.UintVar( + flags.Uint16Var( &opts.clientBurst, "client-burst", 45, // the controller-runtime defaults are 20:30 (qps:burst) - this matches that ratio @@ -854,7 +854,7 @@ func parseOpts(flags *pflag.FlagSet, args []string) *ctrlOpts { } if !flags.Changed("client-burst") { - opts.clientBurst = uint(opts.evaluationConcurrency)*22 + 1 + opts.clientBurst = opts.evaluationConcurrency*22 + 1 } }