cleaning up logs

mine
derailed 2019-02-18 18:32:23 -07:00
parent b358f3631f
commit 1bcdc65fcf
4 changed files with 3 additions and 49 deletions

View File

@ -129,10 +129,11 @@ func initK8sFlags() {
"Bearer token for authentication to the API server",
)
rootCmd.Flags().StringVar(
rootCmd.Flags().StringVarP(
k8sFlags.Namespace,
"namespace",
"n",
"",
"If present, the namespace scope for this CLI request",
)
}

View File

@ -112,8 +112,6 @@ func (c *Config) Load(path string) error {
// Save configuration to disk.
func (c *Config) Save() error {
log.Debugf("[Config] Saving configuration...")
c.Dump("Saving")
c.Validate()
return c.SaveFile(K9sConfigFile)
}

View File

@ -74,27 +74,8 @@ func (a *apiServer) hasMetricsServer() bool {
return a.useMetricServer
}
// ActiveClusterOrDie Fetch the current cluster based on current context.
func ActiveClusterOrDie() string {
cl, err := conn.config.CurrentClusterName()
if err != nil {
panic(err)
}
return cl
}
// AllClusterNamesOrDie fetch all available clusters from config.
func AllClusterNamesOrDie() []string {
if cc, err := conn.config.ClusterNames(); err != nil {
panic(err)
} else {
return cc
}
}
// DialOrDie returns a handle to api server or die.
func (a *apiServer) dialOrDie() kubernetes.Interface {
a.checkCurrentConfig()
if a.client != nil {
return a.client
}
@ -108,7 +89,6 @@ func (a *apiServer) dialOrDie() kubernetes.Interface {
// DynDial returns a handle to the api server.
func (a *apiServer) dynDialOrDie() dynamic.Interface {
a.checkCurrentConfig()
if a.dClient != nil {
return a.dClient
}
@ -122,7 +102,6 @@ func (a *apiServer) dynDialOrDie() dynamic.Interface {
}
func (a *apiServer) nsDialOrDie() dynamic.NamespaceableResourceInterface {
a.checkCurrentConfig()
if a.nsClient != nil {
return a.nsClient
}
@ -136,7 +115,6 @@ func (a *apiServer) nsDialOrDie() dynamic.NamespaceableResourceInterface {
}
func (a *apiServer) heapsterDial() (*metricsutil.HeapsterMetricsClient, error) {
a.checkCurrentConfig()
if a.heapsterClient != nil {
return a.heapsterClient, nil
}
@ -152,7 +130,6 @@ func (a *apiServer) heapsterDial() (*metricsutil.HeapsterMetricsClient, error) {
}
func (a *apiServer) mxsDial() (*versioned.Clientset, error) {
a.checkCurrentConfig()
if a.mxsClient != nil {
return a.mxsClient, nil
}
@ -162,14 +139,6 @@ func (a *apiServer) mxsDial() (*versioned.Clientset, error) {
return a.mxsClient, err
}
func (a *apiServer) configAccess() clientcmd.ConfigAccess {
cfg, err := a.config.ConfigAccess()
if err != nil {
panic(err)
}
return cfg
}
func (a *apiServer) restConfigOrDie() *restclient.Config {
cfg, err := a.config.RESTConfig()
if err != nil {
@ -193,20 +162,6 @@ func (a *apiServer) switchContextOrDie(ctx string) {
}
}
func (a *apiServer) checkCurrentConfig() {
// currentCluster, err := a.config.CurrentCluster()
// if err != nil {
// panic(err)
// }
// if a.clusterName != currentCluster {
// a.reset()
// a.clusterName = currentCluster
// a.useMetricServer = a.supportsMxServer()
// return
// }
}
func (a *apiServer) reset() {
a.client, a.dClient, a.nsClient = nil, nil, nil
a.heapsterClient, a.mxsClient = nil, nil

View File

@ -23,7 +23,7 @@ func NewContextList(ns string) List {
// NewContextListWithArgs returns a new resource list.
func NewContextListWithArgs(ns string, res Resource) List {
return newList(NotNamespaced, "ctx", res, SwitchAccess|DeleteAccess)
return newList(NotNamespaced, "ctx", res, SwitchAccess)
}
// NewContext instantiates a new Context.