Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add KUBECM_DISABLE_K8S_MORE_INFO env to disable output moreinfo #973

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ func (lc *ListCommand) runList(command *cobra.Command, args []string) error {
printString(os.Stdout, "\nKubernetes version ")
printYellow(os.Stdout, clusterMessage.Version.GitVersion)
printService(os.Stdout, "\nKubernetes master", clusterMessage.Config.Host)
err = MoreInfo(clusterMessage.ClientSet, os.Stdout)
if err != nil {
if err := MoreInfo(clusterMessage.ClientSet, os.Stdout); err != nil {
fmt.Println("(Error reporting can be ignored and does not affect usage.)")
}
}
Expand Down Expand Up @@ -97,5 +96,7 @@ kubecm ls
kubecm l
# Filter out keywords(Multi-keyword support)
kubecm ls kind k3s
# Useful environment variables
KUBECM_DISABLE_K8S_MORE_INFO: it will disable the k8s more info in the output
`
}
3 changes: 3 additions & 0 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ func ClusterStatus(duration time.Duration) (*ClusterStatusCheck, error) {

// MoreInfo output more info
func MoreInfo(clientSet kubernetes.Interface, writer io.Writer) error {
if os.Getenv("KUBECM_DISABLE_K8S_MORE_INFO") != "" {
return nil
}
timeout := int64(2)
ctx := context.TODO()
nodesList, err := clientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{TimeoutSeconds: &timeout})
Expand Down
Loading