https://pulumi.com logo
Title
s

square-energy-17741

10/12/2021, 3:36 AM
Has anyone faced issue with typescript
helm.v3.Release
not honoring
namespace
with certain charts. I have tried with
helm
CLI and
helm.v3.Chart
and they both work correctly. This is happening with only certain Charts - • jx-git-operator from https://jenkins-x-charts.github.io/repocluster-autoscaler from https://kubernetes.github.io/autoscaler
w

worried-city-86458

10/12/2021, 5:00 AM
I've had no problems with the very latest pulumi kubernetes for dotnet and installing cluster autoscaler when specifying
kube-system
as the namespace
// cluster autoscaler; <https://github.com/kubernetes/autoscaler>
Logger.LogDebug("Installing cluster autoscaler");
var clusterAutoscalerRole = new RoleX($"{k8sPrefix}-cluster-autoscaler",
    new RoleXArgs
    {
        AssumeRolePolicy = IamHelpers.AssumeRoleForServiceAccount(oidcArn, oidcUrl, "kube-system", "cluster-autoscaler", awsProvider),
        InlinePolicies = { ["policy"] = ReadResource("ClusterAutoscalerPolicy.json") }
    },
    new ComponentResourceOptions { Provider = awsProvider });

var clusterAutoscalerValues = Output.Tuple(clusterName, clusterAutoscalerRole.Arn).Apply(((string ClusterName, string RoleArn) tuple) =>
    new Dictionary<string, object>
    {
        ["nameOverride"] = "cluster-autoscaler",
        ["kubeTargetVersionOverride"] = K8sConfig.Version,
        ["image"] = new
        {
            tag = $"v{K8sConfig.Version}.0",
            pullPolicy = "IfNotPresent"
        },
        ["priorityClassName"] = "system-cluster-critical",
        ["serviceMonitor"] = new
        {
            enabled = true,
            @namespace = "kube-system",
            selector = new { }
        },
        //["prometheusRule"] = new
        //{
        //    enabled = true,
        //    @namespace = "kube-system",
        //    rules = new[] { new { } }
        //},
        ["cloudProvider"] = "aws",
        ["autoDiscovery"] = new
        {
            enabled = true,
            clusterName = tuple.ClusterName
        },
        ["awsRegion"] = AwsConfig.Region,
        ["extraArgs"] = new Dictionary<string, object>
        {
            ["v"] = 3,
            ["balance-similar-node-groups"] = true,
            ["expander"] = "least-waste",
            ["skip-nodes-with-local-storage"] = false,
            ["skip-nodes-with-system-pods"] = false
        },
        ["podAnnotations"] = new Dictionary<string, string> { ["<http://cluster-autoscaler.kubernetes.io/safe-to-evict|cluster-autoscaler.kubernetes.io/safe-to-evict>"] = "false" },
        ["rbac"] = new { serviceAccount = new { annotations = new Dictionary<string, string> { ["<http://eks.amazonaws.com/role-arn|eks.amazonaws.com/role-arn>"] = tuple.RoleArn } } }
    }.ToDictionary()); // workaround <https://github.com/pulumi/pulumi/issues/8013>

new Release("cluster-autoscaler",
    new ReleaseArgs
    {
        Namespace = "kube-system",
        Name = "cluster-autoscaler",
        RepositoryOpts = new RepositoryOptsArgs { Repo = "<https://kubernetes.github.io/autoscaler>" },
        Chart = "cluster-autoscaler",
        Version = K8sConfig.ClusterAutoscalerChartVersion,
        Values = clusterAutoscalerValues,
        Atomic = true
    },
    new CustomResourceOptions { DependsOn = kubePrometheusStackCrds, Provider = k8sProvider });
If you look through the templates, the use of namespaces varies from: • {{ .Release.Namespace }} • {{ .Values.prometheusRule.namespace }} defaults to monitoring • {{ .Values.serviceMonitor.namespace }} defaults to monitoring • not specified But with my values above, and specifying the namespace to the helm release resource, everything is in my specified namespace.
(I prefer to keep prometheus operator resources like service monitors in the same namespace as the related resources)
s

sparse-park-68967

10/12/2021, 3:27 PM
@square-energy-17741 you will likely want to make sure you are running with the latest provider - 3.8.1
s

square-energy-17741

10/13/2021, 2:54 AM
Thanks @sparse-park-68967 Using 3.8.1 fixed it
👍 1