import { set } from 'lodash'; import * as React from 'react'; import { CheckboxInput, HelpField, NumberInput } from '@spinnaker/core'; import type { IUpsertScalingPolicyCommand } from '../ScalingPolicyWriter'; import './TargetTrackingAdditionalSettings.less'; export interface ITargetTrackingAdditionalSettingsProps { command: IUpsertScalingPolicyCommand; cooldowns?: boolean; policyName?: string; updateCommand: (command: IUpsertScalingPolicyCommand) => void; } export const TargetTrackingAdditionalSettings = ({ command, cooldowns, policyName, updateCommand, }: ITargetTrackingAdditionalSettingsProps) => { const setCommandField = (path: string, value: number) => { const newCommand = { ...command }; set(newCommand, path, value); updateCommand(newCommand); }; const scaleInDisabled = command.targetTrackingConfiguration?.disableScaleIn; return (
{policyName && (
Policy Name
{policyName}
)} {Boolean(command.estimatedInstanceWarmup) && (
Warmup
Instances need setCommandField('estimatedInstanceWarmup', Number.parseInt(e.target.value))} inputClassName="form-control number-input-sm sp-margin-xs-xaxis" /> seconds to warm up
)}
Scale In
setCommandField('targetTrackingConfiguration.disableScaleIn', e.target.checked)} />

This option disables scale-downs for the target tracking policy, while keeping the scale-ups. This means that ASG will not scale down unless you explicitly set up a separate step policy to scale it down.

This is useful when you have special requirements, such as gradual or delayed scale-down.

{scaleInDisabled && (
This policy will not scale down. Make sure you have another policy (either TT or Step) that will scale down this ASG.
)} {scaleInDisabled === false && (
This policy will scale both up and down. Make sure you don't have other scaling policies, as they will likely interfere with each other.
)}
{cooldowns && !scaleInDisabled && (
Scale In Cooldown
setCommandField('targetTrackingConfiguration.scaleInCooldown', Number.parseInt(e.target.value)) } inputClassName="sp-margin-xs-xaxis number-input-sm" /> seconds
)} {cooldowns && (
Scale Out Cooldown
setCommandField('targetTrackingConfiguration.scaleOutCooldown', Number.parseInt(e.target.value)) } inputClassName="sp-margin-xs-xaxis number-input-sm" /> seconds
)}
); };