@@ -187,7 +187,7 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
187187 rows = append (rows , []interface {}{"1 eks cluster" , s .DollarsMaxPrecision (eksPrice )})
188188
189189 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
191191 totalMinPrice := fixedPrice
192192 totalMaxPrice := fixedPrice
193193 for _ , ng := range clusterConfig .NodeGroups {
@@ -215,7 +215,13 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
215215 workerPriceStr += " (spot pricing unavailable)"
216216 if err == nil && spotPrice != 0 {
217217 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+ }
219225 } else {
220226 totalMinPrice += float64 (ng .MinInstances ) * (apiInstancePrice + apiEBSPrice )
221227 }
0 commit comments