UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 2.06 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HelmChart=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../core"),constructs_1=require("constructs"),kubectl_provider_1=require("./kubectl-provider");class HelmChart extends constructs_1.Construct{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_eks_HelmChartProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,HelmChart),error}const stack=core_1.Stack.of(this),provider=kubectl_provider_1.KubectlProvider.getOrCreate(this,props.cluster),timeout=props.timeout?.toSeconds();if(timeout&&timeout>900)throw new Error("Helm chart timeout cannot be higher than 15 minutes.");if(!props.chart&&!props.chartAsset)throw new Error("Either 'chart' or 'chartAsset' must be specified to install a helm chart");if(props.chartAsset&&(props.repository||props.version))throw new Error("Neither 'repository' nor 'version' can be used when configuring 'chartAsset'");const wait=props.wait??!1,createNamespace=props.createNamespace??!0,skipCrds=props.skipCrds??!1;props.chartAsset?.grantRead(provider.handlerRole),new core_1.CustomResource(this,"Resource",{serviceToken:provider.serviceToken,resourceType:HelmChart.RESOURCE_TYPE,properties:{ClusterName:props.cluster.clusterName,RoleArn:provider.roleArn,Release:props.release??core_1.Names.uniqueId(this).slice(-53).toLowerCase(),Chart:props.chart,ChartAssetURL:props.chartAsset?.s3ObjectUrl,Version:props.version,Wait:wait||void 0,Timeout:timeout?`${timeout.toString()}s`:void 0,Values:props.values?stack.toJsonString(props.values):void 0,Namespace:props.namespace??"default",Repository:props.repository,CreateNamespace:createNamespace||void 0,SkipCrds:skipCrds||void 0}})}}exports.HelmChart=HelmChart,_a=JSII_RTTI_SYMBOL_1,HelmChart[_a]={fqn:"aws-cdk-lib.aws_eks.HelmChart",version:"2.70.0"},HelmChart.RESOURCE_TYPE="Custom::AWSCDK-EKS-HelmChart";