MCPcopy Create free account
hub / github.com/PostHog/duckgres / podRequests

Function podRequests

controlplane/admin/cluster.go:337–347  ·  view source on GitHub ↗

podRequests sums a pod's container CPU (millicores) + memory (bytes) requests.

(p *corev1.Pod)

Source from the content-addressed store, hash-verified

335
336// podRequests sums a pod's container CPU (millicores) + memory (bytes) requests.
337func podRequests(p *corev1.Pod) (milliCPU int64, memBytes int64) {
338 for _, c := range p.Spec.Containers {
339 if q, ok := c.Resources.Requests[corev1.ResourceCPU]; ok {
340 milliCPU += q.MilliValue()
341 }
342 if q, ok := c.Resources.Requests[corev1.ResourceMemory]; ok {
343 memBytes += q.Value()
344 }
345 }
346 return
347}
348
349func (h *clusterHandler) summary(c *gin.Context) {
350 ctx := c.Request.Context()

Callers 1

summaryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected