https://pulumi.com logo
#kubernetes
Title
# kubernetes
s

swift-musician-28019

10/31/2023, 5:26 PM
Hi all, I have a case where I have a helm chart that uses a default values.yaml and a environment specific values.yaml. Based on the Helm Release documentation (https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/release/#valueyamlfiles_csharp) and this feature request (https://github.com/pulumi/pulumi-kubernetes/issues/659) I thought it is possible to use
ValueYamlFiles
to add these files like this:
Copy code
ValueYamlFiles= new InputList<AssetOrArchive>
{
    new FileAsset($"{appValuesPath}/values.yaml"),
    new FileAsset($"{appValuesPath}/values.{projectEnvironment}.yaml")
}
Somehow only the last specified values.yaml is read and used for the Helm Release. Has anyone encountered a similar issue or has an idea how to solve this?
s

steep-toddler-94095

11/01/2023, 4:17 AM
are you able to add your yaml files here?
s

swift-musician-28019

11/01/2023, 12:24 PM
Sure, I'll remove some private values but the behaviour is the same. Here the default `values.yaml`:
Copy code
image:
  repository: some-repository

envVariables:
  DOTNET_ENVIRONMENT: Staging
  Kestrel__Endpoints__Http__Protocols: Http1AndHttp2

envSecrets:
  ConnectionStrings: ...

ports:
  - name: http
    port: 80
  - name: https
    port: 443
  - name: grpc
    port: 5002
Here the environment specific `values.dev.yaml`:
Copy code
envVariables:
  App__SelfUrl: <https://some.dev.domain.com/>
  Kestrel__Endpoints__Http__Url: <http://some.dev.domain.com/>
After some further tests I now found out this is a problem when you use the same key in both files (in this case
envVariables
). My test suggest that if you use different keys the two files successfully get merged and a combination of both get's used for the Values in the Helm Release.
s

steep-toddler-94095

11/01/2023, 4:22 PM
Sounds like the merge function does a shallow merge rather than a deep merge. Maybe you can create a github issue for an enhancement of one doesn’t always exist? And in the meantime you could work around this by merging the yaml yourself with C# code and passing in the values rather than using ValueYamlFiles
s

swift-musician-28019

11/02/2023, 12:58 PM
I decided to merge the yaml files in c# and then and passing it in the
Values
. Thanks for your assistance!
d

damp-airline-38442

11/09/2023, 8:29 PM
Could one of you file a bug into pulumi-kubernetes for this (the shallow vs deep merge)?