Skip to content

Commit

Permalink
Add some nolint
Browse files Browse the repository at this point in the history
  • Loading branch information
andyasp committed Aug 15, 2024
1 parent e439130 commit ee310e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/admission/prep_downscale.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,22 @@ func prepareDownscale(ctx context.Context, l log.Logger, ar v1.AdmissionReview,
msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v was downscaled at %v and is labelled to wait %s between zone downscales",
ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.lastDownscaleTime, foundSts.waitTime)
level.Warn(logger).Log("msg", msg, "err", err)
//nolint:govet
return deny(msg)
}
foundSts, err = findStatefulSetWithNonUpdatedReplicas(ctx, api, ar.Request.Namespace, stsList, ar.Request.Name)
if err != nil {
msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because an error occurred while checking whether StatefulSets have non-updated replicas",
ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas)
level.Warn(logger).Log("msg", msg, "err", err)
//nolint:govet
return deny(msg)
}
if foundSts != nil {
msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v has %d non-updated replicas and %d non-ready replicas",
ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.nonUpdatedReplicas, foundSts.nonReadyReplicas)
level.Warn(logger).Log("msg", msg)
//nolint:govet
return deny(msg)
}
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/admission/zone_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,22 @@ func (zt *zoneTracker) prepareDownscale(ctx context.Context, l log.Logger, ar v1
msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v was downscaled at %v and is labelled to wait %s between zone downscales",
ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.lastDownscaleTime, foundSts.waitTime)
level.Warn(logger).Log("msg", msg, "err", err)
//nolint:govet
return deny(msg)
}
foundSts, err = findStatefulSetWithNonUpdatedReplicas(ctx, api, ar.Request.Namespace, stsList, ar.Request.Name)
if err != nil {
msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because an error occurred while checking whether StatefulSets have non-updated replicas",
ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas)
level.Warn(logger).Log("msg", msg, "err", err)
//nolint:govet
return deny(msg)
}
if foundSts != nil {
msg := fmt.Sprintf("downscale of %s/%s in %s from %d to %d replicas is not allowed because statefulset %v has %d non-updated replicas and %d non-ready replicas",
ar.Request.Resource.Resource, ar.Request.Name, ar.Request.Namespace, *oldInfo.replicas, *newInfo.replicas, foundSts.name, foundSts.nonUpdatedReplicas, foundSts.nonReadyReplicas)
level.Warn(logger).Log("msg", msg)
//nolint:govet
return deny(msg)
}
}
Expand Down

0 comments on commit ee310e3

Please sign in to comment.