pulumi-kubernetes: Helm Chart Issue - wrong version of .Capabilities.KubeVersion.GitVersion passed?

What happened?

It seems an issue related to the fact that the version of k8s passed to helm might be wrong or invalid. I have the latest nuget and when we run our Azure pipeline, it seems that the capability passed is not right since it resolves to the ‘else’.

This is in istiod 1.17.1 chart.

{{- if .Values.global.defaultPodDisruptionBudget.enabled }} {{- if (semverCompare “>=1.21-0” .Capabilities.KubeVersion.GitVersion) }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 {{- end }} kind: PodDisruptionBudget

is there a way to know what version is passed in .Capabilities.KubeVersion.GitVersion ?

Thanks,

Expected Behavior

“apiVersion: policy/v1” should been resolved in the chart

Steps to reproduce

private const string IstioRepoUrl = "https://istio-release.storage.googleapis.com/charts";

...
            istiod = new Chart(chartName, new ChartArgs
            {
                Chart = "istiod",
                Version = config.Version,
                FetchOptions = new ChartFetchArgs
                {
                    Repo = IstioRepoUrl
                },
                Namespace = istioNamespace.Name,
                ResourcePrefix = resourcePrefix
            }, new ComponentResourceOptions
            {
                DependsOn = baseIstio,
                Parent = parent
            });
...

Output of pulumi about

CLI          
Version      3.60.1
Go Version   go1.20.2
Go Compiler  gc

Plugins
NAME          VERSION
azure         5.38.0
azure-native  1.98.1
azuread       5.36.0
azuredevops   2.7.0
confluent     0.2.2
dotnet        unknown
kafka         3.4.0
kubernetes    3.24.2

Host     
OS       ubuntu
Version  20.04
Arch     x86_64

This project is written in dotnet: executable='/opt/hostedtoolcache/dotnet/dotnet' version='6.0.407'

Backend        
Name           ****
URL            azblob://state
User           ****
Organizations  

Dependencies:
NAME                                            VERSION
Azure.Identity                                  1.8.2
Azure.Security.KeyVault.Secrets                 4.5.0
KubernetesClient                                10.1.4
Microsoft.Extensions.Localization.Abstractions  7.0.4
Pulumi                                          3.54.1
Pulumi.Azure                                    5.38.0
Pulumi.AzureAD                                  5.36.0
Pulumi.AzureNative                              1.98.1
Pulumi.Confluent                                0.2.2
Pulumi.Kafka                                    3.4.0
Pulumi.Kubernetes                               3.24.2
System.IO.Abstractions                          19.2.4

Additional context

No response

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).

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 38 (16 by maintainers)

Most upvoted comments

I’ve solved my previous issue, and like you all suspected it’s a different issue - turns out it was bad spacing in my generated cluster kubeconfig.yaml 🤦‍♂️ I guess it was deemed invalid and Helm provider set the version to some default of 1.20.0

@Phil1972 Sorry, I reread the entire thread and it looks like I closed this in error while I was triaging issues the other day. I saw https://github.com/pulumi/pulumi-kubernetes/issues/2345#issuecomment-1513860912 and assumed it was fixed.

OK, unless I’m wrong, I think we got a lead 😉 The PR for Dotnet (https://github.com/pulumi/pulumi-kubernetes/pull/2005) has been done in a second time after the other SDKs (https://github.com/pulumi/pulumi-kubernetes/pull/1919), and it seems to me that the implementation is not exactly the same.

Using the ‘Providers’ (with an S) allows to pass a list of providers. (Not sure how I can pass a map). I tried using that one passing a list of my sole provider but it did not work either.

In Go, there’s a ProviderMap option (https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/pulumi#ProviderMap), but that’s the same than Providers behind the scene (in fact, I think I should use the latest).

Again, I’m not familiar with C#, but your code seems really similar to what we do in Go, which is working for us. I’m wondering if this line isn’t missing the Parent option: https://github.com/pulumi/pulumi-kubernetes/blob/58b8c44ae79eb5e19f96641396e1c7826262b2a8/sdk/dotnet/Helm/V3/Chart.cs#L363 In the Go SDK, all the resource options which are also invoke options (which is the case of the Parent option) are passed: https://github.com/pulumi/pulumi-kubernetes/blob/58b8c44ae79eb5e19f96641396e1c7826262b2a8/sdk/go/kubernetes/helm/v3/chart.go#L247-L268 Maybe @lblackstone or another maintainer can confirm or inform what I’m supposing?