Skip to content

Commit

Permalink
fix: Crash when there is a compute-type node label but it isnt fargate
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreZiviani committed Mar 18, 2023
1 parent 3b58735 commit a7e9a0f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions exporter/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ func (m *Metrics) nodeCreated(obj interface{}) {
Region: node.ObjectMeta.Labels["topology.kubernetes.io/region"],
}

if _, ok := node.Labels["eks.amazonaws.com/compute-type"]; ok {
if _, ok := node.ObjectMeta.Labels["node.kubernetes.io/instance-type"]; ok {
tmp.Instance = m.Instances[node.ObjectMeta.Labels["node.kubernetes.io/instance-type"]]
} else if _, ok := node.Labels["eks.amazonaws.com/compute-type"]; ok {
if node.Labels["eks.amazonaws.com/compute-type"] == "fargate" {
tmp.Instance = m.Instances["fargate"]
}
} else if _, ok := node.ObjectMeta.Labels["node.kubernetes.io/instance-type"]; ok {
tmp.Instance = m.Instances[node.ObjectMeta.Labels["node.kubernetes.io/instance-type"]]
}

m.nodesMtx.Lock()
Expand Down

0 comments on commit a7e9a0f

Please sign in to comment.