@@ -24,6 +24,7 @@ import (
2424 cr "github.com/cortexlabs/cortex/pkg/lib/configreader"
2525 "github.com/cortexlabs/cortex/pkg/lib/errors"
2626 "github.com/cortexlabs/cortex/pkg/lib/prompt"
27+ "github.com/cortexlabs/cortex/pkg/lib/sets/strset"
2728 "github.com/cortexlabs/cortex/pkg/lib/slices"
2829 s "github.com/cortexlabs/cortex/pkg/lib/strings"
2930 "github.com/cortexlabs/cortex/pkg/lib/table"
@@ -169,11 +170,31 @@ func confirmClusterConfig(clusterConfig *clusterconfig.ClusterConfig, awsCreds *
169170
170171 if clusterConfig .Spot != nil && * clusterConfig .Spot != * defaultConfig .Spot {
171172 items = append (items , table.KV {K : clusterconfig .SpotUserFacingKey , V : s .YesNo (clusterConfig .Spot != nil && * clusterConfig .Spot )})
172- items = append (items , table.KV {K : clusterconfig .InstanceDistributionUserFacingKey , V : clusterConfig .SpotConfig .InstanceDistribution })
173- items = append (items , table.KV {K : clusterconfig .OnDemandBaseCapacityUserFacingKey , V : * clusterConfig .SpotConfig .OnDemandBaseCapacity })
174- items = append (items , table.KV {K : clusterconfig .OnDemandPercentageAboveBaseCapacityUserFacingKey , V : * clusterConfig .SpotConfig .OnDemandPercentageAboveBaseCapacity })
175- items = append (items , table.KV {K : clusterconfig .MaxPriceUserFacingKey , V : * clusterConfig .SpotConfig .MaxPrice })
176- items = append (items , table.KV {K : clusterconfig .InstancePoolsUserFacingKey , V : * clusterConfig .SpotConfig .InstancePools })
173+
174+ if clusterConfig .SpotConfig != nil {
175+ defaultSpotConfig := clusterconfig.SpotConfig {}
176+ clusterconfig .AutoGenerateSpotConfig (& defaultSpotConfig , * clusterConfig .Region , * clusterConfig .InstanceType )
177+
178+ if ! strset .New (clusterConfig .SpotConfig .InstanceDistribution ... ).IsEqual (strset .New (defaultSpotConfig .InstanceDistribution ... )) {
179+ items = append (items , table.KV {K : clusterconfig .InstanceDistributionUserFacingKey , V : clusterConfig .SpotConfig .InstanceDistribution })
180+ }
181+
182+ if * clusterConfig .SpotConfig .OnDemandBaseCapacity != * defaultSpotConfig .OnDemandBaseCapacity {
183+ items = append (items , table.KV {K : clusterconfig .OnDemandBaseCapacityUserFacingKey , V : * clusterConfig .SpotConfig .OnDemandBaseCapacity })
184+ }
185+
186+ if * clusterConfig .SpotConfig .OnDemandPercentageAboveBaseCapacity != * defaultSpotConfig .OnDemandPercentageAboveBaseCapacity {
187+ items = append (items , table.KV {K : clusterconfig .OnDemandPercentageAboveBaseCapacityUserFacingKey , V : * clusterConfig .SpotConfig .OnDemandPercentageAboveBaseCapacity })
188+ }
189+
190+ if * clusterConfig .SpotConfig .MaxPrice != * defaultSpotConfig .MaxPrice {
191+ items = append (items , table.KV {K : clusterconfig .MaxPriceUserFacingKey , V : * clusterConfig .SpotConfig .MaxPrice })
192+ }
193+
194+ if * clusterConfig .SpotConfig .InstancePools != * defaultSpotConfig .InstancePools {
195+ items = append (items , table.KV {K : clusterconfig .InstancePoolsUserFacingKey , V : * clusterConfig .SpotConfig .InstancePools })
196+ }
197+ }
177198 }
178199 if clusterConfig .InstanceVolumeSize != defaultConfig .InstanceVolumeSize {
179200 items = append (items , table.KV {K : clusterconfig .InstanceVolumeSizeUserFacingKey , V : clusterConfig .InstanceVolumeSize })
0 commit comments