-
Notifications
You must be signed in to change notification settings - Fork 994
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
Add hugepages 2Mi and 1Gi fields to ResourceDescription and pass them to the statefulset #2311
Changes from 7 commits
33a7041
a5387a1
96c784e
1643d10
9ccc78a
5bb950a
59e777a
1bdc7c7
3e7ffa1
06004a1
e48163b
2d4eccf
ea04bb8
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 |
---|---|---|
|
@@ -5,9 +5,8 @@ import ( | |
"fmt" | ||
"reflect" | ||
"sort" | ||
"time" | ||
|
||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
|
@@ -2979,6 +2978,98 @@ func TestGenerateResourceRequirements(t *testing.T) { | |
ResourceLimits: acidv1.ResourceDescription{CPU: "1", Memory: "2Gi"}, | ||
}, | ||
}, | ||
{ | ||
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. Can we amend the other test to test for no huge pages set? Given its K8s 1.28 feature lets make sure its not set if not enabled. 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. I've added a test to cover this |
||
subTest: "test HugePages are passed through to the postgres container", | ||
config: config.Config{ | ||
Resources: configResources, | ||
PodManagementPolicy: "ordered_ready", | ||
}, | ||
pgSpec: acidv1.Postgresql{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: clusterName, | ||
Namespace: namespace, | ||
}, | ||
Spec: acidv1.PostgresSpec{ | ||
Resources: &acidv1.Resources{ | ||
ResourceRequests: acidv1.ResourceDescription{ | ||
HugePages2Mi: "128Mi", | ||
HugePages1Gi: "1Gi", | ||
}, | ||
ResourceLimits: acidv1.ResourceDescription{ | ||
HugePages2Mi: "256Mi", | ||
HugePages1Gi: "2Gi", | ||
}, | ||
}, | ||
TeamID: "acid", | ||
Volume: acidv1.Volume{ | ||
Size: "1G", | ||
}, | ||
}, | ||
}, | ||
expectedResources: acidv1.Resources{ | ||
ResourceRequests: acidv1.ResourceDescription{ | ||
CPU: "100m", | ||
Memory: "100Mi", | ||
HugePages2Mi: "128Mi", | ||
HugePages1Gi: "1Gi", | ||
}, | ||
ResourceLimits: acidv1.ResourceDescription{ | ||
CPU: "1", | ||
Memory: "500Mi", | ||
HugePages2Mi: "256Mi", | ||
HugePages1Gi: "2Gi", | ||
}, | ||
}, | ||
}, | ||
{ | ||
subTest: "test HugePages are passed through on sidecars", | ||
config: config.Config{ | ||
Resources: configResources, | ||
PodManagementPolicy: "ordered_ready", | ||
}, | ||
pgSpec: acidv1.Postgresql{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: clusterName, | ||
Namespace: namespace, | ||
}, | ||
Spec: acidv1.PostgresSpec{ | ||
Sidecars: []acidv1.Sidecar{ | ||
{ | ||
Name: "test-sidecar", | ||
DockerImage: "test-image", | ||
Resources: &acidv1.Resources{ | ||
ResourceRequests: acidv1.ResourceDescription{ | ||
HugePages2Mi: "128Mi", | ||
HugePages1Gi: "1Gi", | ||
}, | ||
ResourceLimits: acidv1.ResourceDescription{ | ||
HugePages2Mi: "256Mi", | ||
HugePages1Gi: "2Gi", | ||
}, | ||
}, | ||
}, | ||
}, | ||
TeamID: "acid", | ||
Volume: acidv1.Volume{ | ||
Size: "1G", | ||
}, | ||
}, | ||
}, | ||
expectedResources: acidv1.Resources{ | ||
ResourceRequests: acidv1.ResourceDescription{ | ||
CPU: "100m", | ||
Memory: "100Mi", | ||
HugePages2Mi: "128Mi", | ||
HugePages1Gi: "1Gi", | ||
}, | ||
ResourceLimits: acidv1.ResourceDescription{ | ||
CPU: "1", | ||
Memory: "500Mi", | ||
HugePages2Mi: "256Mi", | ||
HugePages1Gi: "2Gi", | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
|
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.
Seems this comes with K8s 1.28
Can we also link https://kubernetes.io/docs/tasks/manage-hugepages/scheduling-hugepages/
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.
Done