Skip to content

Commit

Permalink
remove instanceTypeLabels add; remove explicit capacity/zone; add all…
Browse files Browse the repository at this point in the history
… requirements
  • Loading branch information
alec-rabold committed Mar 5, 2025
1 parent ecc0b73 commit ee215df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 0 additions & 2 deletions kwok/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ func addInstanceLabels(labels map[string]string, instanceType *cloudprovider.Ins
// Randomly add each new node to one of the pre-created kwokPartitions.

ret[v1alpha1.KwokPartitionLabelKey] = lo.Sample(kwokPartitions)
ret[v1.CapacityTypeLabelKey] = offering.Requirements.Get(v1.CapacityTypeLabelKey).Any()
ret[corev1.LabelTopologyZone] = offering.Requirements.Get(corev1.LabelTopologyZone).Any()
ret[corev1.LabelHostname] = nodeClaim.Name

ret[v1alpha1.KwokLabelKey] = v1alpha1.KwokLabelValue
Expand Down
10 changes: 3 additions & 7 deletions kwok/cloudprovider/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@ func setDefaultOptions(opts InstanceTypeOptions) InstanceTypeOptions {
v1alpha1.InstanceCPULabelKey: cpu,
v1alpha1.InstanceMemoryLabelKey: memory,
}
for _, offering := range opts.Offerings {
for _, req := range offering.Requirements {
if _, exists := opts.instanceTypeLabels[req.Key]; !exists {
opts.instanceTypeLabels[req.Key] = req.Values[0]
}
}
}

// if the user specified a different pod limit, override the default
opts.Resources = lo.Assign(corev1.ResourceList{
Expand Down Expand Up @@ -180,6 +173,9 @@ func newInstanceType(options InstanceTypeOptions) *cloudprovider.InstanceType {
for _, requirement := range offering.Requirements {
v1.WellKnownLabels = v1.WellKnownLabels.Insert(requirement.Key)
}
for _, requirement := range offering.Offering.Requirements {
v1.WellKnownLabels = v1.WellKnownLabels.Insert(requirement.Key)
}
}

requirements := scheduling.NewRequirements(
Expand Down

0 comments on commit ee215df

Please sign in to comment.