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

feat(eks): add atomic flag for aws-eks Helm Chart #29454

Merged
merged 10 commits into from
Apr 26, 2024

Conversation

shikha372
Copy link
Contributor

@shikha372 shikha372 commented Mar 12, 2024

Issue # (if applicable)

Closes #22254.

Reason for this change

Currently, if chart is installed to the EKS cluster with wait timeout period set and fails initialization, helm will fail to send a response back to custom resource and it will be stuck in pending upgrade state (expected state is failed) .
Subsequent attempts to update the stack will result in failure while chart is stuck in pending upgrade state until manually rolled back or deleted from the cluster.

Description of changes

Added feature flag --atomic supported by helm currently to mark the operation as atomic which will automatically rolls back the changes in case of upgrade/installation failure.
Reference doc: https://helm.sh/docs/helm/helm_install/#options

Description of how you validated changes

Added unit tests to check if flag is set as per user input in the template.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@shikha372 shikha372 added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Mar 12, 2024
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Mar 12, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team March 12, 2024 00:20
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 12, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@shikha372 shikha372 added the pr-linter/exempt-readme The PR linter will not require README changes label Mar 12, 2024
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 12, 2024 05:34

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@shikha372 shikha372 marked this pull request as ready for review March 18, 2024 23:23
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 18, 2024
@godwingrs22 godwingrs22 self-requested a review April 1, 2024 17:35
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Apr 1, 2024
Copy link
Member

@godwingrs22 godwingrs22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment. Other than that LGTM.

@godwingrs22 godwingrs22 self-assigned this Apr 19, 2024
@paulhcsun paulhcsun changed the title feat: add atomic flag for aws-eks Helm Chart feat(eks): add atomic flag for aws-eks Helm Chart Apr 19, 2024
@shikha372 shikha372 removed the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Apr 26, 2024
@shikha372
Copy link
Contributor Author

One small comment. Other than that LGTM.

Thank you @godwingrs22 for the review, addressed in latest rev for your final review

@@ -90,7 +91,7 @@ def helm_handler(event, context):
chart_dir = get_chart_from_oci(tmpdir.name, repository, version)
chart = chart_dir

helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace)
helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace, atomic)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this will be passed to helm definition as skip_crds as that is the next parameter. I think
since atomic is a 12th parameter in the helm defintion, this needs to come after skip_crds is passed or you can pass the parameter explicitly like below

helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace, atomic=atomic)

But not sure why the existing skip_crds is not passed to the defintion. Current code looks like it always be false and doesn't get from the resouce props. But this is different issue and just want to highlight it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is interesting since both integration test and unit tests are passing for this too, imo it could be related to that these two flags don't need any additional handling in regards to values and will be just appended to command if set to true, somehow if this is propogating from props.atomic to underlying function, but yes this is weird that this is working for skip_crds and also have a successful tests passed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, seems like the unit test for skip_crds to disable by default is not correct I feel. Instead it needs to find the resource with { SkipCrds: true } which will be expected to 0 like how you have handled for atomic or wait property.

Copy link
Member

@godwingrs22 godwingrs22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @shikha372 for your contribution.

Copy link
Contributor

mergify bot commented Apr 26, 2024

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).

@godwingrs22
Copy link
Member

@Mergifyio update

Copy link
Contributor

mergify bot commented Apr 26, 2024

update

☑️ Nothing to do

  • queue-position=-1 [📌 update requirement]
  • #commits-behind>0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]

@godwingrs22
Copy link
Member

@Mergifyio update

Copy link
Contributor

mergify bot commented Apr 26, 2024

update

❌ Mergify doesn't have permission to update

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/request-cli-integ-test.yml without workflows permission

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: e383fab
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Apr 26, 2024

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).

@mergify mergify bot merged commit 666f24f into aws:main Apr 26, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-eks: support --atomic flag for helm commands
3 participants