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 <[email protected]>
  • Loading branch information
dhaiducek authored and openshift-merge-bot[bot] committed Sep 24, 2024
1 parent 4bbe2bd commit d1f2a2f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion api/v1beta1/policyautomation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type AutomationDef struct {
// is "1000".
//
// +kubebuilder:validation:Minimum=0
PolicyViolationsLimit *uint `json:"policyViolationsLimit,omitempty"`
PolicyViolationsLimit *uint16 `json:"policyViolationsLimit,omitempty"`
}

// PolicyAutomationSpec defines how and when automation is initiated for the referenced policy.
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion controllers/automation/policyautomation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (r *PolicyAutomationReconciler) getViolationContext(

policyViolationsLimit := policyAutomation.Spec.Automation.PolicyViolationsLimit
if policyViolationsLimit == nil {
policyViolationsLimit = new(uint)
policyViolationsLimit = new(uint16)
*policyViolationsLimit = policyv1beta1.DefaultPolicyViolationsLimit
}

Expand Down
4 changes: 2 additions & 2 deletions controllers/encryptionkeys/encryptionkeys_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
)

// SetupWithManager sets up the controller with the Manager.
func (r *EncryptionKeysReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles uint) error {
func (r *EncryptionKeysReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles uint16) error {
return ctrl.NewControllerManagedBy(mgr).
// The work queue prevents the same item being reconciled concurrently:
// https://github.com/kubernetes-sigs/controller-runtime/issues/1416#issuecomment-899833144
Expand All @@ -55,7 +55,7 @@ var _ reconcile.Reconciler = &EncryptionKeysReconciler{}
// for all managed clusters.
type EncryptionKeysReconciler struct { //nolint:golint,revive
client.Client
KeyRotationDays uint
KeyRotationDays uint32
Scheme *runtime.Scheme
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/policymetrics/policymetrics_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ControllerName string = "policy-metrics"
var log = ctrl.Log.WithName(ControllerName)

// SetupWithManager sets up the controller with the Manager.
func (r *MetricReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles uint) error {
func (r *MetricReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles uint16) error {
return ctrl.NewControllerManagedBy(mgr).
// The work queue prevents the same item being reconciled concurrently:
// https://github.com/kubernetes-sigs/controller-runtime/issues/1416#issuecomment-899833144
Expand Down
2 changes: 1 addition & 1 deletion controllers/propagator/replicatedpolicy_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

func (r *ReplicatedPolicyReconciler) SetupWithManager(
mgr ctrl.Manager,
maxConcurrentReconciles uint,
maxConcurrentReconciles uint16,
dependenciesSource source.Source,
updateSrc source.Source,
templateSrc source.Source,
Expand Down
2 changes: 1 addition & 1 deletion controllers/propagator/rootpolicy_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
//+kubebuilder:rbac:groups=*,resources=*,verbs=get;list;watch

// SetupWithManager sets up the controller with the Manager.
func (r *RootPolicyReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles uint) error {
func (r *RootPolicyReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles uint16) error {
return ctrl.NewControllerManagedBy(mgr).
WithOptions(controller.Options{MaxConcurrentReconciles: int(maxConcurrentReconciles)}).
Named("root-policy-spec").
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var log = ctrl.Log.WithName(ControllerName)
// SetupWithManager sets up the controller with the Manager.
func (r *RootPolicyStatusReconciler) SetupWithManager(
mgr ctrl.Manager,
maxConcurrentReconciles uint,
maxConcurrentReconciles uint16,
plrsEnabled bool,
) error {
ctrlBldr := ctrl.NewControllerManagedBy(mgr).
Expand Down
24 changes: 12 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ func main() {
secureMetrics bool
enableLeaderElection bool
probeAddr string
keyRotationDays uint
keyRotationMaxConcurrency uint
policyMetricsMaxConcurrency uint
policyStatusMaxConcurrency uint
rootPolicyMaxConcurrency uint
replPolicyMaxConcurrency uint
keyRotationDays uint32
keyRotationMaxConcurrency uint16
policyMetricsMaxConcurrency uint16
policyStatusMaxConcurrency uint16
rootPolicyMaxConcurrency uint16
replPolicyMaxConcurrency uint16
enableWebhooks bool
complianceAPIHost string
complianceAPIPort string
Expand All @@ -143,37 +143,37 @@ func main() {
"Enabling this will ensure there is only one active controller manager.")
pflag.BoolVar(&enableWebhooks, "enable-webhooks", true,
"Enable the policy validating webhook")
pflag.UintVar(
pflag.Uint32Var(
&keyRotationDays,
"encryption-key-rotation",
30,
"The number of days until the policy encryption key is rotated",
)
pflag.UintVar(
pflag.Uint16Var(
&keyRotationMaxConcurrency,
"key-rotation-max-concurrency",
10,
"The maximum number of concurrent reconciles for the policy-encryption-keys controller",
)
pflag.UintVar(
pflag.Uint16Var(
&policyMetricsMaxConcurrency,
"policy-metrics-max-concurrency",
5,
"The maximum number of concurrent reconciles for the policy-metrics controller",
)
pflag.UintVar(
pflag.Uint16Var(
&policyStatusMaxConcurrency,
"policy-status-max-concurrency",
5,
"The maximum number of concurrent reconciles for the policy-status controller",
)
pflag.UintVar(
pflag.Uint16Var(
&rootPolicyMaxConcurrency,
"root-policy-max-concurrency",
2,
"The maximum number of concurrent reconciles for the root-policy controller",
)
pflag.UintVar(
pflag.Uint16Var(
&replPolicyMaxConcurrency,
"replicated-policy-max-concurrency",
10,
Expand Down

0 comments on commit d1f2a2f

Please sign in to comment.