Skip to content

Commit

Permalink
add KUBECM_DISABLE_K8S_MORE_INFO env to disable output moreinfo
Browse files Browse the repository at this point in the history
Signed-off-by: yxxhero <[email protected]>
  • Loading branch information
yxxhero committed Jun 11, 2024
1 parent 561e01c commit 529c8fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 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
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

0 comments on commit 529c8fc

Please sign in to comment.