k8s: calculate cpu/memory scale correctly for output (#50)

This commit is contained in:
David Dollar 2019-12-10 21:31:26 -05:00 committed by GitHub
parent 99af46ecdb
commit 4c96aab79a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,6 +65,14 @@ func (p *Provider) ServiceList(app string) (structs.Services, error) {
Ports: serviceContainerPorts(cs[0], ms.Internal),
}
if v := cs[0].Resources.Requests.Cpu(); v != nil {
s.Cpu = int(v.MilliValue())
}
if v := cs[0].Resources.Requests.Memory(); v != nil {
s.Memory = int(v.Value() / (1024 * 1024)) // Mi
}
ss = append(ss, s)
}