@@ -187,7 +187,7 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
187
187
rows = append (rows , []interface {}{"1 eks cluster" , s .DollarsMaxPrecision (eksPrice )})
188
188
189
189
ngNameToSpotInstancesUsed := map [string ]int {}
190
- fixedPrice := eksPrice + operatorInstancePrice + operatorEBSPrice + prometheusInstancePrice + prometheusEBSPrice + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
190
+ fixedPrice := eksPrice + 2 * ( operatorInstancePrice + operatorEBSPrice ) + prometheusInstancePrice + prometheusEBSPrice + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
191
191
totalMinPrice := fixedPrice
192
192
totalMaxPrice := fixedPrice
193
193
for _ , ng := range clusterConfig .NodeGroups {
@@ -215,7 +215,13 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
215
215
workerPriceStr += " (spot pricing unavailable)"
216
216
if err == nil && spotPrice != 0 {
217
217
workerPriceStr = fmt .Sprintf ("%s - %s each (varies based on spot price)" , s .DollarsAndTenthsOfCents (spotPrice + apiEBSPrice ), s .DollarsAndTenthsOfCents (apiInstancePrice + apiEBSPrice ))
218
- totalMinPrice += float64 (ng .MinInstances ) * (spotPrice + apiEBSPrice )
218
+ if ng .MinInstances > * ng .SpotConfig .OnDemandBaseCapacity {
219
+ totalMinPrice += float64 (ng .MinInstances - * ng .SpotConfig .OnDemandBaseCapacity )* (spotPrice + apiEBSPrice )* float64 (100 - * ng .SpotConfig .OnDemandPercentageAboveBaseCapacity )/ 100 +
220
+ float64 (ng .MinInstances - * ng .SpotConfig .OnDemandBaseCapacity )* (apiInstancePrice + apiEBSPrice )* float64 (* ng .SpotConfig .OnDemandPercentageAboveBaseCapacity )/ 100 +
221
+ float64 (* ng .SpotConfig .OnDemandBaseCapacity )* (apiInstancePrice + apiEBSPrice )
222
+ } else {
223
+ totalMinPrice += float64 (ng .MinInstances ) * (apiInstancePrice + apiEBSPrice )
224
+ }
219
225
} else {
220
226
totalMinPrice += float64 (ng .MinInstances ) * (apiInstancePrice + apiEBSPrice )
221
227
}
0 commit comments