mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-25 07:45:01 +00:00
🔥 Remove the -A
flag and allnamespaces
field from config.yaml
This commit is contained in:
parent
90e6e99386
commit
686dd5fba1
@ -128,7 +128,7 @@ var hubPodMappings = map[string]interface{}{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "NAMESPACES",
|
"name": "NAMESPACES",
|
||||||
"value": "{{ .Values.tap.allnamespaces | ternary \"\" .Values.tap.namespaces }}",
|
"value": "{{ gt (len .Values.tap.namespaces) 0 | ternary (join \",\" .Values.tap.namespaces) \"\" }}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "STORAGE_LIMIT",
|
"name": "STORAGE_LIMIT",
|
||||||
|
@ -51,7 +51,6 @@ func init() {
|
|||||||
tapCmd.Flags().Uint16(configStructs.ProxyHubPortLabel, defaultTapConfig.Proxy.Hub.SrcPort, "Provide a custom port for the Hub proxy/port-forward")
|
tapCmd.Flags().Uint16(configStructs.ProxyHubPortLabel, defaultTapConfig.Proxy.Hub.SrcPort, "Provide a custom port for the Hub proxy/port-forward")
|
||||||
tapCmd.Flags().String(configStructs.ProxyHostLabel, defaultTapConfig.Proxy.Host, "Provide a custom host for the proxy/port-forward")
|
tapCmd.Flags().String(configStructs.ProxyHostLabel, defaultTapConfig.Proxy.Host, "Provide a custom host for the proxy/port-forward")
|
||||||
tapCmd.Flags().StringSliceP(configStructs.NamespacesLabel, "n", defaultTapConfig.Namespaces, "Namespaces selector")
|
tapCmd.Flags().StringSliceP(configStructs.NamespacesLabel, "n", defaultTapConfig.Namespaces, "Namespaces selector")
|
||||||
tapCmd.Flags().BoolP(configStructs.AllNamespacesLabel, "A", defaultTapConfig.AllNamespaces, "Tap all namespaces")
|
|
||||||
tapCmd.Flags().StringP(configStructs.SelfNamespaceLabel, "s", defaultTapConfig.SelfNamespace, "Self-namespace of Kubeshark")
|
tapCmd.Flags().StringP(configStructs.SelfNamespaceLabel, "s", defaultTapConfig.SelfNamespace, "Self-namespace of Kubeshark")
|
||||||
tapCmd.Flags().String(configStructs.StorageLimitLabel, defaultTapConfig.StorageLimit, "Override the default storage limit. (per node)")
|
tapCmd.Flags().String(configStructs.StorageLimitLabel, defaultTapConfig.StorageLimit, "Override the default storage limit. (per node)")
|
||||||
tapCmd.Flags().Bool(configStructs.DryRunLabel, defaultTapConfig.DryRun, "Preview of all pods matching the regex, without tapping them")
|
tapCmd.Flags().Bool(configStructs.DryRunLabel, defaultTapConfig.DryRun, "Preview of all pods matching the regex, without tapping them")
|
||||||
|
@ -18,7 +18,6 @@ const (
|
|||||||
ProxyHubPortLabel = "proxy-hub-port"
|
ProxyHubPortLabel = "proxy-hub-port"
|
||||||
ProxyHostLabel = "proxy-host"
|
ProxyHostLabel = "proxy-host"
|
||||||
NamespacesLabel = "namespaces"
|
NamespacesLabel = "namespaces"
|
||||||
AllNamespacesLabel = "allnamespaces"
|
|
||||||
SelfNamespaceLabel = "selfnamespace"
|
SelfNamespaceLabel = "selfnamespace"
|
||||||
StorageLimitLabel = "storagelimit"
|
StorageLimitLabel = "storagelimit"
|
||||||
DryRunLabel = "dryrun"
|
DryRunLabel = "dryrun"
|
||||||
@ -83,7 +82,6 @@ type TapConfig struct {
|
|||||||
Proxy ProxyConfig `yaml:"proxy"`
|
Proxy ProxyConfig `yaml:"proxy"`
|
||||||
PodRegexStr string `yaml:"regex" default:".*"`
|
PodRegexStr string `yaml:"regex" default:".*"`
|
||||||
Namespaces []string `yaml:"namespaces"`
|
Namespaces []string `yaml:"namespaces"`
|
||||||
AllNamespaces bool `yaml:"allnamespaces" default:"true"`
|
|
||||||
SelfNamespace string `yaml:"selfnamespace" default:"kubeshark"`
|
SelfNamespace string `yaml:"selfnamespace" default:"kubeshark"`
|
||||||
StorageLimit string `yaml:"storagelimit" default:"200MB"`
|
StorageLimit string `yaml:"storagelimit" default:"200MB"`
|
||||||
DryRun bool `yaml:"dryrun" default:"false"`
|
DryRun bool `yaml:"dryrun" default:"false"`
|
||||||
|
@ -18,7 +18,7 @@ spec:
|
|||||||
- name: POD_REGEX
|
- name: POD_REGEX
|
||||||
value: '{{ .Values.tap.regex }}'
|
value: '{{ .Values.tap.regex }}'
|
||||||
- name: NAMESPACES
|
- name: NAMESPACES
|
||||||
value: '{{ .Values.tap.allnamespaces | ternary "" .Values.tap.namespaces }}'
|
value: '{{ gt (len .Values.tap.namespaces) 0 | ternary (join "," .Values.tap.namespaces) "" }}'
|
||||||
- name: STORAGE_LIMIT
|
- name: STORAGE_LIMIT
|
||||||
value: '{{ .Values.tap.storagelimit }}'
|
value: '{{ .Values.tap.storagelimit }}'
|
||||||
- name: LICENSE
|
- name: LICENSE
|
||||||
|
@ -17,7 +17,6 @@ tap:
|
|||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
regex: .*
|
regex: .*
|
||||||
namespaces: []
|
namespaces: []
|
||||||
allnamespaces: true
|
|
||||||
selfnamespace: kubeshark
|
selfnamespace: kubeshark
|
||||||
storagelimit: 200MB
|
storagelimit: 200MB
|
||||||
dryrun: false
|
dryrun: false
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -111,14 +110,6 @@ func NewProviderInCluster() (*Provider, error) {
|
|||||||
}, nil
|
}, 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 {
|
func (provider *Provider) WaitUtilNamespaceDeleted(ctx context.Context, name string) error {
|
||||||
fieldSelector := fmt.Sprintf("metadata.name=%s", name)
|
fieldSelector := fmt.Sprintf("metadata.name=%s", name)
|
||||||
var limit int64 = 1
|
var limit int64 = 1
|
||||||
@ -1133,16 +1124,10 @@ func (provider *Provider) GetKubernetesVersion() (*semver.SemVersion, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (provider *Provider) GetNamespaces() []string {
|
func (provider *Provider) GetNamespaces() []string {
|
||||||
if config.Config.Tap.AllNamespaces {
|
if len(config.Config.Tap.Namespaces) > 0 {
|
||||||
return []string{K8sAllNamespaces}
|
|
||||||
} else if len(config.Config.Tap.Namespaces) > 0 {
|
|
||||||
return utils.Unique(config.Config.Tap.Namespaces)
|
return utils.Unique(config.Config.Tap.Namespaces)
|
||||||
} else {
|
} else {
|
||||||
currentNamespace, err := provider.CurrentNamespace()
|
return []string{K8sAllNamespaces}
|
||||||
if err != nil {
|
|
||||||
log.Fatal().Err(err).Msg("Error getting current namespace!")
|
|
||||||
}
|
|
||||||
return []string{currentNamespace}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user