英文:
How to set null config values in helm charts via pulumi
问题
我正在尝试通过 pulumi 和 golang 配置一个 Helm Chart。根据 Helm Chart 文档,可以通过将配置设置为 null
来移除默认组件。我成功在我的 pulumi 脚本中设置了 Helm Chart 的所需配置值,但是无法将配置值设置为 null
。
更新:
似乎在 pulumi helm chart 资源的自定义抽象层上无法处理配置。我添加了一个最小工作示例,直接使用 helm chart 资源,并且按预期工作:
package main
import (
helmv3 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := helmv3.NewChart(ctx, "otel-collect", helmv3.ChartArgs{
Chart: pulumi.String("opentelemetry-collector"),
Version: pulumi.String("0.31.1"),
FetchArgs: helmv3.FetchArgs{
Repo: pulumi.String("https://open-telemetry.github.io/opentelemetry-helm-charts"),
},
Values: pulumi.Map{
"fullnameOverride": pulumi.String("otel-collector"),
"mode": pulumi.String("deployment"),
"config": pulumi.Map{
"receivers": pulumi.Map{
"jaeger": pulumi.Map{
"protocols": pulumi.Map{
"thrift_compact": nil,
},
},
"prometheus": nil,
},
"service": pulumi.Map{
"pipelines": pulumi.Map{
"metrics": nil,
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
在这种情况下,我想将 prometheus
配置设置为 null
,但是当部署此 chart 时,prometheus
的默认值被设置。我还尝试过 "prometheus": pulumi.Any(nil),
,但这也不会更改配置。
英文:
I'm trying to configure a helm chart via pulumi and golang. According to the helm chart documentation default components can be removed by setting the config to null
. I managed to set the desired config values for the helm chart in my pulumi script, but it's not possible to set config values to null
.
Update:
It seems that the custom abstraction layer on top of the pulumi helm chart resource could not handle the config. I have added a minimal working example which uses the helm chart resource directly and its working as expected:
package main
import (
helmv3 "github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes/helm/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := helmv3.NewChart(ctx, "otel-collect", helmv3.ChartArgs{
Chart: pulumi.String("opentelemetry-collector"),
Version: pulumi.String("0.31.1"),
FetchArgs: helmv3.FetchArgs{
Repo: pulumi.String("https://open-telemetry.github.io/opentelemetry-helm-charts"),
},
Values: pulumi.Map{
"fullnameOverride": pulumi.String("otel-collector"),
"mode": pulumi.String("deployment"),
"config": pulumi.Map{
"receivers": pulumi.Map{
"jaeger": pulumi.Map{
"protocols": pulumi.Map{
"thrift_compact": nil,
},
},
"prometheus": nil,
},
"service": pulumi.Map{
"pipelines": pulumi.Map{
"metrics": nil,
},
},
},
},
})
if err != nil {
return err
}
return nil
})
}
In this scenario I want to set the prometheus
config to null
but when this chart is deployed the default values for prometheus
are set. I have also tried "prometheus": pulumi.Any(nil),
but this also does not change the config.
答案1
得分: 1
这个问题是由我在pulumi helm资源之上添加的一个抽象层引起的。
英文:
The issue was caused by an abstraction layer I put on top of the pulumi helm resources.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论