@@ -27,6 +27,7 @@ import (
2727 "github.com/cortexlabs/cortex/pkg/lib/errors"
2828 "github.com/cortexlabs/cortex/pkg/lib/prompt"
2929 s "github.com/cortexlabs/cortex/pkg/lib/strings"
30+ "github.com/cortexlabs/cortex/pkg/lib/table"
3031)
3132
3233type AWSCredentials struct {
@@ -204,18 +205,88 @@ func setAWSCredentials(awsCreds *AWSCredentials) error {
204205}
205206
206207func confirmClusterConfig (clusterConfig * clusterconfig.ClusterConfig , awsCreds * AWSCredentials ) {
207- fmt .Printf ("instance type: %s\n " , * clusterConfig .InstanceType )
208- fmt .Printf ("min instances: %d\n " , * clusterConfig .MinInstances )
209- fmt .Printf ("max instances: %d\n " , * clusterConfig .MaxInstances )
210- fmt .Printf ("cluster name: %s\n " , clusterConfig .ClusterName )
211- fmt .Printf ("region: %s\n " , clusterConfig .Region )
212- fmt .Printf ("bucket: %s\n " , clusterConfig .Bucket )
213- fmt .Printf ("log group: %s\n " , clusterConfig .LogGroup )
214- fmt .Printf ("AWS access key ID: %s\n " , s .MaskString (awsCreds .AWSAccessKeyID , 4 ))
208+ defaultCC , _ := clusterconfig .GetFileDefaults ()
209+
210+ var items []table.KV
211+
212+ items = append (items , table.KV {K : "instance type" , V : * clusterConfig .InstanceType })
213+ items = append (items , table.KV {K : "min instances" , V : * clusterConfig .MinInstances })
214+ items = append (items , table.KV {K : "max instances" , V : * clusterConfig .MaxInstances })
215+ items = append (items , table.KV {K : "cluster name" , V : clusterConfig .ClusterName })
216+ items = append (items , table.KV {K : "region" , V : clusterConfig .Region })
217+ items = append (items , table.KV {K : "bucket" , V : clusterConfig .Bucket })
218+
219+ if clusterConfig .LogGroup != defaultCC .LogGroup {
220+ items = append (items , table.KV {K : "log group" , V : clusterConfig .LogGroup })
221+ }
222+ if clusterConfig .Telemetry != defaultCC .Telemetry {
223+ items = append (items , table.KV {K : "telemetry" , V : clusterConfig .Telemetry })
224+ }
225+
226+ items = append (items , table.KV {K : "AWS access key ID" , V : s .MaskString (awsCreds .AWSAccessKeyID , 4 )})
215227 if awsCreds .CortexAWSAccessKeyID != awsCreds .AWSAccessKeyID {
216- fmt .Printf ("AWS access key ID: %s (cortex)\n " , s .MaskString (awsCreds .CortexAWSAccessKeyID , 4 ))
228+ items = append (items , table.KV {K : "AWS access key ID" , V : s .MaskString (awsCreds .CortexAWSAccessKeyID , 4 ) + " (cortex)" })
229+ }
230+
231+ if clusterConfig .ImagePredictorServe != defaultCC .ImagePredictorServe {
232+ items = append (items , table.KV {K : "image_predictor_serve" , V : clusterConfig .ImagePredictorServe })
233+ }
234+ if clusterConfig .ImagePredictorServeGPU != defaultCC .ImagePredictorServeGPU {
235+ items = append (items , table.KV {K : "image_predictor_serve_gpu" , V : clusterConfig .ImagePredictorServeGPU })
236+ }
237+ if clusterConfig .ImageTFServe != defaultCC .ImageTFServe {
238+ items = append (items , table.KV {K : "image_tf_serve" , V : clusterConfig .ImageTFServe })
239+ }
240+ if clusterConfig .ImageTFServeGPU != defaultCC .ImageTFServeGPU {
241+ items = append (items , table.KV {K : "image_tf_serve_gpu" , V : clusterConfig .ImageTFServeGPU })
242+ }
243+ if clusterConfig .ImageTFAPI != defaultCC .ImageTFAPI {
244+ items = append (items , table.KV {K : "image_tf_api" , V : clusterConfig .ImageTFAPI })
245+ }
246+ if clusterConfig .ImageONNXServe != defaultCC .ImageONNXServe {
247+ items = append (items , table.KV {K : "image_onnx_serve" , V : clusterConfig .ImageONNXServe })
248+ }
249+ if clusterConfig .ImageONNXServeGPU != defaultCC .ImageONNXServeGPU {
250+ items = append (items , table.KV {K : "image_onnx_serve_gpu" , V : clusterConfig .ImageONNXServeGPU })
217251 }
218- fmt .Println ()
252+ if clusterConfig .ImageOperator != defaultCC .ImageOperator {
253+ items = append (items , table.KV {K : "image_operator" , V : clusterConfig .ImageOperator })
254+ }
255+ if clusterConfig .ImageManager != defaultCC .ImageManager {
256+ items = append (items , table.KV {K : "image_manager" , V : clusterConfig .ImageManager })
257+ }
258+ if clusterConfig .ImageDownloader != defaultCC .ImageDownloader {
259+ items = append (items , table.KV {K : "image_downloader" , V : clusterConfig .ImageDownloader })
260+ }
261+ if clusterConfig .ImageClusterAutoscaler != defaultCC .ImageClusterAutoscaler {
262+ items = append (items , table.KV {K : "image_cluster_autoscaler" , V : clusterConfig .ImageClusterAutoscaler })
263+ }
264+ if clusterConfig .ImageMetricsServer != defaultCC .ImageMetricsServer {
265+ items = append (items , table.KV {K : "image_metrics_server" , V : clusterConfig .ImageMetricsServer })
266+ }
267+ if clusterConfig .ImageNvidia != defaultCC .ImageNvidia {
268+ items = append (items , table.KV {K : "image_nvidia" , V : clusterConfig .ImageNvidia })
269+ }
270+ if clusterConfig .ImageFluentd != defaultCC .ImageFluentd {
271+ items = append (items , table.KV {K : "image_fluentd" , V : clusterConfig .ImageFluentd })
272+ }
273+ if clusterConfig .ImageStatsd != defaultCC .ImageStatsd {
274+ items = append (items , table.KV {K : "image_statsd" , V : clusterConfig .ImageStatsd })
275+ }
276+ if clusterConfig .ImageIstioProxy != defaultCC .ImageIstioProxy {
277+ items = append (items , table.KV {K : "image_istio_proxy" , V : clusterConfig .ImageIstioProxy })
278+ }
279+ if clusterConfig .ImageIstioPilot != defaultCC .ImageIstioPilot {
280+ items = append (items , table.KV {K : "image_istio_pilot" , V : clusterConfig .ImageIstioPilot })
281+ }
282+ if clusterConfig .ImageIstioCitadel != defaultCC .ImageIstioCitadel {
283+ items = append (items , table.KV {K : "image_istio_citadel" , V : clusterConfig .ImageIstioCitadel })
284+ }
285+ if clusterConfig .ImageIstioGalley != defaultCC .ImageIstioGalley {
286+ items = append (items , table.KV {K : "image_istio_galley" , V : clusterConfig .ImageIstioGalley })
287+ }
288+
289+ fmt .Println (table .AlignKeyValue (items , ":" , 1 ) + "\n " )
219290
220291 exitMessage := fmt .Sprintf ("Cluster configuration can be modified via the cluster config file; see https://www.cortex.dev/v/%s/cluster-management/config" , consts .CortexVersion )
221292 prompt .YesOrExit ("Is the configuration above correct?" , exitMessage )
0 commit comments