@@ -35,6 +35,7 @@ const (
3535 k8sResourceAttr = "k8sResource"
3636 attrQuantityValue = "quantity"
3737 storeResourceAttr = "storeResource"
38+ iecQuantityAttr = "iecQuantity"
3839 timeDurationResourceAttr = "timeDurationResource"
3940 // attrStorageValue = "storage"
4041 // attrTimeDurationValue = "timeDuration"
@@ -102,6 +103,8 @@ func processCueIntegerExpansion(x cue.Value) (CueType, string) {
102103 return K8SQuantityType , ""
103104 case storeResourceAttr :
104105 return ClassicStorageType , attr .Contents ()
106+ case iecQuantityAttr :
107+ return IECQuantityType , ""
105108 case timeDurationResourceAttr :
106109 return ClassicTimeDurationType , attr .Contents ()
107110 }
@@ -117,6 +120,17 @@ func handleK8sQuantityType(s string) (int64, error) {
117120 return quantity .Value (), nil
118121}
119122
123+ func handleIECQuantityType (s string ) (int64 , error ) {
124+ if ! isAllNumber (s ) {
125+ // IEC 80000-13 requires explicit 'B' suffix (e.g. "256MB", "256MiB").
126+ if ! strings .HasSuffix (s , "B" ) {
127+ return 0 , core .MakeError ("require explicit byte-unit suffixing[%s]" , s )
128+ }
129+ s = s [:len (s )- 1 ]
130+ }
131+ return handleK8sQuantityType (s )
132+ }
133+
120134func parseDigitNumber (s string ) int {
121135 lastDigit := 0
122136 for _ , b := range s {
0 commit comments