knuu
knuu copied to clipboard
Use namespace from context as default kubernetes namespace
Currently, the namespace is test if not specified otherwise, using the KNUU_NAMESPACE environment variable.
See here in the code:
https://github.com/celestiaorg/knuu/blob/main/pkg/k8s/k8s.go#L43
Instead of using test as default, it knuu should use the namespace selected in the kubeconfig if the environment variable KNUU_NAMESPACE is not set.
Hey @smuu , changing the L41-48
else {
// Read the namespace from KNUU_NAMESPACE environment variable
if os.Getenv("KNUU_NAMESPACE") != "" {
setNamespace(os.Getenv("KNUU_NAMESPACE"))
} else {
setNamespace("test")
}
}
with
else {
// Read the namespace from the kubeconfig file
namespace, err := clientcmd.NewDefaultClientConfigLoadingRules().Namespace()
if err != nil {
return fmt.Errorf("retrieving namespace from kubeconfig: %w", err)
} else{
setNamespace(namespace)
}
}
will resolve the issue . Please confirm this.
We have scopes now