Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: fixed lints errors #7542

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member Author

@omerap12 omerap12 Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianmoisey error check here caused a failure (https://github.com/kubernetes/autoscaler/actions/runs/12082981510/job/33695187736) so I ignore that for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting. Based on this test, I think that error is expected, since the pod can't be evicted.
Would you be able to change the test to include testing if an error is expected or not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. In this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too fussed, your choice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


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),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you introduce a new no-op empty line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by mistake, Ill raise a PR to fix thanks

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
Loading