Im using the helm SDK and it works great, for my testing using the fake option which works(for kubeconfig),
Now when I update the kubeconfig to my cluster I notice that during installation the chart is stuck on status pending,
and it stuck forever in this state until I'm deleting & installing it again,(manually)
My question is how to solve this issue with the
Helm SDK (via code only) https://pkg.go.dev/helm.sh/helm/v3,
I mean wait for a while and if the status is pending after 3 min delete and reinstall it again... or try upgrade before
This is the code
kubeConfigPath, err := findKubeConfig()
if err != nil {
fmt.Println()
}
actionConfig := &action.Configuration{
}
cfg := cli.New()
clientGetter := genericclioptions.NewConfigFlags(false)
clientGetter.KubeConfig = &kubeConfigPath
actionConfig.Init(clientGetter, "def", "memory", log.Printf)
if err != nil {
fmt.Println(err)
}
chart, err := installation.InstallChart(cfg, "test", "chart1", "./charts/dns", nil, actionConfig)
if err != nil {
fmt.Println(err)
}
fmt.Println(chart)
}
func findKubeConfig() (string, error) {
env := os.Getenv("KUBECONFIG")
if env != "" {
return env, nil
}
path, err := homedir.Expand("~/.kube/config")
if err != nil {
return "", err
}
return path, nil
}