Closed ivankatliarchuk closed 2 months ago
Closing, as currently supported with tpl
here https://github.com/DataDog/helm-charts/blob/3097984ae336c57ada9a41b2e7a9032c58b99440/charts/datadog/templates/cluster-agent-confd-configmap.yaml#L13
Having a function in helpers is a great addition do
Describe what happened: Currently we are using
datadog
helm chart as a dependency e.g. Chart.yamland in our
values.yml
confd configuration looks similar toThis is just an example, we have way more services supported. From the first look, everything can be substituted. However, the devil is in the details. Our case, every environment has different services available, as well as all the values derived from live environment before helm install/update, more important, one environment may have 5 different services, the other one 3. For example sandbox has 0
kafka_consumers
when dev2
and prod6
.We do have default
values.yaml
as well asdev.yaml
,sandbox.yaml
and etc. But this static files do not work. As we do need dynamicaly to add/remove this configuration from confd.We tried
kustomize
, but it was not working well. There are probably other hacks. Current process looks like this at the mean time Steps:values.yaml
contains all theconfd
configuration for all the environmentsvalues.yaml
yq
, and removes entries fromclusterAgent.confd
e.g.yq -yi "del(.datadog.clusterAgent.confd[\"kafka_consumer_1.yaml\"])
This approach is not ideal, due to different tooling used on top of helm e.g.
sed
andyq
. What more important, it's super easy to introduce a new bug, or sometimes new services are added, and they are probably not added to datadog agent, or more often case; the service is no longer running, and the config does not correctly remove the entry, as a result, we have a handful amount of error logs saying that service not found or similar. Of course, there are multiple ways to approach the problem. In past, we were using an in-house helm chart, but the upstream official chart seems a way forward for us.Describe what you expected: To be able to override
.Values.clusterAgent.confd
at helm deployment time. How this can be doneCurrently the
confd
is set directly here.The proposal is to move all the references of
.Values.clusterAgent.confd
tohelpers.tpl
so that there is no need to override the whole template or try to find a way how to turn on/off entries in config, but just a function. For exampleoriginal
charts/datadog/helpers.tpl
will let us to override in top-level chart top-level
mychart/helpers.tpl
Override function can have more verbose and templated logic as opposite to original chart. Plus this should let us to validate
confd
at deploy time within helm chart as well e.g. if value not set for example, or incorrect formatAdditional environment details (Operating System, Cloud provider, etc): AWS
Is this a feature you are interested in implementing yourself?
I can