-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(computeresource/tasklevel): Fixed a bug where abnormal calculatio… #8399
base: main
Are you sure you want to change the base?
Conversation
…ns caused requested resources to exceed limits when Resource type was Memory or EphemeralStorage
The committers listed above are authorized under a signed CLA. |
Hi @Ccheers. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/kind bug |
The following is the coverage report on the affected files.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
@Ccheers can you detail a bit more what is the issue ? (use-case, or examples)
The following is the coverage report on the affected files.
|
In previous versions, when calling computeAverageRequests, if there was a Memory resource in corev1.ResourceList, it would cause an abnormal calculation of the Memory resource. func Test_computeAverageRequests(t *testing.T) {
type args struct {
requests corev1.ResourceList
steps int
}
tests := []struct {
name string
args args
want map[corev1.ResourceName]string
}{
{
name: "get 1 Mi",
args: args{
requests: corev1.ResourceList{
corev1.ResourceCPU: resource.MustParse("300m"),
corev1.ResourceMemory: resource.MustParse("32Mi"),
},
steps: 3,
},
want: map[corev1.ResourceName]string{
corev1.ResourceCPU: func() string {
parse := resource.MustParse("100m")
return parse.String()
}(),
corev1.ResourceMemory: func() string {
parse := resource.MustParse("11184810")
return parse.String()
}(),
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := computeAverageRequests(tt.args.requests, tt.args.steps)
mm := make(map[corev1.ResourceName]string, len(got))
for k, v := range got {
mm[k] = v.String()
}
if !reflect.DeepEqual(mm, tt.want) {
t.Errorf("computeAverageRequests() = %v, want %v", mm, tt.want)
}
})
}
}
// memory need 11184810
// but got 11184810666m |
Fixed a bug where abnormal calculations caused requested resources to exceed limits when Resource type was Memory or EphemeralStorage
Changes
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes