@@ -239,7 +239,7 @@ func getConfigureClusterConfig(cachedClusterConfig clusterconfig.Config, awsCred
239
239
}
240
240
promptIfNotAdmin (awsClient , disallowPrompt )
241
241
242
- err = setConfigFieldsFromCached (userClusterConfig , & cachedClusterConfig , awsClient )
242
+ err = setConfigFieldsFromCached (userClusterConfig , & cachedClusterConfig )
243
243
if err != nil {
244
244
return nil , err
245
245
}
@@ -265,12 +265,12 @@ func getConfigureClusterConfig(cachedClusterConfig clusterconfig.Config, awsCred
265
265
return nil , err
266
266
}
267
267
268
- confirmConfigureClusterConfig (* userClusterConfig , awsCreds , awsClient , disallowPrompt )
268
+ confirmConfigureClusterConfig (* userClusterConfig , awsCreds , disallowPrompt )
269
269
270
270
return userClusterConfig , nil
271
271
}
272
272
273
- func setConfigFieldsFromCached (userClusterConfig * clusterconfig.Config , cachedClusterConfig * clusterconfig.Config , awsClient * aws. Client ) error {
273
+ func setConfigFieldsFromCached (userClusterConfig * clusterconfig.Config , cachedClusterConfig * clusterconfig.Config ) error {
274
274
if userClusterConfig .Bucket != "" && userClusterConfig .Bucket != cachedClusterConfig .Bucket {
275
275
return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .BucketKey , cachedClusterConfig .Bucket )
276
276
}
@@ -388,11 +388,6 @@ func setConfigFieldsFromCached(userClusterConfig *clusterconfig.Config, cachedCl
388
388
}
389
389
userClusterConfig .ImageFluentBit = cachedClusterConfig .ImageFluentBit
390
390
391
- if s .Obj (cachedClusterConfig .ImageStatsd ) != s .Obj (userClusterConfig .ImageStatsd ) {
392
- return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImageStatsdKey , cachedClusterConfig .ImageStatsd )
393
- }
394
- userClusterConfig .ImageStatsd = cachedClusterConfig .ImageStatsd
395
-
396
391
if s .Obj (cachedClusterConfig .ImageIstioProxy ) != s .Obj (userClusterConfig .ImageIstioProxy ) {
397
392
return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImageIstioProxyKey , cachedClusterConfig .ImageIstioProxy )
398
393
}
@@ -403,6 +398,26 @@ func setConfigFieldsFromCached(userClusterConfig *clusterconfig.Config, cachedCl
403
398
}
404
399
userClusterConfig .ImageIstioPilot = cachedClusterConfig .ImageIstioPilot
405
400
401
+ if s .Obj (cachedClusterConfig .ImagePrometheus ) != s .Obj (userClusterConfig .ImagePrometheus ) {
402
+ return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImagePrometheusKey , cachedClusterConfig .ImagePrometheus )
403
+ }
404
+
405
+ if s .Obj (cachedClusterConfig .ImagePrometheusConfigReloader ) != s .Obj (userClusterConfig .ImagePrometheusConfigReloader ) {
406
+ return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImagePrometheusConfigReloaderKey , cachedClusterConfig .ImagePrometheusConfigReloader )
407
+ }
408
+
409
+ if s .Obj (cachedClusterConfig .ImagePrometheusOperator ) != s .Obj (userClusterConfig .ImagePrometheusOperator ) {
410
+ return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImagePrometheusOperatorKey , cachedClusterConfig .ImagePrometheusOperator )
411
+ }
412
+
413
+ if s .Obj (cachedClusterConfig .ImagePrometheusStatsDExporter ) != s .Obj (userClusterConfig .ImagePrometheusStatsDExporter ) {
414
+ return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImagePrometheusStatsDExporterKey , cachedClusterConfig .ImagePrometheusStatsDExporter )
415
+ }
416
+
417
+ if s .Obj (cachedClusterConfig .ImagePrometheusToCloudWatch ) != s .Obj (userClusterConfig .ImagePrometheusToCloudWatch ) {
418
+ return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .ImagePrometheusToCloudwatchKey , cachedClusterConfig .ImagePrometheusToCloudWatch )
419
+ }
420
+
406
421
if userClusterConfig .Spot != nil && * userClusterConfig .Spot != * cachedClusterConfig .Spot {
407
422
return clusterconfig .ErrorConfigCannotBeChangedOnUpdate (clusterconfig .SpotKey , * cachedClusterConfig .Spot )
408
423
}
@@ -450,6 +465,7 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsCreds A
450
465
eksPrice := aws .EKSPrices [* clusterConfig .Region ]
451
466
operatorInstancePrice := aws .InstanceMetadatas [* clusterConfig .Region ]["t3.medium" ].Price
452
467
operatorEBSPrice := aws .EBSMetadatas [* clusterConfig .Region ]["gp2" ].PriceGB * 20 / 30 / 24
468
+ metricsEBSPrice := aws .EBSMetadatas [* clusterConfig .Region ]["gp2" ].PriceGB * 40 / 30 / 24
453
469
nlbPrice := aws .NLBMetadatas [* clusterConfig .Region ].Price
454
470
natUnitPrice := aws .NATMetadatas [* clusterConfig .Region ].Price
455
471
apiInstancePrice := aws.InstanceMetadatas [* clusterConfig.Region ][* clusterConfig.InstanceType ].Price
@@ -465,7 +481,7 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsCreds A
465
481
natTotalPrice = natUnitPrice * float64 (len (clusterConfig .AvailabilityZones ))
466
482
}
467
483
468
- fixedPrice := eksPrice + operatorInstancePrice + operatorEBSPrice + 2 * nlbPrice + natTotalPrice
484
+ fixedPrice := eksPrice + 2 * operatorInstancePrice + operatorEBSPrice + metricsEBSPrice + 2 * nlbPrice + natTotalPrice
469
485
totalMinPrice := fixedPrice + float64 (* clusterConfig .MinInstances )* (apiInstancePrice + apiEBSPrice )
470
486
totalMaxPrice := fixedPrice + float64 (* clusterConfig .MaxInstances )* (apiInstancePrice + apiEBSPrice )
471
487
@@ -476,7 +492,7 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsCreds A
476
492
{Title : "cost per hour" },
477
493
}
478
494
479
- rows := [][]interface {} {}
495
+ var rows [][]interface {}
480
496
rows = append (rows , []interface {}{"1 eks cluster" , s .DollarsMaxPrecision (eksPrice )})
481
497
482
498
instanceStr := "instances"
@@ -505,8 +521,9 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsCreds A
505
521
506
522
rows = append (rows , []interface {}{workerInstanceStr , workerPriceStr })
507
523
rows = append (rows , []interface {}{ebsInstanceStr , s .DollarsAndTenthsOfCents (apiEBSPrice ) + " each" })
508
- rows = append (rows , []interface {}{"1 t3.medium instance for the operator " , s .DollarsMaxPrecision (operatorInstancePrice )})
524
+ rows = append (rows , []interface {}{"2 t3.medium instances for the cortex system " , s .DollarsMaxPrecision (operatorInstancePrice * 2 )})
509
525
rows = append (rows , []interface {}{"1 20gb ebs volume for the operator" , s .DollarsAndTenthsOfCents (operatorEBSPrice )})
526
+ rows = append (rows , []interface {}{"1 40gb ebs volume for prometheus" , s .DollarsAndTenthsOfCents (metricsEBSPrice )})
510
527
rows = append (rows , []interface {}{"2 network load balancers" , s .DollarsMaxPrecision (nlbPrice ) + " each" })
511
528
512
529
if clusterConfig .NATGateway == clusterconfig .SingleNATGateway {
@@ -565,16 +582,16 @@ func confirmInstallClusterConfig(clusterConfig *clusterconfig.Config, awsCreds A
565
582
}
566
583
}
567
584
568
- func confirmConfigureClusterConfig (clusterConfig clusterconfig.Config , awsCreds AWSCredentials , awsClient * aws. Client , disallowPrompt bool ) {
569
- fmt .Println (clusterConfigConfirmationStr (clusterConfig , awsCreds , awsClient ))
585
+ func confirmConfigureClusterConfig (clusterConfig clusterconfig.Config , awsCreds AWSCredentials , disallowPrompt bool ) {
586
+ fmt .Println (clusterConfigConfirmationStr (clusterConfig , awsCreds ))
570
587
571
588
if ! disallowPrompt {
572
589
exitMessage := fmt .Sprintf ("cluster configuration can be modified via the cluster config file; see https://docs.cortex.dev/v/%s/ for more information" , consts .CortexVersionMinor )
573
590
prompt .YesOrExit (fmt .Sprintf ("your cluster named \" %s\" in %s will be updated according to the configuration above, are you sure you want to continue?" , clusterConfig .ClusterName , * clusterConfig .Region ), "" , exitMessage )
574
591
}
575
592
}
576
593
577
- func clusterConfigConfirmationStr (clusterConfig clusterconfig.Config , awsCreds AWSCredentials , awsClient * aws. Client ) string {
594
+ func clusterConfigConfirmationStr (clusterConfig clusterconfig.Config , awsCreds AWSCredentials ) string {
578
595
defaultConfig , _ := clusterconfig .GetDefaults ()
579
596
580
597
var items table.KeyValuePairs
@@ -694,15 +711,26 @@ func clusterConfigConfirmationStr(clusterConfig clusterconfig.Config, awsCreds A
694
711
if clusterConfig .ImageFluentBit != defaultConfig .ImageFluentBit {
695
712
items .Add (clusterconfig .ImageFluentBitUserKey , clusterConfig .ImageFluentBit )
696
713
}
697
- if clusterConfig .ImageStatsd != defaultConfig .ImageStatsd {
698
- items .Add (clusterconfig .ImageStatsdUserKey , clusterConfig .ImageStatsd )
699
- }
700
714
if clusterConfig .ImageIstioProxy != defaultConfig .ImageIstioProxy {
701
715
items .Add (clusterconfig .ImageIstioProxyUserKey , clusterConfig .ImageIstioProxy )
702
716
}
703
717
if clusterConfig .ImageIstioPilot != defaultConfig .ImageIstioPilot {
704
718
items .Add (clusterconfig .ImageIstioPilotUserKey , clusterConfig .ImageIstioPilot )
705
719
}
706
-
720
+ if clusterConfig .ImagePrometheus != defaultConfig .ImagePrometheus {
721
+ items .Add (clusterconfig .ImagePrometheusUserKey , clusterConfig .ImagePrometheus )
722
+ }
723
+ if clusterConfig .ImagePrometheusConfigReloader != defaultConfig .ImagePrometheusConfigReloader {
724
+ items .Add (clusterconfig .ImagePrometheusConfigReloaderUserKey , clusterConfig .ImagePrometheusConfigReloader )
725
+ }
726
+ if clusterConfig .ImagePrometheusOperator != defaultConfig .ImagePrometheusOperator {
727
+ items .Add (clusterconfig .ImagePrometheusOperatorUserKey , clusterConfig .ImagePrometheusOperator )
728
+ }
729
+ if clusterConfig .ImagePrometheusStatsDExporter != defaultConfig .ImagePrometheusStatsDExporter {
730
+ items .Add (clusterconfig .ImagePrometheusStatsDExporterUserKey , clusterConfig .ImagePrometheusStatsDExporter )
731
+ }
732
+ if clusterConfig .ImagePrometheusToCloudWatch != defaultConfig .ImagePrometheusToCloudWatch {
733
+ items .Add (clusterconfig .ImagePrometheusToCloudwatchUserKey , clusterConfig .ImagePrometheusToCloudWatch )
734
+ }
707
735
return items .String ()
708
736
}
0 commit comments