Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cli/cmd/lib_cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
rows = append(rows, []interface{}{"1 eks cluster", s.DollarsMaxPrecision(eksPrice)})

ngNameToSpotInstancesUsed := map[string]int{}
fixedPrice := eksPrice + operatorInstancePrice + operatorEBSPrice + prometheusInstancePrice + prometheusEBSPrice + metricsEBSPrice + 2*nlbPrice + natTotalPrice
fixedPrice := eksPrice + 2*(operatorInstancePrice+operatorEBSPrice) + prometheusInstancePrice + prometheusEBSPrice + metricsEBSPrice + 2*nlbPrice + natTotalPrice
totalMinPrice := fixedPrice
totalMaxPrice := fixedPrice
for _, ng := range clusterConfig.NodeGroups {
Expand Down Expand Up @@ -215,7 +215,13 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsClient
workerPriceStr += " (spot pricing unavailable)"
if err == nil && spotPrice != 0 {
workerPriceStr = fmt.Sprintf("%s - %s each (varies based on spot price)", s.DollarsAndTenthsOfCents(spotPrice+apiEBSPrice), s.DollarsAndTenthsOfCents(apiInstancePrice+apiEBSPrice))
totalMinPrice += float64(ng.MinInstances) * (spotPrice + apiEBSPrice)
if ng.MinInstances > *ng.SpotConfig.OnDemandBaseCapacity {
totalMinPrice += float64(ng.MinInstances-*ng.SpotConfig.OnDemandBaseCapacity)*(spotPrice+apiEBSPrice)*float64(100-*ng.SpotConfig.OnDemandPercentageAboveBaseCapacity)/100 +
float64(ng.MinInstances-*ng.SpotConfig.OnDemandBaseCapacity)*(apiInstancePrice+apiEBSPrice)*float64(*ng.SpotConfig.OnDemandPercentageAboveBaseCapacity)/100 +
float64(*ng.SpotConfig.OnDemandBaseCapacity)*(apiInstancePrice+apiEBSPrice)
} else {
totalMinPrice += float64(ng.MinInstances) * (apiInstancePrice + apiEBSPrice)
}
} else {
totalMinPrice += float64(ng.MinInstances) * (apiInstancePrice + apiEBSPrice)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/operator/endpoints/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package endpoints
import (
"net/http"
"sort"
"strings"

"github.com/cortexlabs/cortex/pkg/config"
"github.com/cortexlabs/cortex/pkg/lib/aws"
Expand Down Expand Up @@ -76,7 +75,7 @@ func getWorkerNodeInfos() ([]schema.WorkerNodeInfo, int, error) {

instanceType := node.Labels["beta.kubernetes.io/instance-type"]
nodeGroupName := node.Labels["alpha.eksctl.io/nodegroup-name"]
isSpot := strings.Contains(strings.ToLower(node.Labels["lifecycle"]), "spot")
isSpot := node.Labels["node-lifecycle"] == "spot"

price := aws.InstanceMetadatas[config.ClusterConfig.Region][instanceType].Price
if isSpot {
Expand Down
5 changes: 2 additions & 3 deletions pkg/operator/operator/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package operator

import (
"context"
"strings"

"github.com/cortexlabs/cortex/pkg/config"
"github.com/cortexlabs/cortex/pkg/consts"
Expand Down Expand Up @@ -128,7 +127,7 @@ func clusterTelemetryProperties() (map[string]interface{}, error) {
}

isSpot := false
if strings.Contains(strings.ToLower(node.Labels["lifecycle"]), "spot") {
if node.Labels["node-lifecycle"] == "spot" {
isSpot = true
}

Expand Down Expand Up @@ -304,7 +303,7 @@ func CostBreakdown() error {
}

isSpot := false
if strings.Contains(strings.ToLower(node.Labels["lifecycle"]), "spot") {
if node.Labels["node-lifecycle"] == "spot" {
isSpot = true
}

Expand Down