go-helm-client icon indicating copy to clipboard operation
go-helm-client copied to clipboard

Can not deploy simple nginx-helm chart

Open jasric89 opened this issue 8 months ago • 4 comments

I'm trying to deploy the ingress-nginx helm chart with no customizations, and I keep getting context deadline exceeded.

I can deploy this with helm install absolutely fine.

My code snippet:

	// Builds Helm Chart Client ////
	fmt.Println("Building Helm Client\n")
	opt := &helmclient.Options{
		Namespace:        "default", // Change this to the namespace you wish the client to operate in.
		RepositoryCache:  "/tmp/.helmcache",
		RepositoryConfig: "/tmp/.helmrepo",
		Debug:            false,
		Linting:          true,
		DebugLog:         func(format string, v ...interface{}) {},
		Output:           &outputBuffer, // Not mandatory, leave open for default os.Stdout
	}

	myHelmClient, err := helmclient.New(opt)
	if err != nil {
		panic(err)
	}

	/////////////////////////////////////////////////////////////////////////////////////////////////////
	//// Now use Helmchart client to create external-secrets chart repo //////
	fmt.Println("Deploying nginx-ingress\n")
	nginxchartRepo := repo.Entry{
		Name:               "ingress-nginx",
		URL:                "https://kubernetes.github.io/ingress-nginx",
		PassCredentialsAll: true,
	}

	if err := myHelmClient.AddOrUpdateChartRepo(nginxchartRepo); err != nil {
		log.Fatal(err)
	} else {
		fmt.Printf("Added Chart Repo %s\n", nginxchartRepo.Name)
	}

	// Now Run Update Chart Repos
	if err := myHelmClient.UpdateChartRepos(); err != nil {
		log.Fatal(err)
	} else {
		fmt.Printf("Updating Chart Repo\n")
	}

	///////////////////////////////////////////////////////////////////////////////////////////////////////
	// Now install the chart from the repo thats just been created./////////////////////
	nginxchartSpec := helmclient.ChartSpec{
		ReleaseName:     "nginx-ingress",
		ChartName:       "ingress-nginx/ingress-nginx",
		Namespace:       "nginx-ingress",
		CreateNamespace: true,
		SkipCRDs:        false,
		Wait:            true,
		//ValuesOptions: values.Options{
		//	ValueFiles: []string{"nginxvalues.yaml"},
		//},
	}
	nginxInstalledHelmChart, err := myHelmClient.InstallChart(ctx, &nginxchartSpec, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Status of Chart Install %v,\n", *nginxInstalledHelmChart.Info)
	```

jasric89 avatar May 30 '24 10:05 jasric89