feat(elasticloadbalancingv2): health check interval greater than timeout#29075
feat(elasticloadbalancingv2): health check interval greater than timeout#29075mergify[bot] merged 9 commits intoaws:mainfrom
Conversation
|
Exemption request: I'm adding a validation for parameters. Shouldn't need an integration test here. |
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
| } | ||
| if (healthCheck.interval && healthCheck.interval.toSeconds() < timeoutSeconds) { | ||
| ret.push(`Health check timeout '${timeoutSeconds}' must not be greater than the interval '${healthCheck.interval.toSeconds()}'`); | ||
| } |
There was a problem hiding this comment.
moving this validation to shared
tmokmss
left a comment
There was a problem hiding this comment.
LGTM overall, with a few minor comment.
|
|
||
| if (intervalSeconds && timeoutSeconds) { | ||
| if (intervalSeconds < timeoutSeconds) { | ||
| ret.push('Health check interval must be greater than the timeout; received interval ' + |
There was a problem hiding this comment.
must be greater than
shouldn't the validation be intervalSeconds <= timeoutSeconds then? A link to the doc (in PR comment) stating this constraint will help.
There was a problem hiding this comment.
added a link to the doc. should be <.
There was a problem hiding this comment.
Thanks for the link.
Timeout
This value must be less than the Interval value.
So we shouldn't allow the case when intervalSeconds == timeoutSeconds. Then the condition should be intervalSeconds <= timeoutSeconds
There was a problem hiding this comment.
@tmokmss I removed the doc link. That link is actually for Classic Load Balancers. I think you're correct in that it's intervalSeconds <= timeoutSeconds but the old code for NLBs (I moved it to shared above) has <. Thoughts? It doesn't say this anywhere in the docs but if you look at the issue the errors says: Health check interval must be greater than the timeout.
There was a problem hiding this comment.
The PR introduced the validation #26031 also described the requirement as below:
Ensure that HealthCheckTimeoutSeconds is not greater than HealthCheckIntervalSeconds.
So I guess it was just a mistake? edit) No, the original implementation matches the comment.
Ideally we should try the configuration (interval==timeout) both for ALB and NLB and it emits the same error.
There was a problem hiding this comment.
Take a look here: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/target-group.test.ts#L386-L409. We have a specific test to not throw an error when they're the same. Confusing!
@pahud Is this something you could ask the AWS team about? It would be nice to have this added to the AWS documentation, and then we can decide which way the code needs to be.
There was a problem hiding this comment.
There was actually a similar discussion in the PR: #26031 (comment)
So I guess we should keep the validation intervalSeconds < timeoutSeconds, and update the comment to e.g. must be greater than or equal to.
There was a problem hiding this comment.
I changed back to < and added a note. Thanks, @tmokmss 👍🏼
| const intervalSeconds = this.healthCheck.interval?.toSeconds(); | ||
| const timeoutSeconds = this.healthCheck.timeout?.toSeconds(); | ||
|
|
||
| if (intervalSeconds && timeoutSeconds) { |
There was a problem hiding this comment.
Will this work as expected if either intervalSeconds or timeoutSeconds equals to zero?
There was a problem hiding this comment.
HealthCheckTimeoutSeconds has a range of 2-120 and HealthCheckIntervalSeconds is 5-300. We have separate checks on the ranges, so they'll never be 0.
dffea61 to
af8d3e6
Compare
|
@kaizencc could I have a review here please ? |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
paulhcsun
left a comment
There was a problem hiding this comment.
Code changes look good, just left one comment about adding an additional test for the edge case.
| }).toThrow(/Health check interval '3' not supported. Must be between 5 and 300./); | ||
| }); | ||
|
|
||
| test('Throws error for health check interval less than timeout', () => { |
There was a problem hiding this comment.
Could you add an edge case test for interval == timeout?
There was a problem hiding this comment.
I added a test for this. See discussion above on why we chose to allow them to be equal.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Closes #29062.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license