Skip to content

Implement Shared AutoScaling Hook Functionality #667

Open

Description

@soenkeliebau

Currently we do not really support autoscaling clusters that are managed by Stackable beyond fairly trivial scenarios.

We do support deploying HPAs for scaling StatefulSets, but as soon as soon as actions need to be run before or after scaling these, we start running into issues. This is due to the fact, that there exist no pre- or post-scale hooks that operators could tie into to

  • trigger scaling workflows
  • delay actual scaling until workflows have finished

Actual example
When scaling down a NiFi cluster, a node has to be decommissioned and offloaded of flowfiles before tearing down the node, otherwise any data on that node will be lost forever.

During the recent on-site in Munich I presented the current state and an idea of how this could be implemented, slides used: Autoscaling @ Stackable.pdf

The scope of this ticket is to get the fundamental work in operator-rs done, so that functionality exists that operators can call to determine if scaling is neccessary and give appropriate control to the operator to run workloads before or after actually doing the scale function.
Ideally we'll also implement helper functions for the actual scaling, i.e. propagating replica count to the StatefulSets, when appropriate.

Requirements

  • [M] Allow us to control the scaling / run code before scaling happens
    delay scaling until we are done!
  • [S] Use existing scaling mechanisms
  • [S] Disallow ambiguous configuration (op and scaler fighting with each other)
  • [C] Isolate as much as possible into operator-rs and have operators just define necessary scaling steps

Activity

  1. Techassi commented on Feb 19, 2025

    @Techassi
    Member

    I created an upstream PR to improve the scale() argument of the #[kube] derive macro: kube-rs/kube#1656

  2. moved this from In Progress to In Refinement in Stackable End-to-End Coordinationon Mar 25, 2026
  3. moved this from In Refinement to In Progress in Stackable End-to-End Coordinationon Apr 8, 2026
  4. lfrancke commented on Jul 25, 2026

    @lfrancke
    Member

    I am currently preparing the issues for continuing the autoscaling work.
    I created a new epic #872 for this which has a wider scope.

    I didn't want to change this issue as you already did work in it (the Scaler stuff)

    As far as I can see you delivered this:

    Not delivered (and I'd move this into #872 now)

    • Nothing installs the CRD (plan is for this to go into commons-op) and nothing reconciles it (the product operators)
    • Pre- and post-scale hooks, and the state machine that drives them
    • Refusing a scale-down that would lose data

    The original design from the slides still mostly holds and is continued in #872 as well.

    Open questions for @soenkeliebau & @Techassi

    • Any objection closing this issue?
    • On the three PRs I'm unsure: Part of one has been implemented, the other two (commons & nifi) have not been touched. They will almost certainly need to be reworked and we can leave them open as inspiration, or we can close them. Up to you. If we leave them open we should convert them to drafts.
  5. Techassi commented on Sep 25, 2026

    @Techassi
    Member

    Any objection closing this issue?

    No, I would be happy to close this in favor of #872 (if we consider #872 to be more refined/complete compared to this).

    the other two (commons & nifi) have not been touched. They will almost certainly need to be reworked and we can leave them open as inspiration, or we can close them. Up to you. If we leave them open we should convert them to drafts.

    Yeah, I started work on the common/shared bits first to fully refine the API design. The two PRs making use of the new mechanisms mostly served as an initial spike. But I agree that it makes sense to close them and use them as inspiration down the line if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions