Refactor internal components #6360
Labels
feature-request
All issues for new features that have not been committed to
needs-discussion
stale-bot-ignore
All issues that should not be automatically closed by our stale bot
Proposal
I've been thinking about our code and I think that it's a bit coupled, making difficult to manage the life cycle of the items internally sometimes. (During the last months we have had several issues related with the scaler lifecycle, not properly closed connections, etc) and I don't like so much some parts of the core code. IMHO there are mixed responsibilities about what each thing does, and we have some duplications (almost the same code) because the querying way when internal scale loop is slightly different from the HPA querying way. Although the goal and the main idea is quite similar, the code is duplicated. This idea has been in my head for some time and recent issues related with the scaler lifecycle and unclosed connections have pushed it out.
My proposal is to split the responsibilities in different layers (I'm not speaking about tons of interfaces, DTOs and clean code patterns at all, just from resposibities pov), where we manage each layer isolated from others, not sharing the internal information to avoid coupling them.
Disclaimer: Please, ignore the term "service", I used it to make a difference between our controllers (strongly related with k8s controllers) and the controllers/layers/services.
The main idea is that instead of querying metrics in different ways, we have a single layer (scaler service) where all the scalers of an scalableobject (SO/SJ) live, and other layers on top that consume this scaler layer but totally as blackbox. Let's explain the SO flow:
The text was updated successfully, but these errors were encountered: