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

feat: Support PodRequests calculations for initContainers with restar… #569

Merged
merged 26 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7d1f363
feat: Support PodRequests calculations for initContainers with restar…
sadath-12 Oct 3, 2023
58fbd82
feat: Support PodRequests calculations for initContainers with restar…
sadath-12 Oct 12, 2023
4197d48
feat: Support PodRequests calculations for initContainers with restar…
sadath-12 Oct 12, 2023
a3d3575
feat: pod resources tests and calculation correction
sadath-12 Oct 13, 2023
0596df0
test: make presubmit
sadath-12 Oct 13, 2023
8df1e4e
removed comments
sadath-12 Oct 13, 2023
d85d819
feat: added blog link
sadath-12 Oct 14, 2023
083749d
feat: restartPolicy pointer
sadath-12 Oct 18, 2023
35864e8
test: added resources test
sadath-12 Oct 18, 2023
818603c
chore: ceiling function separation
sadath-12 Oct 18, 2023
11f2c3b
test: scheduling test for resources
sadath-12 Oct 18, 2023
b420890
cut
sadath-12 Oct 18, 2023
4fb993e
feat: initcontainer resource calculation correction
sadath-12 Oct 18, 2023
7aa4664
feat: MergeResourceLimitsIntoRequests
sadath-12 Oct 18, 2023
06c60f5
chore: mergeInto function usage fix and suite_test.go for resources
sadath-12 Oct 19, 2023
2b3d670
chore: optimized maxInitContainers
sadath-12 Oct 26, 2023
80f92b3
test: added provisioners & nodepool test
sadath-12 Oct 30, 2023
15894a4
test: added requests test
sadath-12 Nov 25, 2023
8a41148
test: resource merging
sadath-12 Nov 26, 2023
067888b
Revert resource scheduling instance type selection test
jonathan-innis Jan 20, 2024
ce8fa38
added tests for resources
sadath-12 Jan 24, 2024
831fce4
format
sadath-12 Jan 24, 2024
301db0d
minorfixes
sadath-12 Jan 28, 2024
26d6af8
fix lint
sadath-12 Jan 28, 2024
f8f556d
Test cleanup and gating on 1.29 version
jonathan-innis Feb 1, 2024
c9638a4
Remove redundant testing
jonathan-innis Feb 2, 2024
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
4 changes: 2 additions & 2 deletions kwok/cloudprovider/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func ConstructInstanceTypes() []*cloudprovider.InstanceType {
},
InstanceTypeLabels: labels,
}
price := priceFromResources(opts.Resources)
price := PriceFromResources(opts.Resources)

opts.Offerings = cloudprovider.Offerings{}
for _, zone := range KwokZones {
Expand Down Expand Up @@ -131,7 +131,7 @@ func newInstanceType(options InstanceTypeOptions) *cloudprovider.InstanceType {
}
}

func priceFromResources(resources v1.ResourceList) float64 {
func PriceFromResources(resources v1.ResourceList) float64 {
price := 0.0
for k, v := range resources {
switch k {
Expand Down
14 changes: 7 additions & 7 deletions pkg/cloudprovider/fake/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ func NewInstanceType(options InstanceTypeOptions) *cloudprovider.InstanceType {
}
if len(options.Offerings) == 0 {
options.Offerings = []cloudprovider.Offering{
{CapacityType: "spot", Zone: "test-zone-1", Price: priceFromResources(options.Resources), Available: true},
{CapacityType: "spot", Zone: "test-zone-2", Price: priceFromResources(options.Resources), Available: true},
{CapacityType: "on-demand", Zone: "test-zone-1", Price: priceFromResources(options.Resources), Available: true},
{CapacityType: "on-demand", Zone: "test-zone-2", Price: priceFromResources(options.Resources), Available: true},
{CapacityType: "on-demand", Zone: "test-zone-3", Price: priceFromResources(options.Resources), Available: true},
{CapacityType: "spot", Zone: "test-zone-1", Price: PriceFromResources(options.Resources), Available: true},
{CapacityType: "spot", Zone: "test-zone-2", Price: PriceFromResources(options.Resources), Available: true},
{CapacityType: "on-demand", Zone: "test-zone-1", Price: PriceFromResources(options.Resources), Available: true},
{CapacityType: "on-demand", Zone: "test-zone-2", Price: PriceFromResources(options.Resources), Available: true},
{CapacityType: "on-demand", Zone: "test-zone-3", Price: PriceFromResources(options.Resources), Available: true},
}
}
if len(options.Architecture) == 0 {
Expand Down Expand Up @@ -125,7 +125,7 @@ func InstanceTypesAssorted() []*cloudprovider.InstanceType {
v1.ResourceMemory: resource.MustParse(fmt.Sprintf("%dGi", mem)),
},
}
price := priceFromResources(opts.Resources)
price := PriceFromResources(opts.Resources)
opts.Offerings = []cloudprovider.Offering{
{
CapacityType: ct,
Expand Down Expand Up @@ -173,7 +173,7 @@ type InstanceTypeOptions struct {
Resources v1.ResourceList
}

func priceFromResources(resources v1.ResourceList) float64 {
func PriceFromResources(resources v1.ResourceList) float64 {
price := 0.0
for k, v := range resources {
switch k {
Expand Down
28 changes: 17 additions & 11 deletions pkg/controllers/provisioning/scheduling/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1663,11 +1663,15 @@ var _ = Context("NodePool", func() {
v1.ResourceCPU: resource.MustParse("1"),
},
},
InitImage: "pause",
InitResourceRequirements: v1.ResourceRequirements{
Requests: map[v1.ResourceName]resource.Quantity{
v1.ResourceMemory: resource.MustParse("1Gi"),
v1.ResourceCPU: resource.MustParse("2"),
InitContainers: []v1.Container{
{
Resources: v1.ResourceRequirements{

Requests: map[v1.ResourceName]resource.Quantity{
v1.ResourceMemory: resource.MustParse("1Gi"),
v1.ResourceCPU: resource.MustParse("2"),
},
},
},
},
})
Expand All @@ -1684,13 +1688,15 @@ var _ = Context("NodePool", func() {
v1.ResourceCPU: resource.MustParse("1"),
},
},
InitImage: "pause",
InitResourceRequirements: v1.ResourceRequirements{
Requests: map[v1.ResourceName]resource.Quantity{
v1.ResourceMemory: resource.MustParse("1Ti"),
v1.ResourceCPU: resource.MustParse("2"),
InitContainers: []v1.Container{{
Resources: v1.ResourceRequirements{

Requests: map[v1.ResourceName]resource.Quantity{
v1.ResourceMemory: resource.MustParse("1Ti"),
v1.ResourceCPU: resource.MustParse("2"),
},
},
},
}},
})
ExpectProvisioned(ctx, env.Client, cluster, cloudProvider, prov, pod)
ExpectNotScheduled(ctx, env.Client, pod)
Expand Down
Loading
Loading