@@ -28,6 +28,7 @@ import (
28
28
"github.com/cortexlabs/cortex/pkg/lib/errors"
29
29
"github.com/cortexlabs/cortex/pkg/lib/files"
30
30
"github.com/cortexlabs/cortex/pkg/lib/maps"
31
+ libmath "github.com/cortexlabs/cortex/pkg/lib/math"
31
32
"github.com/cortexlabs/cortex/pkg/lib/pointer"
32
33
"github.com/cortexlabs/cortex/pkg/lib/prompt"
33
34
s "github.com/cortexlabs/cortex/pkg/lib/strings"
@@ -149,8 +150,8 @@ func getInstallClusterConfig(awsClient *aws.Client, clusterConfigFile string, di
149
150
func confirmInstallClusterConfig (clusterConfig * clusterconfig.Config , awsClient * aws.Client , disallowPrompt bool ) {
150
151
eksPrice := aws .EKSPrices [clusterConfig .Region ]
151
152
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
154
155
nlbPrice := aws .NLBMetadatas [clusterConfig .Region ].Price
155
156
natUnitPrice := aws .NATMetadatas [clusterConfig .Region ].Price
156
157
@@ -170,15 +171,19 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
170
171
rows = append (rows , []interface {}{"1 eks cluster" , s .DollarsMaxPrecision (eksPrice )})
171
172
172
173
ngNameToSpotInstancesUsed := map [string ]int {}
173
- fixedPrice := eksPrice + 2 * operatorInstancePrice + operatorEBSPrice + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
174
+ fixedPrice := eksPrice + 2 * ( operatorInstancePrice + operatorEBSPrice ) + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
174
175
totalMinPrice := fixedPrice
175
176
totalMaxPrice := fixedPrice
176
177
for _ , ng := range clusterConfig .NodeGroups {
177
178
apiInstancePrice := aws.InstanceMetadatas [clusterConfig.Region ][ng.InstanceType ].Price
178
179
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 {
180
181
apiEBSPrice += aws .EBSMetadatas [clusterConfig .Region ][ng .InstanceVolumeType .String ()].PriceIOPS * float64 (* ng .InstanceVolumeIOPS ) / 30 / 24
181
182
}
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
+ }
182
187
183
188
totalMinPrice += float64 (ng .MinInstances ) * (apiInstancePrice + apiEBSPrice )
184
189
totalMaxPrice += float64 (ng .MaxInstances ) * (apiInstancePrice + apiEBSPrice )
@@ -212,8 +217,8 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
212
217
}
213
218
214
219
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 )})
217
222
rows = append (rows , []interface {}{"2 network load balancers" , s .DollarsMaxPrecision (nlbPrice ) + " each" })
218
223
219
224
if clusterConfig .NATGateway == clusterconfig .SingleNATGateway {
0 commit comments