Skip to content

feat(eks): install helm chart from asset#15899

Closed
pradoz wants to merge 21 commits intoaws:masterfrom
pradoz:master
Closed

feat(eks): install helm chart from asset#15899
pradoz wants to merge 21 commits intoaws:masterfrom
pradoz:master

Conversation

@pradoz
Copy link
Copy Markdown

@pradoz pradoz commented Aug 5, 2021

Adding on to the work @plumdog started on #13496 and implementing the changes suggested by @iliapolo

Related to #9273

Use Case

To be able to use private helm charts without needing a private chart repository.

Proposed Solution

Allow helm charts (https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-eks.HelmChart.html) to be an asset by introducing the property chartAsset.


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

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Aug 5, 2021

@iliapolo iliapolo changed the title feat(aws-eks): install helm chart from asset feat(eks): install helm chart from asset Aug 5, 2021
@iliapolo iliapolo self-assigned this Aug 5, 2021
with open(values_file, "w") as f:
f.write(json.dumps(values, indent=2))

if not request_type == "Delete" and chart_asset is not None and chart_asset.startswith('s3://'):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move this logic in between here:

if request_type == 'Create' or request_type == 'Update':
helm('upgrade', release, chart, repository, values_file, namespace, version, wait, timeout, create_namespace)

And extract the whole download-and-extract-asset logic into a function.

Also - if you are expecting URL's to start with s3:// - validate that. Don't ignore it if they dont.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

chart_asset.startswith('s3://'): should validate that URL's start with s3:// unless I'm missing something obvious. Could you please explain more?

Copy link
Copy Markdown
Contributor

@iliapolo iliapolo Sep 12, 2021

Choose a reason for hiding this comment

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

Right now you apply the chart asset logic if chart_asset_url is defined and it starts with s3://.
What happens if this function is invoked for some reason on a chart_asset_url in the form of not-s3://?

Currently you will just ignore this, and fallback to the regular logic. Is this the correct behavior? This is a miss-configuration by the user, and we should fail, letting them know that a URL must start with s3:// if it is provided.

Same thing for repository, what happens if a user configured repository as well as chart_asset_url? This should fail, not fallback.

if chart_asset_url != None:
  if not chart_asset_url.startswith('s3://'):
    raise RuntimeError("'ChartAssetURL' must start with 's3://'")
  if repository != None:
    raise RuntimeError("'Repository' is not allowed when configuring 'ChartAssetURL'")
  if version != None:
    raise RuntimeError("'Version' is not allowed when configuring 'ChartAssetURL'")

  chart = get_chart_asset_from_url(chart_asset_url, outdir)

path: path.join(__dirname, 'test-chart'),
});
this.cluster.addHelmChart('test-chart', {
chart: 'test-chart-asset',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this really necessary? Seems like we can now make this an optional property, and validate that either chart or chartAsset is used.

Also - does repository and version have any meaning when using an asset? Should we assert they are not specified when using chartAsset?

Copy link
Copy Markdown
Author

@pradoz pradoz Aug 5, 2021

Choose a reason for hiding this comment

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

I agree with the point on making it an optional property, then validating that either chart or chartAsset is used.

For the second point, I don't believe so. I'll test that assertion out.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I believe that repository should be None, but it would be another feature/issue to support versions for chartAsset. A possible solution would be to create nested file paths in s3, where some path references nested directories to scan for a specified version number.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with the point on making it an optional property, then validating that either chart or chartAsset is used.

I don't see this change...am I missing something? We also need to validate the neither repository nor version is used if chartAsset is defined.

@iliapolo iliapolo added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 5, 2021
@pradoz
Copy link
Copy Markdown
Author

pradoz commented Aug 5, 2021

Thanks for the quick reply @iliapolo I'll make these requested changes or add explanations soon

@mergify mergify bot dismissed iliapolo’s stale review August 10, 2021 06:15

Pull request has been modified.

@pradoz
Copy link
Copy Markdown
Author

pradoz commented Aug 19, 2021

The requested changes by @iliapolo have been made. I will make sure this PR stays up-to-date with aws:master to ensure a smooth merge.

If anyone has feedback or questions regarding the changes, please let me know!

@iliapolo
Copy link
Copy Markdown
Contributor

Thanks @pradoz - I'll take a look next week 👍

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 4bb21e4
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@pradoz pradoz requested a review from iliapolo September 8, 2021 23:06
@iliapolo iliapolo removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 12, 2021
@iliapolo
Copy link
Copy Markdown
Contributor

@pradoz Few more comments. See above.

@iliapolo iliapolo added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 12, 2021
@github-actions
Copy link
Copy Markdown
Contributor

This PR has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 21, 2021
@github-actions github-actions bot closed this Sep 26, 2021
@iliapolo
Copy link
Copy Markdown
Contributor

@pradoz This was automatically closed for no activity but i'm happy to pick this up again when you have capacity.

@neelakansha85
Copy link
Copy Markdown

Is this PR still being worked on? We are looking for this functionality for a customer using CDK.

@cmckni3
Copy link
Copy Markdown
Contributor

cmckni3 commented Oct 28, 2021

See #17217 for comments and updates

mergify bot pushed a commit that referenced this pull request Dec 16, 2021
Adding on to the work @plumdog started on #13496 and @pradoz in #15899.  Implemented the @iliapolo's [suggested changes](https://github.com/aws/aws-cdk/pull/15899/files#r683431181)

Related to #9273

### Use Case

To be able to use private helm charts without needing a private chart repository.

### Proposed Solution

[Allow helm charts](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-eks.HelmChart.html) to be an asset by introducing the property `chartAsset`.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
Adding on to the work @plumdog started on aws#13496 and @pradoz in aws#15899.  Implemented the @iliapolo's [suggested changes](https://github.com/aws/aws-cdk/pull/15899/files#r683431181)

Related to aws#9273

### Use Case

To be able to use private helm charts without needing a private chart repository.

### Proposed Solution

[Allow helm charts](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-eks.HelmChart.html) to be an asset by introducing the property `chartAsset`.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants