mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #70269 from WanLinghao/clean_describe
clean and move some code in pkg/printers/internalversion/
This commit is contained in:
commit
863a502c06
@ -19,7 +19,6 @@ package internalversion
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sort"
|
||||
"strconv"
|
||||
@ -1549,13 +1548,6 @@ func printComponentStatusList(list *api.ComponentStatusList, options printers.Pr
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
func truncate(str string, maxLen int) string {
|
||||
if len(str) > maxLen {
|
||||
return str[0:maxLen] + "..."
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
func printDeployment(obj *apps.Deployment, options printers.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
row := metav1beta1.TableRow{
|
||||
Object: runtime.RawExtension{Object: obj},
|
||||
@ -1830,24 +1822,6 @@ func printStatus(obj *metav1.Status, options printers.PrintOptions) ([]metav1bet
|
||||
return []metav1beta1.TableRow{row}, nil
|
||||
}
|
||||
|
||||
// Lay out all the containers on one line if use wide output.
|
||||
// DEPRECATED: convert to TableHandler and use layoutContainerCells
|
||||
func layoutContainers(containers []api.Container, w io.Writer) error {
|
||||
var namesBuffer bytes.Buffer
|
||||
var imagesBuffer bytes.Buffer
|
||||
|
||||
for i, container := range containers {
|
||||
namesBuffer.WriteString(container.Name)
|
||||
imagesBuffer.WriteString(container.Image)
|
||||
if i != len(containers)-1 {
|
||||
namesBuffer.WriteString(",")
|
||||
imagesBuffer.WriteString(",")
|
||||
}
|
||||
}
|
||||
_, err := fmt.Fprintf(w, "\t%s\t%s", namesBuffer.String(), imagesBuffer.String())
|
||||
return err
|
||||
}
|
||||
|
||||
// Lay out all the containers on one line if use wide output.
|
||||
func layoutContainerCells(containers []api.Container) (names string, images string) {
|
||||
var namesBuffer bytes.Buffer
|
||||
|
Loading…
Reference in New Issue
Block a user