https://pulumi.com logo
Title
r

rapid-soccer-18092

10/15/2021, 7:40 AM
Hi. Pulumi preview/up doesnt seem to recognise changes to the helm chart values data. I've tried setting
ReplaceOnChanges = { "*" }
but that doesn't seem to kick in either. See thread for the code. How should I go about this?
var datadogChart = new Chart("datadog-helmchart",
    new ChartArgs
    {
        Chart = ChartName,
        Version = args.ChartVersion,
        Namespace = args.Namespace,
        Values = new Dictionary<string, object>
        {
            ["datadog"] = new Dictionary<string, object>
            {
                ["apiKey"] = args.ApiKey,
                ["site"] = "<http://datadoghq.eu|datadoghq.eu>",
                ["logs"] = new Dictionary<string, object>
                {
                    // Enable log collection
                    ["enabled"] = true,
                    ["containerCollectAll"] = true
                },
                // :::::ADDING THIS::::::
                ["apm"] = new Dictionary<string, object>
                {
                    ["enabled"] = true, 
                },
                ["kubelet"] = new Dictionary<string, object>
                {
                    ["tlsVerify"] = false
                }
            },
            ["clusterAgent"] = new Dictionary<string, object>
            {
                ["tokenExistingSecret"] = ChecksumSecretName
            }
        },
        FetchOptions = new ChartFetchArgs
        {
            Repo = ChartRepository
        }
    },
    new ComponentResourceOptions
    {
        Provider = options.Provider
        ReplaceOnChanges = { "*" },
    });
b

billowy-army-68599

10/15/2021, 4:47 PM
can you try
portEnabled
instead? https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml#L232
enabled
is deprecated and it might be broken in the chart. Does it work if you update existing values?
r

rapid-soccer-18092

10/18/2021, 7:25 AM
Thanks @billowy-army-68599 - let me give it a try
Changing the field to
portEnabled
doesnt indicate to Pulumi that the chart has changed. Any further help on this would be appreciated 🙂 How do I update helm chart config values so that Pulumi knows to update or recreate the chart?
b

billowy-army-68599

10/19/2021, 7:21 AM
if you have the full code I can try repro this tomorrow
r

rapid-soccer-18092

10/19/2021, 1:41 PM
Hey @billowy-army-68599 - unfortunately I dont have a full working solution for you, but here is the Datadog helm chart component resource that we're working with:
public class DatadogChart : ComponentResource
{
    private const string ChartName = "datadog";

    private const string ChartRepository = "<https://helm.datadoghq.com>";

    private const string ChecksumSecretName = "datadog-checksum-secret";

    public DatadogChart(string name, DatadogChartArgs args, ComponentResourceOptions options)
        : base("datatooks-aks:charts:DatadogChart", name, options)
    {
        var checksumPassword = new RandomPassword("datadog-checksum-password", new RandomPasswordArgs
        {
            Length = 32,
            Special = true
        },
        new CustomResourceOptions
        {
            Parent = this,
            Aliases = { new Alias() { Name = "datadog-checksum-password" } }
        });

        // We need to establish this in Pulumi otherwise it gets regenerated with each deployment, which redeploys the whole datadog chart.
        var secret = new Secret("datadog-checksum-secret",
            new SecretArgs
            {
                Metadata = new ObjectMetaArgs()
                {
                    Name = ChecksumSecretName,
                    Namespace = args.Namespace
                },
                StringData = checksumPassword
                    .Result
                    .Apply(x => new Dictionary<string, string>()
                    {
                        { "token", x }
                    })
            },
            new CustomResourceOptions
            {
                Provider = options.Provider,
                Parent = this,
                Aliases = { new Alias() { Name = "datadog-checksum-secret", NoParent = true } }
            });

        // Datadog chart. <https://github.com/DataDog/helm-charts/tree/main/charts/datadog>
        var datadogChart = new Chart("datadog-helmchart",
            new ChartArgs
            {
                Chart = ChartName,
                Version = args.ChartVersion,
                Namespace = args.Namespace,
                Values = new Dictionary<string, object>
                {
                    // Chart values schema can be found here: <https://github.com/DataDog/helm-charts/blob/main/charts/datadog/values.yaml>
                    ["datadog"] = new Dictionary<string, object>
                    {
                        ["apiKey"] = args.ApiKey,
                        ["site"] = "<http://datadoghq.eu|datadoghq.eu>",
                        ["logs"] = new Dictionary<string, object>
                        {
                            // Enable log collection
                            ["enabled"] = true,
                            ["containerCollectAll"] = true
                        },
                        ["apm"] = new Dictionary<string, object>
                        {
                            // Enable APM and tracing on port 8126
                            ["portEnabled"] = true, 
                        },
                        ["kubelet"] = new Dictionary<string, object>
                        {
                            ["tlsVerify"] = false // See: <https://github.com/DataDog/integrations-core/issues/2582>
                        }
                    },
                    ["clusterAgent"] = new Dictionary<string, object>
                    {
                        ["tokenExistingSecret"] = ChecksumSecretName
                    }
                },
                FetchOptions = new ChartFetchArgs
                {
                    Repo = ChartRepository
                }
            },
            new ComponentResourceOptions
            {
                Provider = options.Provider,
                DependsOn = { checksumPassword },
                ReplaceOnChanges = { "*" },
                Parent = this,
                Aliases = { new Alias() { Name = "datadog-chart" } }
            });
    }
}
1
b

billowy-army-68599

10/19/2021, 8:36 PM
@ancient-megabyte-79588 i managed to repro this, and then dug into why: it appears to be a bug in the helm chart. Nowhere outside the templates is that apm.PortEnabled uses, and it's actually set to true as a hardcoded value: https://github.com/DataDog/helm-charts/blob/e535f1d9f92c6bf5d406fbabef3aa353bafe812c/charts/datadog/templates/_container-trace-agent.yaml#L35 I'd recommend filing a bug upstream
r

rapid-soccer-18092

10/20/2021, 8:06 AM
Very nice find. Thanks for looking into this @billowy-army-68599
Im also not seeing the "legacy"
enabled
being used