WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions pkg/apis/v1beta1/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var (
LabelSKUGPUCount,

AKSLabelCluster,
AKSLabelScaleSetPriority,
)

RestrictedLabels = sets.New(
Expand Down Expand Up @@ -108,6 +109,7 @@ var (

AKSLabelCluster = AKSLabelDomain + "/cluster"
AKSLabelKubeletIdentityClientID = AKSLabelDomain + "/kubelet-identity-client-id"
AKSLabelScaleSetPriority = AKSLabelDomain + "/scalesetpriority" // "spot" or "regular". Note that "regular" is never written by AKS as a label but we write it to make scheduling easier

AnnotationAKSNodeClassHash = apis.Group + "/aksnodeclass-hash"
AnnotationAKSNodeClassHashVersion = apis.Group + "/aksnodeclass-hash-version"
Expand All @@ -120,6 +122,11 @@ const (
AzureLinuxImageFamily = "AzureLinux"
)

const (
ScaleSetPriorityRegular = "regular"
ScaleSetPrioritySpot = "spot"
)

var UbuntuFamilies = sets.New(
UbuntuImageFamily,
Ubuntu2204ImageFamily,
Expand Down
1 change: 1 addition & 0 deletions pkg/providers/instancetype/instancetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func computeRequirements(
scheduling.NewRequirement(v1beta1.LabelSKUGPUManufacturer, corev1.NodeSelectorOpDoesNotExist),
scheduling.NewRequirement(v1beta1.LabelSKUGPUName, corev1.NodeSelectorOpDoesNotExist),
scheduling.NewRequirement(v1beta1.AKSLabelCluster, corev1.NodeSelectorOpIn, labels.NormalizeClusterResourceGroupNameForLabel(opts.NodeResourceGroup)),
scheduling.NewRequirement(v1beta1.AKSLabelScaleSetPriority, corev1.NodeSelectorOpIn, v1beta1.ScaleSetPriorityRegular, v1beta1.ScaleSetPrioritySpot),

// composites
scheduling.NewRequirement(v1beta1.LabelSKUName, corev1.NodeSelectorOpDoesNotExist),
Expand Down
2 changes: 2 additions & 0 deletions pkg/providers/instancetype/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,8 @@ var _ = Describe("InstanceType Provider", func() {
// AKS domain
{Name: v1beta1.AKSLabelCPU, Label: v1beta1.AKSLabelCPU, ValueFunc: func() string { return "24" }, ExpectedInKubeletLabels: true, ExpectedOnNode: true},
{Name: v1beta1.AKSLabelMemory, Label: v1beta1.AKSLabelMemory, ValueFunc: func() string { return "8192" }, ExpectedInKubeletLabels: true, ExpectedOnNode: true},
{Name: v1beta1.AKSLabelScaleSetPriority + "=regular", Label: v1beta1.AKSLabelScaleSetPriority, ValueFunc: func() string { return "regular" }, ExpectedInKubeletLabels: true, ExpectedOnNode: true},
{Name: v1beta1.AKSLabelScaleSetPriority + "=spot", Label: v1beta1.AKSLabelScaleSetPriority, ValueFunc: func() string { return "spot" }, ExpectedInKubeletLabels: true, ExpectedOnNode: true},
// Deprecated Labels -- note that these are not expected in kubelet labels or on the node.
// They are written by CloudProvider so don't need to be sent to kubelet, and they aren't required on the node object because Karpenter does a mapping from
// the new labels to the old labels for compatibility.
Expand Down
1 change: 1 addition & 0 deletions pkg/providers/labels/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func Get(
// changed recently. This is OK because drift will correct it.
labels[v1beta1.AKSLabelKubeletIdentityClientID] = opts.KubeletIdentityClientID
labels["kubernetes.azure.com/mode"] = "user"
labels[v1beta1.AKSLabelScaleSetPriority] = v1beta1.ScaleSetPriorityRegular

if opts.IsAzureCNIOverlay() {
// TODO: make conditional on pod subnet
Expand Down
1 change: 1 addition & 0 deletions test/suites/scheduling/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ var _ = Describe("Scheduling", Ordered, ContinueOnFailure, func() {
v1beta1.LabelSKUStoragePremiumCapable: "true",
v1beta1.LabelSKUStorageEphemeralOSMaxSize: "53",
v1beta1.AKSLabelCluster: env.NodeResourceGroup,
v1beta1.AKSLabelScaleSetPriority: "regular",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test on spot as well. I am not sure we ever actually write spot... just regular above. We likely need a place where we conditionally write spot onto the node too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to make sure that if I set up a NodePool with only this requirement, I end up getting all spot nodes, which I don't think I will here.

}
selectors.Insert(lo.Keys(nodeSelector)...) // Add node selector keys to selectors used in testing to ensure we test all labels
requirements := lo.MapToSlice(nodeSelector, func(key string, value string) corev1.NodeSelectorRequirement {
Expand Down
Loading