@@ -58,17 +58,12 @@ func renderSinglePodUsageTable(ctx context.Context, cfg *scout.Config, pods []co
5858 return errors .Wrapf (err , "could not get pod with name %s" , cfg .Pod )
5959 }
6060
61- podMetrics , err := kube .GetPodMetrics (ctx , cfg , pod )
62- if err != nil {
63- return errors .Wrap (err , "while attempting to fetch pod metrics" )
64- }
65-
6661 containerMetrics := & scout.ContainerMetrics {
6762 PodName : cfg .Pod ,
6863 Limits : map [string ]scout.Resources {},
6964 }
70- if err = kube .GetLimits (ctx , cfg , & pod , containerMetrics ); err != nil {
71- return errors .Wrap (err , "failed to get get container metrics" )
65+ if err = kube .AddLimits (ctx , cfg , & pod , containerMetrics ); err != nil {
66+ return errors .Wrap (err , "failed to add limits to container metrics" )
7267 }
7368
7469 columns := []table.Column {
@@ -82,6 +77,11 @@ func renderSinglePodUsageTable(ctx context.Context, cfg *scout.Config, pods []co
8277 }
8378 var rows []table.Row
8479
80+ podMetrics , err := kube .GetPodMetrics (ctx , cfg , pod )
81+ if err != nil {
82+ return errors .Wrap (err , "while attempting to fetch pod metrics" )
83+ }
84+
8585 for _ , container := range podMetrics .Containers {
8686 stats , err := kube .GetUsage (ctx , cfg , * containerMetrics , pod , container )
8787 if err != nil {
@@ -114,15 +114,16 @@ func renderUsageTable(ctx context.Context, cfg *scout.Config, pods []corev1.Pod)
114114 PodName : pod .Name ,
115115 Limits : map [string ]scout.Resources {},
116116 }
117+
118+ if err := kube .AddLimits (ctx , cfg , & pod , containerMetrics ); err != nil {
119+ return errors .Wrap (err , "failed to get get container metrics" )
120+ }
121+
117122 podMetrics , err := kube .GetPodMetrics (ctx , cfg , pod )
118123 if err != nil {
119124 return errors .Wrap (err , "while attempting to fetch pod metrics" )
120125 }
121126
122- if err = kube .GetLimits (ctx , cfg , & pod , containerMetrics ); err != nil {
123- return errors .Wrap (err , "failed to get get container metrics" )
124- }
125-
126127 for _ , container := range podMetrics .Containers {
127128 stats , err := kube .GetUsage (ctx , cfg , * containerMetrics , pod , container )
128129 if err != nil {
0 commit comments