-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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 e2e limits #70329
Fix e2e limits #70329
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,6 @@ import ( | |
"k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/resource" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"k8s.io/apimachinery/pkg/util/strategicpatch" | ||
"k8s.io/apimachinery/pkg/util/uuid" | ||
utilfeature "k8s.io/apiserver/pkg/util/feature" | ||
clientset "k8s.io/client-go/kubernetes" | ||
|
@@ -281,14 +279,22 @@ var _ = SIGDescribe("SchedulerPriorities [Serial]", func() { | |
Expect(found).To(Equal(true)) | ||
nodeOriginalMemoryVal := nodeOriginalMemory.Value() | ||
nodeOriginalCPUVal := nodeOriginalCPU.MilliValue() | ||
err := updateNodeAllocatable(cs, nodeName, int64(10000), int64(12000)) | ||
err := updateNodeAllocatable(cs, nodeName, int64(10737418240), int64(12000)) | ||
Expect(err).NotTo(HaveOccurred()) | ||
defer func() { | ||
// Resize the node back to its original allocatable values. | ||
if err := updateNodeAllocatable(cs, nodeName, nodeOriginalMemoryVal, nodeOriginalCPUVal); err != nil { | ||
framework.Logf("Failed to revert node memory with %v", err) | ||
} | ||
// Reset the node list with its old entry. | ||
nodeList.Items[len(nodeList.Items)-1] = lastNode | ||
}() | ||
// update nodeList with newNode. | ||
newNode, err := cs.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) | ||
if err != nil { | ||
framework.Logf("Failed to get node", err) | ||
} | ||
nodeList.Items[len(nodeList.Items)-1] = *newNode | ||
err = createBalancedPodForNodes(f, cs, ns, nodeList.Items, podRequestedResource, 0.5) | ||
framework.ExpectNoError(err) | ||
// After the above we should see 50% of node to be available which is 5000MiB memory, 6000m cpu for large node. | ||
|
@@ -457,20 +463,11 @@ func addRandomTaitToNode(cs clientset.Interface, nodeName string) *v1.Taint { | |
func updateNodeAllocatable(c clientset.Interface, nodeName string, memory, cpu int64) error { | ||
node, err := c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{}) | ||
framework.ExpectNoError(err) | ||
oldData, err := json.Marshal(node) | ||
if err != nil { | ||
return err | ||
} | ||
node.Status.Allocatable[v1.ResourceMemory] = *resource.NewQuantity(memory, resource.BinarySI) | ||
node.Status.Allocatable[v1.ResourceCPU] = *resource.NewMilliQuantity(cpu, resource.DecimalSI) | ||
newData, err := json.Marshal(node) | ||
if err != nil { | ||
return err | ||
} | ||
patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, v1.Node{}) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = c.CoreV1().Nodes().Patch(string(node.Name), types.StrategicMergePatchType, patchBytes) | ||
_, err = c.CoreV1().Nodes().UpdateStatus(node) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that to say, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In order to test it, I added taints to node and applied patch, this worked while cpu and memory were not getting updated. So, I had to use UpdateStatus. |
||
return err | ||
} |
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.
Any reason to set this particular value? Isn't
10000
(greater than incoming limit5000m
) good enough?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.
This value is for memory not cpu
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.
sry, I misread... Let me rephrase: so the original mem val
10000
(greater than incoming limit3000Mi
) should be put as a form10737418240
, to represent 10Gi, right?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.
Yes, that is right and that code path was not getting exercised as patch had not effect.