Skip to content

Commit

Permalink
update resource display
Browse files Browse the repository at this point in the history
  • Loading branch information
LilliJane committed May 18, 2018
1 parent 8e2cb51 commit 7f98039
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions cmd/cluster_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"net/url"
"os"

"github.com/dustin/go-humanize"

flags "github.com/jessevdk/go-flags"
"github.com/mitchellh/cli"
v1auth "github.com/nerdalize/nerd/nerd/client/auth/v1"
Expand Down Expand Up @@ -71,8 +73,8 @@ func (cmd *ClusterList) Execute(args []string) (err error) {
for _, cluster := range clusters.Clusters {
rows = append(rows, []string{
cluster.Name,
fmt.Sprintf("%s/%s", cluster.Usage.CPU, cluster.Capacity.CPU),
fmt.Sprintf("%s/%s", (cluster.Usage.Memory), cluster.Capacity.Memory),
fmt.Sprintf("%.1f/%.1f", cluster.Usage.CPU, cluster.Capacity.CPU),
fmt.Sprintf("%s/%s", humanize.Bytes(uint64(cluster.Usage.Memory)), humanize.Bytes(uint64(cluster.Capacity.Memory))),
fmt.Sprintf("%d/%d", cluster.Usage.Pods, cluster.Capacity.Pods),
})
}
Expand Down
12 changes: 6 additions & 6 deletions nerd/client/auth/v1/payload/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ type GetClusterOutput struct {
ServiceURL string `json:"service_url"`
CaCertificate string `json:"ca_certificate"`
Capacity struct {
CPU string `json:"cpu"`
Memory string `json:"memory"`
Pods int `json:"pods"`
CPU float64 `json:"cpu"`
Memory float64 `json:"memory"`
Pods int `json:"pods"`
} `json:"capacity"`
Usage struct {
CPU string `json:"cpu"`
Memory string `json:"memory"`
Pods int `json:"pods"`
CPU float64 `json:"cpu"`
Memory float64 `json:"memory"`
Pods int `json:"pods"`
} `json:"usage"`
KubeConfigUser struct {
Token string `json:"token"`
Expand Down

0 comments on commit 7f98039

Please sign in to comment.