diff --git a/cmd/beekeeper/cmd/check.go b/cmd/beekeeper/cmd/check.go index a0a8a6a34..56855e9ce 100644 --- a/cmd/beekeeper/cmd/check.go +++ b/cmd/beekeeper/cmd/check.go @@ -53,13 +53,13 @@ func (c *command) initCheckCmd() (err error) { ) if metricsEnabled { - metricsPusher, cleanup = newMetricsPusher(c.globalConfig.GetString(optionNameMetricsPusherAddress), cfgCluster.GetNamespace(), c.logger) + metricsPusher, cleanup = newMetricsPusher(c.globalConfig.GetString(optionNameMetricsPusherAddress), cfgCluster.GetNamespace(), c.log) // cleanup executes when the calling context terminates defer cleanup() } // logger metrics - if l, ok := c.logger.(metrics.Reporter); ok && metricsEnabled { + if l, ok := c.log.(metrics.Reporter); ok && metricsEnabled { metrics.RegisterCollectors(metricsPusher, l.Report()...) } @@ -105,7 +105,7 @@ func (c *command) initCheckCmd() (err error) { } // create check - chk := check.NewAction(c.logger) + chk := check.NewAction(c.log) if r, ok := chk.(metrics.Reporter); ok && metricsEnabled { metrics.RegisterCollectors(metricsPusher, r.Report()...) } @@ -116,7 +116,7 @@ func (c *command) initCheckCmd() (err error) { defer cancel() } - c.logger.Infof("running check: %s", checkName) + c.log.Infof("running check: %s", checkName) ch := make(chan error, 1) go func() { @@ -135,7 +135,7 @@ func (c *command) initCheckCmd() (err error) { if err != nil { return fmt.Errorf("running check %s: %w", checkName, err) } - c.logger.Infof("%s check completed successfully", checkName) + c.log.Infof("%s check completed successfully", checkName) } } return nil diff --git a/cmd/beekeeper/cmd/cluster.go b/cmd/beekeeper/cmd/cluster.go index 44dbab24f..47e31f235 100644 --- a/cmd/beekeeper/cmd/cluster.go +++ b/cmd/beekeeper/cmd/cluster.go @@ -20,11 +20,11 @@ func (c *command) deleteCluster(ctx context.Context, clusterName string, cfg *co clusterOptions.K8SClient = c.k8sClient clusterOptions.SwapClient = c.swapClient - cluster := orchestrationK8S.NewCluster(clusterConfig.GetName(), clusterOptions, c.logger) + cluster := orchestrationK8S.NewCluster(clusterConfig.GetName(), clusterOptions, c.log) // delete node groups for ng, v := range clusterConfig.GetNodeGroups() { - c.logger.Infof("deleting %s node group", ng) + c.log.Infof("deleting %s node group", ng) ngConfig, ok := cfg.NodeGroups[v.Config] if !ok { return fmt.Errorf("node group profile %s not defined", v.Config) @@ -114,7 +114,7 @@ func (c *command) setupCluster(ctx context.Context, clusterName string, cfg *con clusterOptions.K8SClient = c.k8sClient clusterOptions.SwapClient = c.swapClient - cluster = orchestrationK8S.NewCluster(clusterConfig.GetName(), clusterOptions, c.logger) + cluster = orchestrationK8S.NewCluster(clusterConfig.GetName(), clusterOptions, c.log) bootnodes := "" errGroup := new(errgroup.Group) diff --git a/cmd/beekeeper/cmd/cmd.go b/cmd/beekeeper/cmd/cmd.go index 38dd3d575..3bebd9b96 100644 --- a/cmd/beekeeper/cmd/cmd.go +++ b/cmd/beekeeper/cmd/cmd.go @@ -54,8 +54,8 @@ type command struct { k8sClient *k8s.Client // swap client swapClient swap.Client - // logger - logger logging.Logger + // log + log logging.Logger } type option func(*command) @@ -194,11 +194,11 @@ func (c *command) initConfig() (err error) { // init logger verbosity := c.globalConfig.GetString(optionNameLogVerbosity) lokiEndpoint := c.globalConfig.GetString(optionNameLokiEndpoint) - c.logger, err = newLogger(c.root, verbosity, lokiEndpoint) + c.log, err = newLogger(c.root, verbosity, lokiEndpoint) if err != nil { return fmt.Errorf("new logger: %w", err) } - c.logger.Infof("verbosity log level: %v", c.logger.GetLevel()) + c.log.Infof("verbosity log level: %v", c.log.GetLevel()) if c.globalConfig.GetString(optionNameConfigGitRepo) != "" { // read configuration from git repo @@ -241,7 +241,7 @@ func (c *command) initConfig() (err error) { }) } - if c.config, err = config.Read(c.logger, yamlFiles); err != nil { + if c.config, err = config.Read(c.log, yamlFiles); err != nil { return err } } else { @@ -268,7 +268,7 @@ func (c *command) initConfig() (err error) { }) } - if c.config, err = config.Read(c.logger, yamlFiles); err != nil { + if c.config, err = config.Read(c.log, yamlFiles); err != nil { return err } } @@ -310,7 +310,7 @@ func (c *command) setK8S() (err error) { inCluster := c.globalConfig.GetBool("in-cluster") kubeconfigPath := c.globalConfig.GetString("kubeconfig") - if c.k8sClient, err = k8s.NewClient(k8s.WithLogger(c.logger), k8s.WithInCluster(inCluster), k8s.WithKubeconfigPath(kubeconfigPath)); err != nil && err != k8s.ErrKubeconfigNotSet { + if c.k8sClient, err = k8s.NewClient(k8s.WithLogger(c.log), k8s.WithInCluster(inCluster), k8s.WithKubeconfigPath(kubeconfigPath)); err != nil && err != k8s.ErrKubeconfigNotSet { return fmt.Errorf("creating Kubernetes client: %w", err) } } @@ -328,7 +328,7 @@ func (c *command) setSwapClient() (err error) { c.swapClient = swap.NewGethClient(gethUrl, &swap.GethClientOptions{ BzzTokenAddress: c.globalConfig.GetString("bzz-token-address"), EthAccount: c.globalConfig.GetString("eth-account"), - }, c.logger) + }, c.log) } else { c.swapClient = &swap.NotSet{} } diff --git a/cmd/beekeeper/cmd/create_bee_cluster.go b/cmd/beekeeper/cmd/create_bee_cluster.go index e3f48bdf1..39c24252b 100644 --- a/cmd/beekeeper/cmd/create_bee_cluster.go +++ b/cmd/beekeeper/cmd/create_bee_cluster.go @@ -22,7 +22,7 @@ func (c *command) initCreateBeeCluster() *cobra.Command { defer cancel() start := time.Now() _, err = c.setupCluster(ctx, c.globalConfig.GetString(optionNameClusterName), c.config, true) - c.logger.Infof("cluster setup took %s", time.Since(start)) + c.log.Infof("cluster setup took %s", time.Since(start)) return err }, PreRunE: c.preRunE, diff --git a/cmd/beekeeper/cmd/create_k8s_namespace.go b/cmd/beekeeper/cmd/create_k8s_namespace.go index e60aca9d0..3a8dd0805 100644 --- a/cmd/beekeeper/cmd/create_k8s_namespace.go +++ b/cmd/beekeeper/cmd/create_k8s_namespace.go @@ -24,7 +24,7 @@ func (c *command) initCreateK8SNamespace() *cobra.Command { return fmt.Errorf("create namespace %s: %w", name, err) } - c.logger.Infof("namespace %s created", name) + c.log.Infof("namespace %s created", name) return }, PreRunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/beekeeper/cmd/delete_k8s_namespace.go b/cmd/beekeeper/cmd/delete_k8s_namespace.go index 4f1eda177..eb7c45c76 100644 --- a/cmd/beekeeper/cmd/delete_k8s_namespace.go +++ b/cmd/beekeeper/cmd/delete_k8s_namespace.go @@ -24,7 +24,7 @@ func (c *command) initDeleteK8SNamespace() *cobra.Command { return fmt.Errorf("delete namespace %s: %w", name, err) } - c.logger.Infof("namespace %s deleted", name) + c.log.Infof("namespace %s deleted", name) return }, PreRunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/beekeeper/cmd/fund.go b/cmd/beekeeper/cmd/fund.go index 6649407c5..21dc1f844 100644 --- a/cmd/beekeeper/cmd/fund.go +++ b/cmd/beekeeper/cmd/fund.go @@ -55,7 +55,7 @@ beekeeper fund --address-create --address-count 2 --bzz-deposit 100.0 --eth-depo if err != nil { return fmt.Errorf("marshaling Swarm keys: %w", err) } - c.logger.Infof("%s", k) + c.log.Infof("%s", k) } } else if len(c.globalConfig.GetStringSlice(optionNameAddresses)) < 1 { return fmt.Errorf("bee node Ethereum addresses not provided") @@ -68,7 +68,7 @@ beekeeper fund --address-create --address-count 2 --bzz-deposit 100.0 --eth-depo for _, a := range addresses { if c.globalConfig.GetBool(optionNamePrintAddresses) { - c.logger.Infof("address: %s", a) + c.log.Infof("address: %s", a) } // ETH funding ethDeposit := c.globalConfig.GetFloat64(optionNameEthDeposit) @@ -77,7 +77,7 @@ beekeeper fund --address-create --address-count 2 --bzz-deposit 100.0 --eth-depo if err != nil { return fmt.Errorf("send eth: %w", err) } - c.logger.Infof("%s funded with %.2f ETH, transaction: %s\n", a, ethDeposit, tx) + c.log.Infof("%s funded with %.2f ETH, transaction: %s\n", a, ethDeposit, tx) } // BZZ funding bzzDeposit := c.globalConfig.GetFloat64(optionNameBzzDeposit) @@ -86,7 +86,7 @@ beekeeper fund --address-create --address-count 2 --bzz-deposit 100.0 --eth-depo if err != nil { return fmt.Errorf("deposit bzz: %w", err) } - c.logger.Infof("%s funded with %.2f BZZ, transaction: %s\n", a, bzzDeposit, tx) + c.log.Infof("%s funded with %.2f BZZ, transaction: %s\n", a, bzzDeposit, tx) } // gBZZ funding gBzzDeposit := c.globalConfig.GetFloat64(optionNameGBzzDeposit) @@ -95,7 +95,7 @@ beekeeper fund --address-create --address-count 2 --bzz-deposit 100.0 --eth-depo if err != nil { return fmt.Errorf("deposit gBzz: %w", err) } - c.logger.Infof("%s funded with %.2f gBZZ, transaction: %s\n", a, gBzzDeposit, tx) + c.log.Infof("%s funded with %.2f gBZZ, transaction: %s\n", a, gBzzDeposit, tx) } } diff --git a/cmd/beekeeper/cmd/node_funder.go b/cmd/beekeeper/cmd/node_funder.go index 3e47e2e5e..d914d8794 100644 --- a/cmd/beekeeper/cmd/node_funder.go +++ b/cmd/beekeeper/cmd/node_funder.go @@ -8,6 +8,7 @@ import ( "github.com/ethersphere/beekeeper/pkg/config" "github.com/ethersphere/beekeeper/pkg/k8s" + "github.com/ethersphere/beekeeper/pkg/logging" "github.com/ethersphere/node-funder/pkg/funder" "github.com/spf13/cobra" ) @@ -69,8 +70,8 @@ func (c *command) initNodeFunderCmd() (err error) { ctx, cancel := context.WithTimeout(cmd.Context(), c.globalConfig.GetDuration(optionNameTimeout)) defer cancel() - c.logger.Infof("node-funder started") - defer c.logger.Infof("node-funder done") + c.log.Infof("node-funder started") + defer c.log.Infof("node-funder done") // TODO: Note that the swarm key address is the same as the nodeEndpoint/wallet walletAddress. @@ -81,7 +82,7 @@ func (c *command) initNodeFunderCmd() (err error) { var nodeLister funder.NodeLister // if addresses are provided, use them, not k8s client to list nodes if cfg.Namespace != "" { - nodeLister = newNodeLister(c.k8sClient) + nodeLister = newNodeLister(c.k8sClient, c.log) } return funder.Fund(ctx, funder.Config{ @@ -114,11 +115,13 @@ func (c *command) initNodeFunderCmd() (err error) { type nodeLister struct { k8sClient *k8s.Client + log logging.Logger } -func newNodeLister(k8sClient *k8s.Client) *nodeLister { +func newNodeLister(k8sClient *k8s.Client, l logging.Logger) *nodeLister { return &nodeLister{ k8sClient: k8sClient, + log: l, } } @@ -141,16 +144,9 @@ func (nf *nodeLister) List(ctx context.Context, namespace string) (nodes []funde return nil, fmt.Errorf("list ingress route debug nodes hosts: %s", err.Error()) } - nodes = make([]funder.NodeInfo, 0, len(ingressHosts)+len(ingressRouteHosts)) + ingressHosts = append(ingressHosts, ingressRouteHosts...) for _, node := range ingressHosts { - nodes = append(nodes, funder.NodeInfo{ - Name: node.Name, - Address: node.Host, - }) - } - - for _, node := range ingressRouteHosts { nodes = append(nodes, funder.NodeInfo{ Name: node.Name, Address: fmt.Sprintf("http://%s", node.Host), diff --git a/cmd/beekeeper/cmd/simulate.go b/cmd/beekeeper/cmd/simulate.go index cb575c612..331b02c43 100644 --- a/cmd/beekeeper/cmd/simulate.go +++ b/cmd/beekeeper/cmd/simulate.go @@ -53,13 +53,13 @@ func (c *command) initSimulateCmd() (err error) { ) if metricsEnabled { - metricsPusher, cleanup = newMetricsPusher(c.globalConfig.GetString(optionNameMetricsPusherAddress), cfgCluster.GetNamespace(), c.logger) + metricsPusher, cleanup = newMetricsPusher(c.globalConfig.GetString(optionNameMetricsPusherAddress), cfgCluster.GetNamespace(), c.log) // cleanup executes when the calling context terminates defer cleanup() } // logger metrics - if l, ok := c.logger.(metrics.Reporter); ok && metricsEnabled { + if l, ok := c.log.(metrics.Reporter); ok && metricsEnabled { metrics.RegisterCollectors(metricsPusher, l.Report()...) } @@ -104,7 +104,7 @@ func (c *command) initSimulateCmd() (err error) { } // create simulation - sim := simulation.NewAction(c.logger) + sim := simulation.NewAction(c.log) if s, ok := sim.(metrics.Reporter); ok && metricsEnabled { metrics.RegisterCollectors(metricsPusher, s.Report()...) } diff --git a/go.mod b/go.mod index 17cb480ec..99091d3b1 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,10 @@ replace github.com/codahale/hdrhistogram => github.com/HdrHistogram/hdrhistogram require ( github.com/ethereum/go-ethereum v1.12.1 - github.com/ethersphere/bee v1.13.0 + github.com/ethersphere/bee v1.17.3 github.com/ethersphere/bmt v0.1.4 github.com/ethersphere/ethproxy v0.0.5 - github.com/ethersphere/node-funder v0.0.1 + github.com/ethersphere/node-funder v0.0.2 github.com/go-git/go-billy/v5 v5.4.1 github.com/go-git/go-git/v5 v5.5.2 github.com/google/uuid v1.3.0 @@ -18,10 +18,10 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/prometheus/common v0.40.0 github.com/sirupsen/logrus v1.9.0 - github.com/spf13/cobra v1.6.1 + github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.15.0 github.com/uber/jaeger-client-go v2.30.0+incompatible - golang.org/x/crypto v0.9.0 + golang.org/x/crypto v0.13.0 golang.org/x/sync v0.3.0 gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.22.16 @@ -56,10 +56,12 @@ require ( github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa // indirect github.com/googleapis/gnostic v0.5.5 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/uint256 v1.2.3 // indirect github.com/imdario/mergo v0.3.13 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/ipfs/go-cid v0.3.2 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -107,9 +109,9 @@ require ( golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/oauth2 v0.3.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/sys v0.12.0 // indirect + golang.org/x/term v0.12.0 // indirect + golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.9.1 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 1f3268547..347e65989 100644 --- a/go.sum +++ b/go.sum @@ -119,16 +119,16 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/ethereum/c-kzg-4844 v0.3.0 h1:3Y3hD6l5i0dEYsBL50C+Om644kve3pNqoAcvE26o9zI= github.com/ethereum/go-ethereum v1.12.1 h1:1kXDPxhLfyySuQYIfRxVBGYuaHdxNNxevA73vjIwsgk= github.com/ethereum/go-ethereum v1.12.1/go.mod h1:zKetLweqBR8ZS+1O9iJWI8DvmmD2NzD19apjEWDCsnw= -github.com/ethersphere/bee v1.13.0 h1:edvLPN/prq7GaaXOL3zhiwUiz1X02ZjyrLIwmK8t3x0= -github.com/ethersphere/bee v1.13.0/go.mod h1:I7KygRT5+Of72q/LKiXgfCX/H1MjvNnUEMhvZjm97DY= +github.com/ethersphere/bee v1.17.3 h1:f1YmN+IFpgfdqPgBTNOwCk//XeCz2ze2CKAmgCmA+W8= +github.com/ethersphere/bee v1.17.3/go.mod h1:CSAz9XYUHZMOBDH4e6ybjv/E1o7bK4vhYMbmgHND8nA= github.com/ethersphere/bmt v0.1.4 h1:+rkWYNtMgDx6bkNqGdWu+U9DgGI1rRZplpSW3YhBr1Q= github.com/ethersphere/bmt v0.1.4/go.mod h1:Yd8ft1U69WDuHevZc/rwPxUv1rzPSMpMnS6xbU53aY8= github.com/ethersphere/ethproxy v0.0.5 h1:j5Mkm45jqmkET6NwGaJtaxOSFbhoAfOKzHiwHl6DBT0= github.com/ethersphere/ethproxy v0.0.5/go.mod h1:7mkVRK3+Mte00jLxFAbUQ/cBepAzwTYpkE64ItCLZYw= github.com/ethersphere/go-sw3-abi v0.4.0 h1:T3ANY+ktWrPAwe2U0tZi+DILpkHzto5ym/XwV/Bbz8g= github.com/ethersphere/go-sw3-abi v0.4.0/go.mod h1:BmpsvJ8idQZdYEtWnvxA8POYQ8Rl/NhyCdF0zLMOOJU= -github.com/ethersphere/node-funder v0.0.1 h1:oz9l7rYAO2+Bct4r/mSu14CtIOaI7546Z9NcVdIgkJ8= -github.com/ethersphere/node-funder v0.0.1/go.mod h1:/qBhtMRxczNRfVlcuHBVy2vaZBy33I0Gr8W4eYS8twk= +github.com/ethersphere/node-funder v0.0.2 h1:k1d33/LXvTLfZ2WcUmvkbE5x7KGcKDC17RFdyT9aSt8= +github.com/ethersphere/node-funder v0.0.2/go.mod h1:y5ZvQdT0LJv8gy5TUQktDYYFNbDlGeYh3/qfvQL2XFA= github.com/evanphx/json-patch v4.11.0+incompatible h1:glyUF9yIYtMHzn8xaKw5rMhdWcwsYV8dZHIq5567/xs= github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -256,7 +256,11 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -272,8 +276,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1: github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc= github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= @@ -422,8 +426,8 @@ github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -497,8 +501,8 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -668,16 +672,16 @@ golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -687,8 +691,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/pkg/k8s/ingress/client.go b/pkg/k8s/ingress/client.go index e7663da2a..129c1ee3d 100644 --- a/pkg/k8s/ingress/client.go +++ b/pkg/k8s/ingress/client.go @@ -79,7 +79,7 @@ func (c *Client) Delete(ctx context.Context, name, namespace string) (err error) // ListDebugNodesHosts list Ingresses that are nodes func (c *Client) ListDebugNodesHosts(ctx context.Context, namespace string) (nodes []NodeInfo, err error) { ingreses, err := c.clientset.NetworkingV1().Ingresses(namespace).List(ctx, metav1.ListOptions{ - LabelSelector: "app.kubernetes.io/name=bee", + LabelSelector: "app.kubernetes.io/component=node", }) if err != nil { if errors.IsNotFound(err) { @@ -88,16 +88,14 @@ func (c *Client) ListDebugNodesHosts(ctx context.Context, namespace string) (nod return nil, fmt.Errorf("list ingresses in namespace %s: %w", namespace, err) } - if ingreses != nil { - for _, ingress := range ingreses.Items { - if strings.HasSuffix(ingress.Name, "-debug") { - for _, rule := range ingress.Spec.Rules { - if rule.Host != "" { - nodes = append(nodes, NodeInfo{ - Name: strings.TrimSuffix(ingress.Name, "-debug"), - Host: rule.Host, - }) - } + for _, ingress := range ingreses.Items { + if strings.HasSuffix(ingress.Name, "-debug") { + for _, rule := range ingress.Spec.Rules { + if rule.Host != "" { + nodes = append(nodes, NodeInfo{ + Name: strings.TrimSuffix(ingress.Name, "-debug"), + Host: rule.Host, + }) } } }