Skip to content

Commit

Permalink
Merge pull request #7542 from omerap12/fixed-lint
Browse files Browse the repository at this point in the history
Chore: fixed lints errors
  • Loading branch information
k8s-ci-robot authored Dec 3, 2024
2 parents 7b44fd3 + 38e6da4 commit 7b44715
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ func TestEvictEmitEvent(t *testing.T) {
mockRecorder.On("Event", mock.Anything, apiv1.EventTypeNormal, "EvictedByVPA", mock.Anything).Return()
mockRecorder.On("Event", mock.Anything, apiv1.EventTypeNormal, "EvictedPod", mock.Anything).Return()

eviction.Evict(p.pod, testCase.vpa, mockRecorder)
_ = eviction.Evict(p.pod, testCase.vpa, mockRecorder)

if p.canEvict {
mockRecorder.AssertNumberOfCalls(t, "Event", 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ func (calc *UpdatePriorityCalculator) GetProcessedRecommendationTargets(r *vpa_t
return sb.String()
}

func parseVpaObservedContainers(pod *apiv1.Pod) (bool, sets.String) {
func parseVpaObservedContainers(pod *apiv1.Pod) (bool, sets.Set[string]) {
observedContainers, hasObservedContainers := pod.GetAnnotations()[annotations.VpaObservedContainersLabel]
vpaContainerSet := sets.NewString()
vpaContainerSet := sets.New[string]()
if hasObservedContainers {
if containers, err := annotations.ParseVpaObservedContainersValue(observedContainers); err != nil {
klog.ErrorS(err, "VPA annotation failed to parse", "pod", klog.KObj(pod), "annotation", observedContainers)
Expand Down
11 changes: 6 additions & 5 deletions vertical-pod-autoscaler/pkg/utils/status/status_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
clientset "k8s.io/client-go/kubernetes"
typedcoordinationv1 "k8s.io/client-go/kubernetes/typed/coordination/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

const (
Expand Down Expand Up @@ -97,7 +97,7 @@ func (c *Client) UpdateStatus(ctx context.Context) error {
return err
}
lease.Spec.RenewTime = &metav1.MicroTime{Time: time.Now()}
lease.Spec.HolderIdentity = pointer.String(c.holderIdentity)
lease.Spec.HolderIdentity = ptr.To(c.holderIdentity)
_, err = c.client.Update(ctx, lease, metav1.UpdateOptions{})
if apierrors.IsConflict(err) {
// Lease was updated by an another replica of the component.
Expand Down Expand Up @@ -126,8 +126,9 @@ func (c *Client) newLease() *apicoordinationv1.Lease {
Namespace: c.leaseNamespace,
},
Spec: apicoordinationv1.LeaseSpec{
HolderIdentity: pointer.String(c.holderIdentity),
LeaseDurationSeconds: pointer.Int32(c.leaseDurationSeconds),
HolderIdentity: ptr.To(c.holderIdentity),

LeaseDurationSeconds: ptr.To(c.leaseDurationSeconds),
},
}
}
Expand Down Expand Up @@ -174,7 +175,7 @@ func isRetryableAPIError(err error) bool {

func isRetryableNetError(err error) bool {
if netError, ok := err.(net.Error); ok {
return netError.Temporary() || netError.Timeout()
return netError.Timeout()
}
return false
}
Expand Down

0 comments on commit 7b44715

Please sign in to comment.