Skip to content

Conversation

@britaniar
Copy link
Contributor

@britaniar britaniar commented Oct 16, 2025

Description of your changes

  • Create a new struct called property checker with capacity related client and functions to verify cluster is valid based on property requirement.

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

Another PR will be opened containing the deployment changes.
Another PR will be opened containing scheduler changes.

@britaniar britaniar force-pushed the setupCapacity branch 3 times, most recently from 68b3cfd to a364391 Compare October 22, 2025 01:51
@britaniar britaniar marked this pull request as ready for review October 22, 2025 01:53
@britaniar britaniar changed the title feat: start setting up capacity feat: capacity property setup in scheduler Oct 22, 2025
@britaniar britaniar force-pushed the setupCapacity branch 2 times, most recently from c427486 to 32caad2 Compare October 28, 2025 23:59
@britaniar britaniar force-pushed the setupCapacity branch 2 times, most recently from 0b6f14a to 5b54e69 Compare October 30, 2025 21:08
ryanzhang-oss
ryanzhang-oss previously approved these changes Oct 31, 2025
@britaniar britaniar changed the title feat: capacity property setup in scheduler feat: setup property checker for capacity Nov 1, 2025
Copy link
Contributor

@ryanzhang-oss ryanzhang-oss left a comment

Choose a reason for hiding this comment

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

I am a bit confused, what does this PR do? I think it will be good to add an overall description.

Copy link
Contributor

@zhiying-lin zhiying-lin left a comment

Choose a reason for hiding this comment

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

I have not reviewed the code in the Scheduler package as the current PR is big enough. Let's merge the scheduler related changes in a separate PR.

// a Kubernetes cluster.
PerGBMemoryCostProperty = "kubernetes.azure.com/per-gb-memory-cost"

NodeCountPerSKUPropertyTmpl = "kubernetes.azure.com/vm-size/%s/count"
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to be more careful to update existing files to avoid potential merge conflicts. And the capacity API is not used in propertyprovider at all. @zhiying-lin

Copy link
Contributor

Choose a reason for hiding this comment

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

Basically I think the capacity property should be put in propertychecker not propertyprovider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Zhiying asked me to move here. I think we wanted to group the azure properties together.
#1210 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

it won't conflict with the backport, as it's azure folder.

Yeah, would like to group them together and they're sharing the same prefix though the property is not provided by property provider controller.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

please check with Ryan to see what's the diff for azure property provider in kubefleet & fleet.

If they're going to diverge, let's keep the prefix in this file and move the CapacityPerSKUPropertyTmpl to propertychecker.

// a Kubernetes cluster.
PerGBMemoryCostProperty = "kubernetes.azure.com/per-gb-memory-cost"

NodeCountPerSKUPropertyTmpl = "kubernetes.azure.com/vm-size/%s/count"
Copy link
Contributor

Choose a reason for hiding this comment

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

please check with Ryan to see what's the diff for azure property provider in kubefleet & fleet.

If they're going to diverge, let's keep the prefix in this file and move the CapacityPerSKUPropertyTmpl to propertychecker.


// Package azure provides property checkers for Azure-specific cluster requirements.
// It checks whether the cluster can meet the requirement defined by the property selector.
package azure
Copy link
Contributor

Choose a reason for hiding this comment

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

just realized that this is not part of the Azure provider? I wonder why? This is only going to be used by the azure provider, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

property checker is a interface to check if the cluster meets the property requirement. The current azure one is not generic enough and it can be used by other properties if we have, which we can refactor later. It won't be used by the provider and will be used by the clusteraffinity plugin instead.

While the property provider is to collect and store the property as part of the member cluster CR.

func (s *PropertyChecker) CheckIfMeetSKUCapacityRequirement(
cluster *clusterv1beta1.MemberCluster,
req placementv1beta1.PropertySelectorRequirement,
sku string,
Copy link
Contributor

Choose a reason for hiding this comment

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

where is this sku coming from? IIRC. req includes both the sku and the capacity (sku in the name while capacity in the value). I wonder why we process the sku info outside of this function while parse the capacity inside this function?

Copy link
Contributor

Choose a reason for hiding this comment

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

52ad7d7#diff-909e9d3ff38befb3e868379f89427c9f606366ca40d4f997f4bf0f0668a68b8a

we need to first figure out whether it's azure SKUproperty first before calling this.

Signed-off-by: Britania Rodriguez Reyes <britaniar@microsoft.com>
@britaniar britaniar merged commit 492ff3c into Azure:main Nov 11, 2025
17 of 18 checks passed
@britaniar britaniar deleted the setupCapacity branch November 11, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants