diff --git a/controllers/spaceprovisionerconfig/spaceprovisionerconfig_controller.go b/controllers/spaceprovisionerconfig/spaceprovisionerconfig_controller.go index 91b2c7365..5410ae618 100644 --- a/controllers/spaceprovisionerconfig/spaceprovisionerconfig_controller.go +++ b/controllers/spaceprovisionerconfig/spaceprovisionerconfig_controller.go @@ -184,6 +184,7 @@ func (r *Reconciler) determineCapacityReadyState(spc *toolchainv1alpha1.SpacePro // It always knows this fact so returning a bool is ok, in contrast to determinMemoryUtilizationReadyState. func determineSpaceCountReadyState(spc *toolchainv1alpha1.SpaceProvisionerConfig) bool { max := spc.Spec.CapacityThresholds.MaxNumberOfSpaces + //the value of this is not going beyond 100 and it won't overflow, hence its okay to ignore the overflow linter error return max == 0 || max > uint(spc.Status.ConsumedCapacity.SpaceCount) // nolint:gosec } @@ -203,6 +204,7 @@ func determineMemoryUtilizationReadyState(spc *toolchainv1alpha1.SpaceProvisione // the memory utilitzation is ok if it is below the threshold in all node types for _, val := range spc.Status.ConsumedCapacity.MemoryUsagePercentPerNodeRole { + //the value of this is not going beyond 100 and it won't overflow, hence its okay to ignore the overflow linter error if uint(val) >= spc.Spec.CapacityThresholds.MaxMemoryUtilizationPercent { // nolint:gosec return corev1.ConditionFalse } diff --git a/pkg/capacity/manager.go b/pkg/capacity/manager.go index b019b971b..2a0676f0b 100644 --- a/pkg/capacity/manager.go +++ b/pkg/capacity/manager.go @@ -21,6 +21,7 @@ type ( func hasNotReachedMaxNumberOfSpacesThreshold(counts counter.Counts) spaceProvisionerConfigPredicate { return func(spc *toolchainv1alpha1.SpaceProvisionerConfig) bool { + //the value of this is not going beyond 100 and it won't overflow, hence its okay to ignore the overflow linter error numberOfSpaces := uint(counts.SpacesPerClusterCounts[spc.Spec.ToolchainCluster]) // nolint:gosec threshold := spc.Spec.CapacityThresholds.MaxNumberOfSpaces return threshold == 0 || numberOfSpaces < threshold @@ -45,6 +46,7 @@ func hasEnoughMemoryCapacity(status *toolchainv1alpha1.ToolchainStatus) spacePro func hasMemberEnoughMemoryCapacity(memberStatus toolchainv1alpha1.Member, threshold uint) bool { if len(memberStatus.MemberStatus.ResourceUsage.MemoryUsagePerNodeRole) > 0 { for _, usagePerNode := range memberStatus.MemberStatus.ResourceUsage.MemoryUsagePerNodeRole { + //the value of this is not going beyond 100 and it won't overflow, hence its okay to ignore the overflow linter error if uint(usagePerNode) >= threshold { // nolint:gosec return false } diff --git a/pkg/space/space.go b/pkg/space/space.go index 946289cdb..69b8ea122 100644 --- a/pkg/space/space.go +++ b/pkg/space/space.go @@ -46,6 +46,7 @@ func NewSpaceWithFeatureToggles(userSignup *toolchainv1alpha1.UserSignup, target func addFeatureToggles(space *toolchainv1alpha1.Space, toggles []toolchainconfig.FeatureToggle) { var winners []string for _, t := range toggles { + //the value of this is not going beyond 100 and it won't overflow, hence its okay to ignore the overflow linter error weight := int(t.Weight()) // nolint:gosec // We generate a random number between 0 and 100. If the number is equal to or lower than the weight // then the feature wins.