How to override the default helm chart values in values.yaml using hapi?


benjamin <benjamin_wang@...>
 

I use the following code (golang) to deploy helm chart into kubernetes. I removed the error handling code for simplicity. 

The last parameter "values" is used to override the values of some fields defined in values.yaml . But after the chart is created, the values used by the POD are still the default values defined in values.yaml in the chart instead of the values included in the last parameter of the following function. What did I miss? Thanks!

func deploy(tillerEndpoint, helmChartDir, helmChartName string, values map[string]*chart.Value) 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,
Values: values,
}
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
}

Join cncf-helm@lists.cncf.io to automatically receive all group messages.