-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(appmesh): eagerly validate healthCheck
settings
#4221
Conversation
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
* | ||
* @see https://docs.aws.amazon.com/app-mesh/latest/APIReference/API_HealthCheckPolicy.html | ||
*/ | ||
const HEALTH_CHECK_PROPERTY_THRESHOLDS: {[key in (keyof CfnVirtualNode.HealthCheckProperty)]?: [number, number]} = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the use of TS typing features here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ❤️
@@ -159,6 +177,22 @@ function renderHealthCheck(hc: HealthCheck | undefined, pm: PortMapping): CfnVir | |||
timeoutMillis: (hc.timeout || cdk.Duration.seconds(2)).toMilliseconds(), | |||
unhealthyThreshold: hc.unhealthyThreshold || 2, | |||
}; | |||
|
|||
(Object.keys(healthCheck) as Array<keyof CfnVirtualNode.HealthCheckProperty>) | |||
.filter((key) => HEALTH_CHECK_PROPERTY_THRESHOLDS[key] && typeof healthCheck[key] === 'number') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably also want to filter for !Token.isUnresolved
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't typeof healthCheck[key] === 'number'
cover it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess healthCheck
could be unresolved, but I'd have to check it earlier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, Tokens can also be encoded into numbers. It will look like -1.358238248E-18
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks. Done
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
healthCheck
settings
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
* feat(appmesh): throw if healthCheck thresholds aren't met * feat(appmesh): throw if healthCheck path with Protocol.TCP * chore: tslint fix * chore: better threshold hint * fix: check isUnresolved * chore: remove trailing whitespace
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license