feat: add evictAfterOOMThreshold per vpa#9071
feat: add evictAfterOOMThreshold per vpa#9071omerap12 wants to merge 1 commit intokubernetes:masterfrom
Conversation
|
/hold |
soltysh
left a comment
There was a problem hiding this comment.
Initial comments from API shadow
| // +kubebuilder:validation:Type=string | ||
| // +kubebuilder:validation:Format=duration | ||
| // +kubebuilder:validation:Pattern=`^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$` | ||
| EvictAfterOOMThreshold *metav1.Duration `json:"evictAfterOOMThreshold,omitempty" protobuf:"bytes,4,opt,name=evictAfterOOMThreshold"` |
There was a problem hiding this comment.
I don't think we have any metav1.Duration in the k/k APIs, and from a quick grep it seems we don't have them in this repo. So I'd suggest to stick with the usual units as described here https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#units. Example EvictAfterOOMSeconds or something like that.
There was a problem hiding this comment.
I don't know if this matters, but, this field is an override to the --evict-after-oom-threshold flag, which is currently a duration:
Keeping the flag and API constant feels like a nice thing to do, but I'm assuming the reason listed in the api-conventions doc is higher priority:
We don't use Duration in the API since that would require clients to implement go-compatible parsing.
There was a problem hiding this comment.
Thanks Maciej (again) :)
@adrianmoisey , so let's go with EvictAfterOOMSeconds? I will update the AEP and this PR if that's ok with you.
There was a problem hiding this comment.
Keeping the flag and API constant feels like a nice thing to do, but I'm assuming the reason listed in the api-conventions doc is higher priority
Flags have better parsing capabilities and it's exposed only to cluster admins. API is user-facing and this would force clients to support go-compatible parsing rules, it's mentioned in our API conventions.
1ddfd7b to
cb9dc87
Compare
|
|
||
| const ( | ||
| // DefaultEvictAfterOOMThreshold is the default time threshold for evicting pods after OOM | ||
| DefaultEvictAfterOOMThreshold = 10 * time.Minute |
There was a problem hiding this comment.
Does this need to be public?
There was a problem hiding this comment.
Actually, any reason why this moved to a const? Seems like only 1 thing uses it
vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go
Outdated
Show resolved
Hide resolved
eb2d515 to
e26f744
Compare
soltysh
left a comment
There was a problem hiding this comment.
One minor nit, but this lgtm from api-shadow pov
| } | ||
|
|
||
| // PodUpdatePolicy describes the rules on how changes are applied to the pods. | ||
| // +kubebuilder:validation:XValidation:rule="!has(self.evictAfterOOMSeconds) || self.evictAfterOOMSeconds > 0",message="evictAfterOOMSeconds must be greater than 0" |
There was a problem hiding this comment.
Nit: I don't think you need double validation for > 0. You already have kubebuilder:validation:Minimum=1 set directly on the field.
There was a problem hiding this comment.
agreed, let's not add CEL validation that redoes validation we already applied
c6fff23 to
e034392
Compare
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
e034392 to
81fe9f7
Compare
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianmoisey, omerap12, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: