Comments (5)
You haven't created a helmclient.Options
object. Since it is a pointer a dereference to read its values will fail. Start with a full example and remove parts that you do not need. https://pkg.go.dev/github.com/mittwald/[email protected]#example-NewClientFromKubeConf
This is how I use it:
// Either provide path or read from default location
if path == "" {
homeDir, err := os.UserHomeDir()
if err != nil {
return errors.Wrap(err, "GetClientWithKubeConf: cannot read user home dir")
}
path = homeDir + "/.kube/config"
}
kubeConfig, err := os.ReadFile(path)
if err != nil {
return errors.Wrapf(err, "GetClientWithKubeConf cannot read kubeConfig from path %s:%v", path, err)
}
opt := &helmclient.KubeConfClientOptions{
Options: &helmclient.Options{
Namespace: h.ChartSpec.Namespace, // Change this to the namespace you wish to install the chart in.
RepositoryCache: "/tmp/.helmcache",
RepositoryConfig: "/tmp/.helmrepo",
Debug: true,
Linting: false, // Change this to false if you don't want linting.
DebugLog: klog.Infof,
},
KubeContext: kubeContext,
KubeConfig: kubeConfig,
}
h.HelmClient, err = helmclient.NewClientFromKubeConf(opt)
if err != nil {
return errors.Wrap(err, "GetClientWithKubeConf cannot create client from kubeConfig")
}
return nil
from go-helm-client.
Add this to your imports:
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" // register GCP auth provider
from go-helm-client.
Great, thank you very much!
from go-helm-client.
@zvonkok That did the trick, thank you 👍
Now I'm running into the next error that I don't know how to solve:
panic: Kubernetes cluster unreachable: no Auth Provider found for name "gcp"
Is there any chance you have a solution for that as well?
from go-helm-client.
I think error handling messages could be slightly improved: Similar to how a readable error is thrown when KubeConfig is not passed, the same could be donw for Options. Or simply use a reasonable default instead of the current error that is hard to interpret.
from go-helm-client.
Related Issues (20)
- Options.Namespace takes priority over ChartSpec.Namespace HOT 5
- Is upgrading a release installed from local chart files supported? HOT 1
- How to get the helm chart revision number using helm-client v0.11.3
- How to use helm -f and set at the same time
- KubeContext in KubeConfClientOptions not working
- Accept target version in `Rollback` HOT 1
- go get 404 Not Found
- Error: "cannot re-use a name that is still in use" HOT 3
- Namespace "" is invalid: metadata.name: Required value: name or generateName is required
- Why can't I specify a namespace when uninstalling a chart? HOT 1
- how to pass global values?
- bug: AddOrChartRepo, downloads index file, everytime it is being called
- just want to ask a question ? HOT 1
- Add support for IgnoreNotFound in ChartSpec HOT 2
- Support configuration of chartPathOptions in install/upgrade client interfaces HOT 2
- feature request: support labels when installing/listing releases
- Watch for release events?
- json: unsupported type: action.DebugLog getter.Constructor when creating helm client via kubeconfig
- feat: Add support for running tests for a release HOT 1
- Kubernetes 0.29.0 update throws error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-helm-client.