@@ -28,6 +28,7 @@ import (
2828 "github.com/cortexlabs/cortex/pkg/lib/errors"
2929 "github.com/cortexlabs/cortex/pkg/lib/files"
3030 "github.com/cortexlabs/cortex/pkg/lib/maps"
31+ libmath "github.com/cortexlabs/cortex/pkg/lib/math"
3132 "github.com/cortexlabs/cortex/pkg/lib/pointer"
3233 "github.com/cortexlabs/cortex/pkg/lib/prompt"
3334 s "github.com/cortexlabs/cortex/pkg/lib/strings"
@@ -149,8 +150,8 @@ func getInstallClusterConfig(awsClient *aws.Client, clusterConfigFile string, di
149150func confirmInstallClusterConfig (clusterConfig * clusterconfig.Config , awsClient * aws.Client , disallowPrompt bool ) {
150151 eksPrice := aws .EKSPrices [clusterConfig .Region ]
151152 operatorInstancePrice := aws .InstanceMetadatas [clusterConfig .Region ]["t3.medium" ].Price
152- operatorEBSPrice := aws .EBSMetadatas [clusterConfig .Region ]["gp2 " ].PriceGB * 20 / 30 / 24
153- metricsEBSPrice := aws .EBSMetadatas [clusterConfig .Region ]["gp2" ].PriceGB * 40 / 30 / 24
153+ operatorEBSPrice := aws .EBSMetadatas [clusterConfig .Region ]["gp3 " ].PriceGB * 20 / 30 / 24
154+ metricsEBSPrice := aws .EBSMetadatas [clusterConfig .Region ]["gp2" ].PriceGB * ( 40 + 2 ) / 30 / 24
154155 nlbPrice := aws .NLBMetadatas [clusterConfig .Region ].Price
155156 natUnitPrice := aws .NATMetadatas [clusterConfig .Region ].Price
156157
@@ -170,15 +171,19 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
170171 rows = append (rows , []interface {}{"1 eks cluster" , s .DollarsMaxPrecision (eksPrice )})
171172
172173 ngNameToSpotInstancesUsed := map [string ]int {}
173- fixedPrice := eksPrice + 2 * operatorInstancePrice + operatorEBSPrice + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
174+ fixedPrice := eksPrice + 2 * ( operatorInstancePrice + operatorEBSPrice ) + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
174175 totalMinPrice := fixedPrice
175176 totalMaxPrice := fixedPrice
176177 for _ , ng := range clusterConfig .NodeGroups {
177178 apiInstancePrice := aws.InstanceMetadatas [clusterConfig.Region ][ng.InstanceType ].Price
178179 apiEBSPrice := aws .EBSMetadatas [clusterConfig .Region ][ng .InstanceVolumeType .String ()].PriceGB * float64 (ng .InstanceVolumeSize ) / 30 / 24
179- if ng .InstanceVolumeType . String () == "io1" && ng .InstanceVolumeIOPS != nil {
180+ if ng .InstanceVolumeType == clusterconfig . IO1VolumeType && ng .InstanceVolumeIOPS != nil {
180181 apiEBSPrice += aws .EBSMetadatas [clusterConfig .Region ][ng .InstanceVolumeType .String ()].PriceIOPS * float64 (* ng .InstanceVolumeIOPS ) / 30 / 24
181182 }
183+ if ng .InstanceVolumeType == clusterconfig .GP3VolumeType && ng .InstanceVolumeIOPS != nil && ng .InstanceVolumeThroughput != nil {
184+ apiEBSPrice += libmath .MaxFloat64 (0 , (aws .EBSMetadatas [clusterConfig .Region ][ng .InstanceVolumeType .String ()].PriceIOPS - 3000 )* float64 (* ng .InstanceVolumeIOPS )/ 30 / 24 )
185+ apiEBSPrice += libmath .MaxFloat64 (0 , (aws .EBSMetadatas [clusterConfig .Region ][ng .InstanceVolumeType .String ()].PriceThroughput - 125 )* float64 (* ng .InstanceVolumeThroughput )/ 30 / 24 )
186+ }
182187
183188 totalMinPrice += float64 (ng .MinInstances ) * (apiInstancePrice + apiEBSPrice )
184189 totalMaxPrice += float64 (ng .MaxInstances ) * (apiInstancePrice + apiEBSPrice )
@@ -212,8 +217,8 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
212217 }
213218
214219 rows = append (rows , []interface {}{"2 t3.medium instances for cortex" , s .DollarsMaxPrecision (operatorInstancePrice * 2 )})
215- rows = append (rows , []interface {}{"1 20gb ebs volume for the operator" , s .DollarsAndTenthsOfCents (operatorEBSPrice )})
216- rows = append (rows , []interface {}{"1 40gb ebs volume for prometheus" , s .DollarsAndTenthsOfCents (metricsEBSPrice )})
220+ rows = append (rows , []interface {}{"2 20gb ebs volumes for the operator" , s .DollarsAndTenthsOfCents (operatorEBSPrice * 2 )})
221+ rows = append (rows , []interface {}{"1 40+2gb ebs volumes for metrics ( prometheus and grafana) " , s .DollarsAndTenthsOfCents (metricsEBSPrice )})
217222 rows = append (rows , []interface {}{"2 network load balancers" , s .DollarsMaxPrecision (nlbPrice ) + " each" })
218223
219224 if clusterConfig .NATGateway == clusterconfig .SingleNATGateway {
0 commit comments