Improved CLI for PVClaims
This commit is contained in:
@@ -269,7 +269,7 @@ var namespaceColumns = []string{"NAME", "LABELS", "STATUS", "AGE"}
|
||||
var secretColumns = []string{"NAME", "TYPE", "DATA", "AGE"}
|
||||
var serviceAccountColumns = []string{"NAME", "SECRETS", "AGE"}
|
||||
var persistentVolumeColumns = []string{"NAME", "LABELS", "CAPACITY", "ACCESSMODES", "STATUS", "CLAIM", "REASON", "AGE"}
|
||||
var persistentVolumeClaimColumns = []string{"NAME", "LABELS", "STATUS", "VOLUME", "AGE"}
|
||||
var persistentVolumeClaimColumns = []string{"NAME", "LABELS", "STATUS", "VOLUME", "CAPACITY", "ACCESSMODES", "AGE"}
|
||||
var componentStatusColumns = []string{"NAME", "STATUS", "MESSAGE", "ERROR"}
|
||||
var withNamespacePrefixColumns = []string{"NAMESPACE"} // TODO(erictune): print cluster name too.
|
||||
|
||||
@@ -779,9 +779,9 @@ func printPersistentVolume(pv *api.PersistentVolume, w io.Writer, withNamespace
|
||||
modesStr := volume.GetAccessModesAsString(pv.Spec.AccessModes)
|
||||
|
||||
aQty := pv.Spec.Capacity[api.ResourceStorage]
|
||||
aSize := aQty.Value()
|
||||
aSize := aQty.String()
|
||||
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s",
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s",
|
||||
name,
|
||||
formatLabels(pv.Labels),
|
||||
aSize, modesStr,
|
||||
@@ -815,13 +815,18 @@ func printPersistentVolumeClaim(pvc *api.PersistentVolumeClaim, w io.Writer, wit
|
||||
}
|
||||
}
|
||||
|
||||
if withNamespace {
|
||||
if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil {
|
||||
return err
|
||||
}
|
||||
labels := formatLabels(pvc.Labels)
|
||||
phase := pvc.Status.Phase
|
||||
storage := pvc.Spec.Resources.Requests[api.ResourceStorage]
|
||||
capacity := ""
|
||||
accessModes := ""
|
||||
if pvc.Spec.VolumeName != "" {
|
||||
accessModes = volume.GetAccessModesAsString(pvc.Status.AccessModes)
|
||||
storage = pvc.Status.Capacity[api.ResourceStorage]
|
||||
capacity = storage.String()
|
||||
}
|
||||
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s", name, pvc.Labels, pvc.Status.Phase, pvc.Spec.VolumeName, translateTimestamp(pvc.CreationTimestamp)); err != nil {
|
||||
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s", name, labels, phase, pvc.Spec.VolumeName, capacity, accessModes, translateTimestamp(pvc.CreationTimestamp)); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := fmt.Fprint(w, appendLabels(pvc.Labels, columnLabels))
|
||||
|
Reference in New Issue
Block a user