Added hpa update predicate to reconcile a scaledobject only if hpa spec,label or annotation is changed#5282
Conversation
|
Thank you for your contribution! 🙏 We will review your PR as soon as possible. While you are waiting, make sure to:
Learn more about: |
I am thinking that as scaledobject controller is not adding any new annotation to the HPA and HPA controller might add some annotation to it, so it should be fine to remove predicate.AnnotationChangedPredicate{} and leave this piece of code as it is. We are now on autoscaling/v2 where currently no annotation is being added by hpa controller but i saw in autoscaling/v1 that the current metrics were part of the annotations and they kept changing. |
…ec,label or ownerRefernce is changed Signed-off-by: deefreak <[email protected]>
…ec,label or annotation is changed Signed-off-by: deefreak <[email protected]>
…ec,label or annotation is changed Signed-off-by: deefreak <[email protected]>
…ec or label is changed Signed-off-by: deefreak <[email protected]>
c1011c6 to
00193f8
Compare
We are propagating the ScaledObject labels/annotations so I'd say that we have to keep the predicate: Lines 134 to 139 in a2c21ec |
Sorry, my bad , missed this. Also, confirmed that currently hpa controller is not adding any annotations to the hpa object. So, it should be fine to add the annotation changed predicate . I will also then make changes to the
to add check for annotations as well. |
yes please |
…ec,label or annotation is changed Signed-off-by: deefreak <[email protected]>
|
@zroubalik I have done all the commented changes. Have added unit tests to test the HPASpecChangedPredicate as well. |
zroubalik
left a comment
There was a problem hiding this comment.
Looking good, I wonder whether we can test that updates to status don't trigger a reconcile loop?
|
/run-e2e |
As there will be no change in scaledobjects, it will be really hard to test through a unit test. I mean there will be nothing to compare for before and after reconcile. Although i have compared it on a cluster with more than 100+ scaledobjects and there were no reconcilations for hpa status updates(.status.currentMetrics) after applying this fix. |
yeah, agree |
I added the check for annotations as similar to the labels. when I was testing, the hpa created through scaledobject has no annotations, thus annotation was nil and therefore adding an annotation to the hpa was not reconciling again. So, we should add this condition, verified that this is working @zroubalik @JorTurFer what do you think? |
|
Good catch, please do that! |
…ec,label or annotation is changed Signed-off-by: deefreak <[email protected]>
Done and added tests for label and annotation changes as well. |
…ec,label or annotation is changed Signed-off-by: deefreak <[email protected]>
…ect-reconciles-by-HPA-status-updates
…s-by-HPA-status-updates' into redundant-scaledobject-reconciles-by-HPA-status-updates
|
/run-e2e |
|
@zroubalik I see this run-e2e is failing . Any idea how to fix this? |
|
/run-e2e |
I think that it was an unrelated issue |
|
Given checks have passed, can it be approved now? |
…ec,label or annotation is changed (kedacore#5282) Signed-off-by: deefreak <[email protected]> Signed-off-by: anton.lysina <[email protected]>
This change fixes #5281 .
We have verified that scaledobject reconcilation is triggered only when hpa spec/label changes or hpa is deleted.
I raise this PR to get early feedback and automated tests will be added soon.