cleaning up
parent
8c5f94c3ee
commit
0c86efdfc6
|
|
@ -1,19 +0,0 @@
|
|||
package k8s
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func Get(ns, n, string, kind schema.GroupVersionKind, opts metav1.GetOptions) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func List(ns string, kind schema.GroupVersionKind, opts metav1.ListOptions) (runtime.Object, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func registrar() map[string]func() {
|
||||
return map[string]func(){}
|
||||
}
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
package k8s
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
|
|
@ -25,10 +22,6 @@ func (n *Node) Get(_, name string) (interface{}, error) {
|
|||
|
||||
// List all nodes on the cluster.
|
||||
func (n *Node) List(_ string) (Collection, error) {
|
||||
defer func(t time.Time) {
|
||||
log.Debug().Msgf("List Node %v", time.Since(t))
|
||||
}(time.Now())
|
||||
|
||||
opts := metav1.ListOptions{
|
||||
LabelSelector: n.labelSelector,
|
||||
FieldSelector: n.fieldSelector,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package resource
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
wa "github.com/derailed/k9s/internal/watch"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
|
@ -231,26 +231,18 @@ func metaFQN(m metav1.ObjectMeta) string {
|
|||
return m.Namespace + "/" + m.Name
|
||||
}
|
||||
|
||||
// Reconcile previous vs current state and emits delta events.
|
||||
func (l *list) Reconcile(m *wa.Meta, path *string) error {
|
||||
defer func(t time.Time) {
|
||||
log.Debug().Msgf("Reconcile %v", time.Since(t))
|
||||
}(time.Now())
|
||||
|
||||
ns := l.namespace
|
||||
if path != nil {
|
||||
ns = *path
|
||||
func (l *list) fetchFromStore(m *wa.Meta, ns string) (Columnars, error) {
|
||||
rr, err := m.List(l.name, ns)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var (
|
||||
items Columnars
|
||||
err error
|
||||
)
|
||||
rr, err := m.List(l.name, ns)
|
||||
if err == nil {
|
||||
items := make(Columnars, 0, len(rr))
|
||||
for _, r := range rr {
|
||||
var fqn string
|
||||
var res Columnar
|
||||
var (
|
||||
fqn string
|
||||
res Columnar
|
||||
)
|
||||
switch o := r.(type) {
|
||||
case *v1.Node:
|
||||
fqn = metaFQN(o.ObjectMeta)
|
||||
|
|
@ -282,9 +274,25 @@ func (l *list) Reconcile(m *wa.Meta, path *string) error {
|
|||
if mx, ok := pmx.(*mv1beta1.PodMetrics); ok {
|
||||
res.SetPodMetrics(mx)
|
||||
}
|
||||
default:
|
||||
return items, fmt.Errorf("No informer matched %s:%s", l.name, ns)
|
||||
}
|
||||
items = append(items, res)
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// Reconcile previous vs current state and emits delta events.
|
||||
func (l *list) Reconcile(m *wa.Meta, path *string) error {
|
||||
ns := l.namespace
|
||||
if path != nil {
|
||||
ns = *path
|
||||
}
|
||||
|
||||
var items Columnars
|
||||
if rr, err := l.fetchFromStore(m, ns); err == nil {
|
||||
items = rr
|
||||
} else {
|
||||
log.Debug().Msg("Standard load")
|
||||
items, err = l.resource.List(l.namespace)
|
||||
|
|
|
|||
|
|
@ -171,10 +171,6 @@ func (r *Pod) Logs(c chan<- string, ns, n, co string, lines int64, prev bool) (c
|
|||
|
||||
// List resources for a given namespace.
|
||||
func (r *Pod) List(ns string) (Columnars, error) {
|
||||
defer func(t time.Time) {
|
||||
log.Debug().Msgf("List Pod %v", time.Since(t))
|
||||
}(time.Now())
|
||||
|
||||
pods, err := r.Resource.List(ns)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package views
|
|||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/derailed/k9s/internal/config"
|
||||
"github.com/derailed/k9s/internal/k8s"
|
||||
|
|
@ -92,10 +91,6 @@ func (v *clusterInfoView) infoCell(t string) *tview.TableCell {
|
|||
}
|
||||
|
||||
func (v *clusterInfoView) refresh() {
|
||||
defer func(t time.Time) {
|
||||
log.Debug().Msgf("Cluster Refresh %v", time.Since(t))
|
||||
}(time.Now())
|
||||
|
||||
cluster := resource.NewCluster(v.app.conn(), &log.Logger, v.mxs)
|
||||
|
||||
var row int
|
||||
|
|
|
|||
|
|
@ -379,11 +379,6 @@ func (v *resourceView) doSwitchNamespace(ns string) {
|
|||
}
|
||||
|
||||
func (v *resourceView) refresh() {
|
||||
log.Debug().Msgf("%s", strings.Repeat("-", 80))
|
||||
defer func(t time.Time) {
|
||||
log.Debug().Msgf("Refresh %s %v", v.list.GetName(), time.Since(t))
|
||||
}(time.Now())
|
||||
|
||||
if _, ok := v.CurrentPage().Item.(*tableView); !ok {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue