🔥 Remove the -A flag and allnamespaces field from config.yaml

This commit is contained in:
M. Mert Yildiran
2023-04-19 20:52:28 +03:00
parent 90e6e99386
commit 686dd5fba1
6 changed files with 4 additions and 23 deletions

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/url"
@@ -111,14 +110,6 @@ func NewProviderInCluster() (*Provider, error) {
}, nil
}
func (provider *Provider) CurrentNamespace() (string, error) {
if provider.kubernetesConfig == nil {
return "", errors.New("kubernetesConfig is nil, The CLI will not work with in-cluster kubernetes config, use a kubeconfig file when initializing the Provider")
}
ns, _, err := provider.kubernetesConfig.Namespace()
return ns, err
}
func (provider *Provider) WaitUtilNamespaceDeleted(ctx context.Context, name string) error {
fieldSelector := fmt.Sprintf("metadata.name=%s", name)
var limit int64 = 1
@@ -1133,16 +1124,10 @@ func (provider *Provider) GetKubernetesVersion() (*semver.SemVersion, error) {
}
func (provider *Provider) GetNamespaces() []string {
if config.Config.Tap.AllNamespaces {
return []string{K8sAllNamespaces}
} else if len(config.Config.Tap.Namespaces) > 0 {
if len(config.Config.Tap.Namespaces) > 0 {
return utils.Unique(config.Config.Tap.Namespaces)
} else {
currentNamespace, err := provider.CurrentNamespace()
if err != nil {
log.Fatal().Err(err).Msg("Error getting current namespace!")
}
return []string{currentNamespace}
return []string{K8sAllNamespaces}
}
}