Replies: 4 comments 3 replies
-
I assume the output in the dist won't fundamentally change, just the addition of a Chart file? What about about a values file? |
Beta Was this translation helpful? Give feedback.
-
It is possible to deploy a cdk8s chart with Helm but it's hacky:
# in ../dummy_chart
# helm values.yaml
resources: {}
# templates/resources.yaml
{{- range $v := .Values.resources }}
---
{{$v | toYaml }}
{{- end }} Then synth your cdk8s app and pass the output ( list of yaml strings ) to the chart template by setting the relevant override in import cdk8s_plus_26.k8s as cdk8splus
bucket = Bucket(self, "Bucket)
app = cdk8s.App(outdir="dist/test")
chart = cdk8s.Chart(app, "Test")
# cdk8s resource containing a token
cdk8splus.KubeConfigMap(chart, "ConfigMap", data={
"s3_bucket": bucket.bucket_name
})
data = app.synth_yaml()
helm_overrides = { "resources": list(yaml.safe_load_all(data)) }
asset = Asset(self, "ChartAsset2", path=path.join(
path.dirname(path.realpath(__file__)), "../dummy_chart"
))
HelmChart(
self,
"Cdk8sHelmRelease",
chart_asset=asset,
cluster=cluster,
create_namespace=False,
release="test",
namespace=namespace,
wait=True,
timeout=Duration.minutes(15),
values=helm_overrides
) you can wrap all this in L2 that generates and deploys the Helm chart e.g Cdk8sHelmChart(self, "Chart",
version="1.0.0",
chart_version="2.0",
resources=cdk8s_resources, # list[str]
cluster=cluster,
namespace=namespace,
.....
|
Beta Was this translation helpful? Give feedback.
-
Isn't this what the helmify project is for? |
Beta Was this translation helpful? Give feedback.
-
So it seems like today there is the capability that's been discussed ad nauseum in several issues / proposals to generate the output as a helm chart. But, nothing has been done to be parameterizable? I understand the difficulty with translating programming language logic into go templates, but as noted in this comment #1196 (reply in thread), supporting values alone seems reasonable |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, synthesizing a cdk8s application will produce a set of Kubernetes manifest files into a target output directory (e.g
./dist
). Customers can then take these manifests and deploy them to a cluster using their preferred deployment tool.One such popular deployment tool is Helm. However, trying to deploy the
dist
directory with helm will result in an error:This is because helm expects its input to be structured as a Helm Chart. To make it easier to deploy cdk8s applications with helm, we propose a new option to the
cdk8s synth
command, that will allow synthesize a cdk8s app directly into a Helm Chart, which can be passed as is to helm. The proposed customer experience would be:cdk8s synth --format helm --output dist && helm install <release-name> ./dist
Internally cdk8s will generate the Chart.yaml file and whatever else is needed to adhere to the Helm chart format.
Beta Was this translation helpful? Give feedback.
All reactions