-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow overriding k8s namespace #193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 🙇 One remark :)
go-chaos/internal/k8helper.go
Outdated
//// based on https://github.com/kubernetes/client-go/blob/master/examples/out-of-cluster-client-configuration/main.go | ||
var kubeconfig *string | ||
if home := homedir.HomeDir(); home != "" { | ||
kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file") | ||
} else { | ||
kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file") | ||
} | ||
namespace := flag.String("namespace", "", "Kubernetes namespace to use") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ This is a bit hidden. I would like to use a presistent flag https://stackoverflow.com/a/63498490/2165134 as we do with verbose here https://github.com/zeebe-io/zeebe-chaos/blob/main/go-chaos/cmd/root.go#L53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I tried first but that introduced a circular dependency from cmd -> internal -> cmd again. I guess that's why the kubeconfig parameter is also defined here and not in cmd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well what you need to do is then to set a internal property like we do for verbosity see here https://github.com/zeebe-io/zeebe-chaos/blob/main/go-chaos/cmd/root.go#L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, neat 👍 Do you remember if there was a reason to not do the same for the kubeconfig param?
8f18d68
to
0106a02
Compare
internal.Namespace = Namespace | ||
internal.KubeConfigPath = KubeConfigPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need also some defaults ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default for the config path is set here: https://github.com/zeebe-io/zeebe-chaos/pull/193/files#diff-464316c02acb79ad2acc14ad37881cf54b046e8f496271a18a68502f674944b0R79-R88
works thanks @oleschoenburg 🚀
|
This adds a flag similar to
kubeconfig
to override the namespace that will be used by the k8s client.Depends on #192