polaris icon indicating copy to clipboard operation
polaris copied to clipboard

fixed pdbMinAvailableGreaterThanHPAMinReplicas and added validation for pdbMinAvailableEqualToHPAMinReplicas.

Open YuMuuu opened this issue 1 year ago • 7 comments

This PR fixes #1071

Checklist

  • [x] I have signed the CLA
  • [x] I have updated/added any relevant documentation

Description

What's the goal of this PR?

What changes did you make?

What alternative solution should we consider, if any?

  • I couldn't connect to circle ci for some reason so I ran test local only/

YuMuuu avatar Oct 03 '24 12:10 YuMuuu

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 03 '24 12:10 CLAassistant

Hi @YuMuuu, thanks for your contribution!

After reviewing the changes and discussing internally, we believe this update introduces a breaking change. To avoid impacting current Polaris clients, we suggest the following approach:

  • Retain the current check, but modify its logic (and docs) to check only for >, instead
  • Introduce a complementary check that specifically handles the = case.

Both changes we plan to release in a new minor version. This approach ensures compatibility with existing clients while addressing the functionality you're aiming for.

I understand this may require additional changes to your PR. Please let me know if you have the bandwidth to make these adjustments, or if you'd prefer someone else to take it from here.

Thanks again for your efforts!

vitorvezani avatar Oct 03 '24 16:10 vitorvezani

@vitorvezani Thanks for your reply. I agree with your idea. I’ll keep the name pdbMinAvailableGreaterThanHPAMinReplicas, fix logic, and create other complement validation. I’d like to fix the PR as you mentioned, but it might take time because I’m not a golang expert.

YuMuuu avatar Oct 04 '24 00:10 YuMuuu

I made a logic fix to pdbMinAvailableGreaterThanHPAMinReplicas and added validation for pdbMinAvailableEqualToHPAMinReplicas.

The names of the validations and their specifications have been aligned; however, it was found that pdbMinAvailableGreaterThanHPAMinReplicas and pdbMinAvailableEqualToHPAMinReplicas exhibit conflicting behavior.

Specifically, the following cases are now allowed under pdbMinAvailableEqualToHPAMinReplicas:

test/checks/pdbMinAvailableEqualToHPAMinReplicas/success-gt-percent.yaml

  • minAvailable: 15
  • minReplicas: 10

test/checks/pdbMinAvailableEqualToHPAMinReplicas/success-gt-scalar.yaml

  • minAvailable: 10
  • minReplicas: 5

These configurations are clearly incorrect. While applying both pdbMinAvailableGreaterThanHPAMinReplicas and pdbMinAvailableEqualToHPAMinReplicas together resolves the issue, using only pdbMinAvailableEqualToHPAMinReplicas could allow such incorrect configurations. Is this behavior acceptable?

YuMuuu avatar Oct 04 '24 18:10 YuMuuu

I believe this approach is acceptable, as it avoids triggering two policies for the same underlying issue. With both checks enabled by default, we can ensure all cases are covered.

Let me know if you have any thoughts or concerns, @sudermanjr

vitorvezani avatar Oct 04 '24 21:10 vitorvezani

@vitorvezani @sudermanjr Releasing it in the following order might be better I guess:

  1. change the logic of pdbMinAvailableGreaterThanHPAMinReplicas and create new pdbMinAvailableGreaterThanOrEsualToHPAMinReplicas
  2. deprecate the pdbMinAvailableGreaterThanHPAMinReplicas
  3. delete pdbMinAvailableGreaterThanHPAMinReplicas <- next major version

What do you think?

YuMuuu avatar Oct 05 '24 03:10 YuMuuu

That's a valid approach as well. However, I see a potential issue during the first release: whereas if pdbMinAvailable > HPAMinReplicas, it would trigger both checks simultaneously. I also think that a breaking change for this is a bit too much, having 2 similar checks that are mutually-exclusive sounds reasonable (although not perfect).

I'll discuss both options with Andy when he's back from his time off and keep you updated.

vitorvezani avatar Oct 08 '24 18:10 vitorvezani

Is Andy on a long vacation?

YuMuuu avatar Nov 19 '24 02:11 YuMuuu

No....(;_;) Could you please re-open this PR?. @vitorvezani

YuMuuu avatar Jan 28 '25 02:01 YuMuuu

@vitorvezani @sudermanjr What do you think this idea ? https://github.com/FairwindsOps/polaris/pull/1073#issuecomment-2394879611

I'm fine with either merging this PR as it is or implementing the suggested idea.

YuMuuu avatar Jan 31 '25 11:01 YuMuuu

@vitorvezani @sudermanjr I aplogize for bothering you while you are busy, but I want you to merge this PR. could you review it? 🙏

YuMuuu avatar Mar 14 '25 11:03 YuMuuu

@vitorvezani @sudermanjr could you review it? 🙏

YuMuuu avatar Apr 11 '25 21:04 YuMuuu