Skip to content
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

fix!: fix CheckFallbackValid logic #6538

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

y-rabie
Copy link
Contributor

@y-rabie y-rabie commented Feb 10, 2025

This fixes the CheckFallbackValid logic used in the admission webhook. The way it should go is:

  • If we are using ScalingModifiers and ScaledObject.Spec.Advanced.ScalingModifiers.MetricType is not AverageValue, then this is invalid. So, this becomes inline with the change in fix: fix isFallbackEnabled when using scaling modifiers #6521

  • If we are not using ScalingModifiers

    1. If only cpu and memory are used, then fallback is invalid.
    2. If some other triggers are used (solely or in addition to cpu/memory), and not one of them has AverageValue type, then fallback is invalid.
    3. If some other triggers are used (solely or in addition to cpu/memory), and at least one of them has AverageValue type, then fallback is valid. This is actually inline with the code logic with the function doFallback, where it is called for every metricSpec that has the type AverageValue.

The PR #6407 seems related to this. I am not sure what it is trying to do per se with regards to the cpu and memory. Because it seems to be logging instead of returning the error when encountering cpu/memory, then falling to the next if condition which will return the error either way

Checklist

@y-rabie y-rabie requested a review from a team as a code owner February 10, 2025 18:26
@y-rabie y-rabie force-pushed the fix-CheckFallbackValid branch 3 times, most recently from b65860d to 613c653 Compare February 10, 2025 18:44
@y-rabie
Copy link
Contributor Author

y-rabie commented Feb 10, 2025

@zroubalik @JorTurFer If any of you guys has time to look into this 😅 , I think this needs to be released in v2.17.0 along with the rest of changes.

@JorTurFer
Copy link
Member

The PR #6407 seems related to this. I am not sure what it is trying to do per se with regards to the cpu and memory. Because it seems to be logging instead of returning the error when encountering cpu/memory, then falling to the next if condition which will return the error either way

Actually, CPU and memory support AverageValue but it's true that this doesn't make sense, the check should be:

  • If CPU/Memory scaler, just continue with the iteration without failing
  • At the end of the iterations, if there are only CPU/Memory scalers and fallback enabled, raise an error (because fallback with only CPU/Memory is a failure)

@JorTurFer
Copy link
Member

lol, my point was literally your message 🤦
I must read more slowly

@zroubalik
Copy link
Member

zroubalik commented Feb 11, 2025

/run-e2e fallback
Update: You can check the progress here

@y-rabie y-rabie force-pushed the fix-CheckFallbackValid branch from 8af61c3 to e931267 Compare February 13, 2025 15:30
@heshamelsherif97
Copy link

I feel like this needs to get merged before the 2.17 release @JorTurFer

@JorTurFer
Copy link
Member

PTAL @zroubalik @wozniakjan

@rickbrouwer
Copy link
Contributor

rickbrouwer commented Mar 24, 2025

I see that the changelog is missing anyway. Can you add it?

@y-rabie y-rabie force-pushed the fix-CheckFallbackValid branch from 797c6d2 to 00a8ca6 Compare March 24, 2025 11:16
@y-rabie
Copy link
Contributor Author

y-rabie commented Mar 24, 2025

@rickbrouwer There was already a fix for this very part that added a changelog line. I though I might append my PR to the same line but apparently it fails the CI check. Should I replace the line, or append a new line?

@rickbrouwer
Copy link
Contributor

@rickbrouwer There was already a fix for this very part that added a changelog line. I though I might append my PR to the same line but apparently it fails the CI check. Should I replace the line, or append a new line?

I think a new line to the other one with a description of what makes this PR different from the previous one so that both pull requests are mentioned. This also for some traceability.

@y-rabie y-rabie force-pushed the fix-CheckFallbackValid branch from 00a8ca6 to e1e0434 Compare March 24, 2025 12:14
@zroubalik
Copy link
Member

zroubalik commented Mar 26, 2025

/run-e2e fallback
Update: You can check the progress here

@zroubalik zroubalik enabled auto-merge (squash) March 26, 2025 13:11
@zroubalik zroubalik merged commit aa2c4e7 into kedacore:main Mar 26, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants