Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export function PageApplicationCreateFeature() {
cpu: 500,
gpu: 0,
min_running_instances: 1,
max_running_instances: 2,
autoscaling_mode: 'HPA',
max_running_instances: 1,
autoscaling_mode: 'NONE',
hpa_metric_type: 'CPU',
hpa_cpu_average_utilization_percent: 60,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,25 @@ export function ApplicationSettingsResources({
const hpaMemoryAverageUtilizationPercent = watch('hpa_memory_average_utilization_percent') ?? 60
const previousAutoscalingModeRef = useRef(autoscalingMode)

// Adjust min/max values when switching from NONE to HPA or KEDA
// Adjust min/max values when switching between autoscaling modes
useEffect(() => {
const previousMode = previousAutoscalingModeRef.current

// When switching from no autoscaling to HPA/KEDA, set min=1 and max=2
if (previousMode === 'NONE' && (autoscalingMode === 'HPA' || autoscalingMode === 'KEDA')) {
// When switching from no autoscaling to HPA/KEDA, set min=1 and max=2
if (minRunningInstances === maxRunningInstances) {
setValue('min_running_instances', 1)
setValue('max_running_instances', 2)
}
}

// When switching to no autoscaling (NONE), ensure max equals min
if ((previousMode === 'HPA' || previousMode === 'KEDA') && autoscalingMode === 'NONE') {
if (minRunningInstances !== maxRunningInstances) {
setValue('max_running_instances', minRunningInstances)
}
}

// Set default HPA settings when switching to HPA mode
if (autoscalingMode === 'HPA' && !hpaMetricTypeRaw) {
const hpaSettings = loadHpaSettingsFromAdvancedSettings(advancedSettings)
Expand Down Expand Up @@ -322,7 +330,7 @@ export function ApplicationSettingsResources({
{ label: 'HPA (Horizontal Pod Autoscaler)', value: 'HPA' },
]

if (cloudProvider === 'AWS' && isKedaCluster && isKedaFeatureEnabled) {
if ((cloudProvider === 'AWS' || cloudProvider === 'GCP') && isKedaCluster && isKedaFeatureEnabled) {
options.push({ label: 'KEDA (Event-driven autoscaling)', value: 'KEDA' })
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function ClusterGeneralSettings(props: ClusterGeneralSettingsProps) {
)}
</>
)}
{fromDetail && cloudProvider === 'AWS' && isKedaFeatureEnabled && (
{fromDetail && (cloudProvider === 'AWS' || cloudProvider === 'GCP') && isKedaFeatureEnabled && (
<Controller
name="keda.enabled"
control={control}
Expand Down