aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.34k stars 3.76k forks source link

(AWS-EKS): (Support for helm upgrade) #28032

Open mavais opened 7 months ago

mavais commented 7 months ago

Describe the feature

support upgrade or install helm chart as an argument to eks.HelmChart

Use Case

We've a EKS cluster and use CDK to run helm charts and pass values by reading in a yaml and parsing it. However, in some use cases, where we make an update to the yaml values file, the changes do not take into effect when we update the stack. As a workaround, we currently delete the stack and recreate it with new values.

Proposed Solution

to have an argument to let either upgrade or install the helm charts https://helm.sh/docs/helm/helm_upgrade/

Other Information

No response

Acknowledgements

CDK version used

2.93

Environment details (OS name and version, etc.)

typescript

pahud commented 7 months ago

I am not 100% clear about your use case. Are you able to share a minimal code to illustrate your use case? Generally when you define a HelmChart, under the hood the custom resource would always run helm upgrade for you.

github-actions[bot] commented 7 months ago

This issue 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.

mavais commented 7 months ago

@pahud we are deploying some charts using the following CDK

const openmetadataHelmChart = new eks.HelmChart( this, addStageSuffix('ABCOpenmetadataHelmChart', props.stage), { cluster: props.eksCluster, chart: 'openmetadata', repository: 'oci://' + props.ecrOpenMetadataRepo.repositoryUri, release: 'openmetadata', namespace: 'default', version: '1.1.14', values: openmetadataDefinition, timeout: Duration.minutes(15), }, );

The values openmetadataDefinition is a yaml which we parse before applying to it:

const openmetadataDefinition = yaml.parse( fs.readFileSync(path.join(__dirname, '../../../lib/resources/yaml/openmetadata.yaml'), 'utf8'), );

However, any change to yaml isn't reflected in the pods run. To make a change, we've to bring down the stack by deleting it. Recreating the stack as new one helps in picking up the new changes to the yaml file

if the resource is already running an helm upgrade, what probably can help us fix the above behavior. We don't want to everytime bring the stack down just for upgrading config values

Wayne9981 commented 3 days ago

I guess the proposed solution is as straightforward as https://github.com/aws/aws-cdk/issues/22254, just need to add the --reuse-values flag for helm commands.