Skip to content

Commit

Permalink
Merge pull request #6014 from jayantjain93/revert-6003-gpu-nil-pointer
Browse files Browse the repository at this point in the history
Revert "Fix nil pointer exception for case when node is nil while processing …"
  • Loading branch information
k8s-ci-robot authored Aug 4, 2023
2 parents bee7c0f + 76b20e4 commit 9adef5a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cluster-autoscaler/utils/gpu/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ func GetGpuInfoForMetrics(gpuConfig *cloudprovider.GpuConfig, availableGPUTypes
return "", MetricsNoGPU
}
resourceName := gpuConfig.ResourceName
if node != nil {
capacity, capacityFound := node.Status.Capacity[resourceName]
// There is no label value, fallback to generic solution
if gpuConfig.Type == "" && capacityFound && !capacity.IsZero() {
return resourceName.String(), MetricsGenericGPU
}
capacity, capacityFound := node.Status.Capacity[resourceName]
// There is no label value, fallback to generic solution
if gpuConfig.Type == "" && capacityFound && !capacity.IsZero() {
return resourceName.String(), MetricsGenericGPU
}

// GKE-specific label & capacity are present - consistent state
if capacityFound {
return resourceName.String(), validateGpuType(availableGPUTypes, gpuConfig.Type)
}
// GKE-specific label & capacity are present - consistent state
if capacityFound {
return resourceName.String(), validateGpuType(availableGPUTypes, gpuConfig.Type)
}

// GKE-specific label present but no capacity (yet?) - check the node template
Expand Down

0 comments on commit 9adef5a

Please sign in to comment.