Skip to content

Commit 1c9d58a

Browse files
ricardokirknerRicardo Kirkner
andauthored
feat: support memory as a trigger for autoscaling (#1564)
Co-authored-by: Ricardo Kirkner <[email protected]>
1 parent e72fd23 commit 1c9d58a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Command/Autoscaling/AutoscalingSettingsSetCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
198198
// Ask for metric name
199199
$choices = $supportedMetrics;
200200
$default = $choices[0];
201-
$text = 'Which metric should be used for autoscaling?' . "\n" . 'Default: <question>' . $default . '</question>';
201+
$text = 'Which metric should be configured as a trigger for autoscaling?' . "\n" . 'Default: <question>' . $default . '</question>';
202202
$choice = $questionHelper->choose($choices, $text, 0, false);
203203
$metric = $choices[$choice];
204204
}
@@ -649,9 +649,9 @@ protected function validateService($value, $services)
649649
*/
650650
protected function getSupportedMetrics(array $defaults)
651651
{
652-
// TODO: change this once we properly support multiple metrics other than 'cpu'
653-
// override supported metrics to only support cpu despite what the backend allows
654-
return ['cpu'];
652+
// TODO: change this once we properly support multiple metrics other than 'cpu' or 'memory'
653+
// override supported metrics to only support cpu/memory despite what the backend allows
654+
return ['cpu', 'memory'];
655655
//return array_keys($defaults['triggers']);
656656
}
657657

@@ -667,7 +667,7 @@ protected function getSupportedMetrics(array $defaults)
667667
*/
668668
protected function validateMetric($value, $metrics)
669669
{
670-
if (array_key_exists($value, $metrics)) {
670+
if (in_array($value, $metrics, true)) {
671671
return $value;
672672
}
673673
throw new InvalidArgumentException(sprintf('Invalid metric name <error>%s</error>. Available metrics: %s', $value, implode(', ', $metrics)));

0 commit comments

Comments
 (0)