Skip to content

Conversation

@abdelrahman882
Copy link
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add events to capacity buffers objects when buffer causes scale up or fails to do so.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

  1. In pod list processor we inject fake pods with capacity buffer fake pod annotation
  2. in status processor we filter out these pods so we don't create events for fake pods

This changes is mainly caching fake pods to buffer objects in step 1. then in step 2 we use that mapping to get the buffer object from fake pods objects and create scale up events for the buffers

Does this PR introduce a user-facing change?

Add capacity buffers scale up events

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area labels Oct 7, 2025
@k8s-ci-robot k8s-ci-robot added area/cluster-autoscaler size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-area labels Oct 7, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 7, 2025
// relevant events for pods depending on their post scale-up status.
func (p *EventingScaleUpStatusProcessor) Process(context *context.AutoscalingContext, status *ScaleUpStatus) {
consideredNodeGroupsMap := nodeGroupListToMapById(status.ConsideredNodeGroups)
consideredNodeGroupsMap := NodeGroupListToMapById(status.ConsideredNodeGroups)
Copy link
Contributor

Choose a reason for hiding this comment

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

merge conflict pro tip here:

https://github.com/kubernetes/autoscaler/pull/7664/files#diff-dff3f90613cb7ed44657714ac89219e12699ae87dde45b8d91b9fce4fda5321e

(your change here didn't actually conflict w/ the autoscalingCtx *ca_context.AutoscalingContext change but FYI)

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1alpha1 "k8s.io/autoscaler/cluster-autoscaler/apis/capacitybuffer/autoscaling.x-k8s.io/v1alpha1"
"k8s.io/autoscaler/cluster-autoscaler/context"
"k8s.io/autoscaler/cluster-autoscaler/processors/nodegroupset"
Copy link
Contributor

Choose a reason for hiding this comment

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

merge conflict resolution pro tip:

https://github.com/kubernetes/autoscaler/pull/7664/files#diff-2218808dd5a372319540d4ffc872066fbd11bf4b74ef2c786fc33387b8d46c5cR24

git doesn't know how to resolve the surrounding import additions on top of the change to the "k8s.io/autoscaler/cluster-autoscaler/context" import alias change

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2025
},
PodsAwaitEvaluation: []*apiv1.Pod{},
},
expectedTriggeredScaleUp: 2,
Copy link
Member

Choose a reason for hiding this comment

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

WDYT about changing this from int to a slice of error strings so that it is possible to validate the message content as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think comparing the whole event string wouldn't add much value on testing this specific processor but also might make it a bit overcomplicated and not easy to add other tests, especially it would add the complexity of comparing/validating the reasonMessages list which is already tested EventingScaleUpStatusProcessor

Copy link
Member

@x13n x13n left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold

Just a tiny comment, feel free to cancel the hold and merge as is if you disagree.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 22, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 22, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abdelrahman882, x13n

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2025
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2025
@x13n
Copy link
Member

x13n commented Oct 23, 2025

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 23, 2025
@k8s-ci-robot k8s-ci-robot merged commit f197832 into kubernetes:master Oct 23, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cluster-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants