Skip to content

Commit

Permalink
Align integer sizes to address G115
Browse files Browse the repository at this point in the history
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek authored and openshift-merge-bot[bot] committed Sep 24, 2024
1 parent 0fc3170 commit 7d1bde0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions controllers/configurationpolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit 7d1bde0

Please sign in to comment.