Skip to content

refactor: stage consolidation for overwritable consolidationTTL #2312

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

rschalo
Copy link
Contributor

@rschalo rschalo commented Jun 15, 2025

Fixes #N/A

Description
Simplify code used in validation and set up consolidation to take in a customizable consolidationTTL which will eventually be used to remove ExpectToWait in consolidation tests.

How was this change tested?
make presubmit

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 15, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rschalo
Once this PR has been reviewed and has the lgtm label, please assign maciekpytel for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 15, 2025
@rschalo rschalo changed the title Reorg emptiness and validation refactor: stage consolidation for overwritable consolidationTTL Jun 15, 2025
@rschalo rschalo marked this pull request as ready for review June 15, 2025 19:32
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2025
@rschalo
Copy link
Contributor Author

rschalo commented Jun 15, 2025

/retest

recorder: recorder,
}
func NewDrift(c consolidation) *Drift {
return &Drift{consolidation: c}
Copy link
Member

Choose a reason for hiding this comment

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

Drift contains consolidation? That doesn't seem right to me. Perhaps we need to change the naming, but I'm also wondering what the need is to encapsulate all of the details of this for drift

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to encapsulate all of the details, we were passing in members of consolidation and this is looking to unify what is required for a new Method. If every Method takes in consolidation then it could just use what it needs - I think a change to accept a consolidation as a param but then change back to a struct that isn't just consolidation is reasonable.

provisioner: provisioner,
cloudProvider: cloudProvider,
recorder: recorder,
consolidationTTL: consolidationTTL,
Copy link
Member

Choose a reason for hiding this comment

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

This is static, right? So is there a need to define this as a consolidation member variable


type ConsolidationOption func(*consolidation)

func WithConsolidationTTL(ttl time.Duration) ConsolidationOption {
Copy link
Member

Choose a reason for hiding this comment

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

Do you need this or can this just be a property of the validator directly?

@@ -74,7 +74,7 @@ func NewControllers(

controllers := []controller.Controller{
p, evictionQueue, disruptionQueue,
disruption.NewController(clock, kubeClient, p, cloudProvider, recorder, cluster, disruptionQueue),
disruption.NewController(disruption.MakeConsolidation(clock, cluster, kubeClient, p, cloudProvider, recorder, disruptionQueue)),
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why you want to encapsulate everything inside of consolidation and pass it to the constructor like this. If you are literally wrapping everything in the constructor, it sort of begs the question why you even need to wrap it in the first place

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because when we make the disruption controller in our int tests, there isn't an opportunity to customize validator behavior. We could make consolidationTTL a member of Validator and export the Validator on each Method and then in the tests where relevant overwrite it there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline - going to export Methods on the controller and overwrite methods individually as needed.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 18, 2025
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

3 participants