Re: How to override the default helm chart values in values.yaml using hapi?
Note that I did not use helm client, instead, I use gRPC API to communicate with tiller server directly.
I just reviewed the source code of helm client. It just configures the InstallReleaseRequest.Values with the overrides values. I followed the same logic, so I just updated InstallReleaseRequest.Values with the override values directly. The new source code is something as below, but it did not work either. The helm chart can be created successfully, but the POD still uses the default values defined in values.yaml in the chart instead of the override values. Can someone help to point out what’s the reason?
func deploy(tillerEndpoint, helmChartDir, helmChartName string, overrideValues map[string]interface{}) error {
conn, err := grpc.Dial(tillerEndpoint, grpc.WithInsecure())
defer conn.Close()
tillerClient := services.NewReleaseServiceClient(conn)
helmChart, err := chartutil.Load(helmChartDir)
cc := chart.Config{ Raw: helmChart.Values.Raw }
If overrideValues != nil {
vals, err := chartutil.Values(overrideValues).YAML()
cc = chart.Config{Raw: vals }
}
req := &services.InstallReleaseRequest{
Chart: helmChart,
Values: &cc,
Name: helmChartName,
Namespace: "default",
DryRun: false,
DisableHooks: true,
}
err = chartutil.ProcessRequirementsEnabled(req.Chart, req.Values)
err = chartutil.ProcessRequirementsImportValues(req.Chart)
_, err = tillerClient.InstallRelease(helm.NewContext(), req)
return err
}