@@ -27,20 +27,20 @@ import (
2727 "github.com/cortexlabs/cortex/pkg/lib/sets/strset"
2828)
2929
30- var _instancePrefixRegex = regexp .MustCompile (`[a-zA-Z]+` )
31- var _standardInstancePrefixes = strset .New ("a" , "c" , "d" , "h" , "i" , "m" , "r" , "t" , "z" )
32- var _knownInstancePrefixes = strset .Union (_standardInstancePrefixes , strset .New ("p" , "g" , "inf" , "x" , "f" ))
30+ var _instanceCategoryRegex = regexp .MustCompile (`[a-zA-Z]+` )
31+ var _standardInstanceCategories = strset .New ("a" , "c" , "d" , "h" , "i" , "m" , "r" , "t" , "z" )
32+ var _knownInstanceCategories = strset .Union (_standardInstanceCategories , strset .New ("p" , "g" , "inf" , "x" , "f" ))
3333
3434func (c * Client ) VerifyInstanceQuota (instanceType string ) error {
35- instancePrefix := _instancePrefixRegex .FindString (instanceType )
35+ instanceCategory := _instanceCategoryRegex .FindString (instanceType )
3636
3737 // Allow the instance if we don't recognize the type
38- if ! _knownInstancePrefixes .Has (instancePrefix ) {
38+ if ! _knownInstanceCategories .Has (instanceCategory ) {
3939 return nil
4040 }
4141
42- if _standardInstancePrefixes .Has (instancePrefix ) {
43- instancePrefix = "standard"
42+ if _standardInstanceCategories .Has (instanceCategory ) {
43+ instanceCategory = "standard"
4444 }
4545
4646 var cpuLimit * int
@@ -62,7 +62,7 @@ func (c *Client) VerifyInstanceQuota(instanceType string) error {
6262 continue
6363 }
6464
65- if strings .ToLower (* metricClass ) == instancePrefix + "/ondemand" {
65+ if strings .ToLower (* metricClass ) == instanceCategory + "/ondemand" {
6666 cpuLimit = pointer .Int (int (* quota .Value )) // quota is specified in number of vCPU permitted per family
6767 return false
6868 }
0 commit comments