@@ -24,6 +24,7 @@ import (
24
24
cr "github.com/cortexlabs/cortex/pkg/lib/configreader"
25
25
"github.com/cortexlabs/cortex/pkg/lib/errors"
26
26
"github.com/cortexlabs/cortex/pkg/lib/prompt"
27
+ "github.com/cortexlabs/cortex/pkg/lib/sets/strset"
27
28
"github.com/cortexlabs/cortex/pkg/lib/slices"
28
29
s "github.com/cortexlabs/cortex/pkg/lib/strings"
29
30
"github.com/cortexlabs/cortex/pkg/lib/table"
@@ -169,11 +170,31 @@ func confirmClusterConfig(clusterConfig *clusterconfig.ClusterConfig, awsCreds *
169
170
170
171
if clusterConfig .Spot != nil && * clusterConfig .Spot != * defaultConfig .Spot {
171
172
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
+ }
177
198
}
178
199
if clusterConfig .InstanceVolumeSize != defaultConfig .InstanceVolumeSize {
179
200
items = append (items , table.KV {K : clusterconfig .InstanceVolumeSizeUserFacingKey , V : clusterConfig .InstanceVolumeSize })
0 commit comments