2
0
Эх сурвалжийг харах

Update GCP and AWS parse ID

Niko Kovacevic 5 жил өмнө
parent
commit
2c7f145455

+ 1 - 1
pkg/cloud/awsprovider.go

@@ -2402,7 +2402,7 @@ func (aws *AWS) CombinedDiscountForNode(instanceType string, isPreemptible bool,
 
 func (aws *AWS) ParseID(id string) string {
 	// It's of the form aws:///us-east-2a/i-0fea4fd46592d050b and we want i-0fea4fd46592d050b, if it exists
-	rx := regexp.MustCompile("aws:///[^/]+/([^/]+)")
+	rx := regexp.MustCompile("aws://[^/]*/[^/]*/([^/]+)")
 	match := rx.FindStringSubmatch(id)
 	if len(match) < 2 {
 		log.Infof("awsprovider.ParseID: failed to parse %s", id)

+ 1 - 1
pkg/cloud/gcpprovider.go

@@ -1406,7 +1406,7 @@ func sustainedUseDiscount(class string, defaultDiscount float64) float64 {
 func (gcp *GCP) ParseID(id string) string {
 	// gce://guestbook-227502/us-central1-a/gke-niko-n1-standard-2-wljla-8df8e58a-hfy7
 	//  => gke-niko-n1-standard-2-wljla-8df8e58a-hfy7
-	rx := regexp.MustCompile("gce://[^/]+/[^/]+/([^/]+)")
+	rx := regexp.MustCompile("gce://[^/]*/[^/]*/([^/]+)")
 	match := rx.FindStringSubmatch(id)
 	if len(match) < 2 {
 		log.Infof("gcpprovider.ParseID: failed to parse %s", id)