pulumi / pulumi-kubernetes

A Pulumi resource provider for Kubernetes to manage API resources and workloads in running clusters
https://www.pulumi.com/docs/reference/clouds/kubernetes/
Apache License 2.0
397 stars 113 forks source link

Chart v4 fails when resource name is mixed case #3056

Open EronWright opened 2 weeks ago

EronWright commented 2 weeks ago

What happened?

I tried to deploy the provided example and saw an unexpected error:

    io.grpc.StatusRuntimeException: UNKNOWN: release name "argocdChart": invalid release name, must match regex ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ and the length must not be longer than 53
        at io.grpc.Status.asRuntimeException(Status.java:539)
        at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:544)
        at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:576)
        at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:757)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:736)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)

Example

        var argocdChart = new Chart("argocdChart", ChartArgs.builder()
            .chart("argo-cd")
            .version("6.11.1")
            .namespace("argocd")
            .repositoryOpts(RepositoryOptsArgs.builder()
                .repo("https://argoproj.github.io/argo-helm")
                .build())
            .build());

Output of pulumi about

❯ p about
CLI          
Version      3.117.0
Go Version   go1.22.3
Go Compiler  gc

Plugins
KIND      NAME        VERSION
language  java        unknown
resource  kubernetes  4.13.1
resource  random      4.16.2

Additional context

The root cause is that the Chart v4 resource uses the resource name as the default "release name" for templating purposes. Apparently the Helm code requires that release names meet certain requirements.

My suggestion is to either use the chart's own name (.Metadata.Name) by default, to minimize the need to use fullnameOverride.

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).