Skip to content

Commit

Permalink
fix: fargate cost
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Mar 18, 2023
1 parent 17e19a7 commit e85da80
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion exporter/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (m *Metrics) nodeCreated(obj interface{}) {
} else if _, ok := node.Labels["eks.amazonaws.com/compute-type"]; ok && node.Labels["eks.amazonaws.com/compute-type"] == "fargate" {
// Fargate
tmp.Instance = m.Instances["fargate"]
tmp.Cost = tmp.Instance.OnDemandCost
tmp.Cost = &Ec2Cost{Type: "fargate", VCpu: tmp.Instance.OnDemandCost.VCpu, Memory: tmp.Instance.OnDemandCost.VCpu}
}

m.nodesMtx.Lock()
Expand Down Expand Up @@ -284,6 +284,13 @@ func (m *Metrics) GetUsageCost() {
}

m.updatePodCost(me)

if me.Node.Instance.Type == "fargate" {
// Also update node cost
me.Node.Cost.VCpu = me.VCpuCost
me.Node.Cost.Memory = me.MemoryCost
me.Node.Cost.Total = me.Cost
}
}
}

Expand Down

0 comments on commit e85da80

Please sign in to comment.