Skip to content

Commit

Permalink
fix: add default namespace if namespace is empty
Browse files Browse the repository at this point in the history
Signed-off-by: PoAn Yang <[email protected]>
  • Loading branch information
FrankYang0529 committed Jul 10, 2024
1 parent 2e47df3 commit 7fa600b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cloud-controller-manager/ccm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/rancher/wrangler/pkg/kubeconfig"
"github.com/rancher/wrangler/pkg/signals"
"github.com/rancher/wrangler/pkg/start"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/tools/clientcmd"
cloudprovider "k8s.io/cloud-provider"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -69,6 +70,9 @@ func newCloudProvider(reader io.Reader) (cloudprovider.Interface, error) {
}

namespace := rawConfig.Contexts[rawConfig.CurrentContext].Namespace
if namespace == "" {
namespace = corev1.NamespaceDefault
}

localCfg, err := kubeconfig.GetNonInteractiveClientConfig(os.Getenv("KUBECONFIG")).ClientConfig()
if err != nil {
Expand Down

0 comments on commit 7fa600b

Please sign in to comment.