|
|
@@ -86,7 +86,8 @@ var gcpRegions = []string{
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
- nvidiaGPURegex = regexp.MustCompile("(Nvidia Tesla [^ ]+) ")
|
|
|
+ nvidiaTeslaGPURegex = regexp.MustCompile("(Nvidia Tesla [^ ]+) ")
|
|
|
+ nvidiaGPURegex = regexp.MustCompile("(Nvidia [^ ]+) ")
|
|
|
// gce://guestbook-12345/...
|
|
|
// => guestbook-12345
|
|
|
gceRegex = regexp.MustCompile("gce://([^/]*)/*")
|
|
|
@@ -772,13 +773,23 @@ func (gcp *GCP) parsePage(r io.Reader, inputKeys map[string]models.Key, pvKeys m
|
|
|
}
|
|
|
|
|
|
var gpuType string
|
|
|
- for matchnum, group := range nvidiaGPURegex.FindStringSubmatch(product.Description) {
|
|
|
+ for matchnum, group := range nvidiaTeslaGPURegex.FindStringSubmatch(product.Description) {
|
|
|
if matchnum == 1 {
|
|
|
gpuType = strings.ToLower(strings.Join(strings.Split(group, " "), "-"))
|
|
|
log.Debugf("GCP Billing API: GPU type found: '%s'", gpuType)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // If a 'Nvidia Tesla' is not found, try 'Nvidia'
|
|
|
+ if gpuType == "" {
|
|
|
+ for matchnum, group := range nvidiaGPURegex.FindStringSubmatch(product.Description) {
|
|
|
+ if matchnum == 1 {
|
|
|
+ gpuType = strings.ToLower(strings.Join(strings.Split(group, " "), "-"))
|
|
|
+ log.Debugf("GCP Billing API: GPU type found: '%s'", gpuType)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
candidateKeys := []string{}
|
|
|
if gcp.ValidPricingKeys == nil {
|
|
|
gcp.ValidPricingKeys = make(map[string]bool)
|