-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(google): add predictive autoscaling support (#8495)
* feat(google): add feature flag for predictive autoscaling * refactor(google): move autoscaling policy interfaces and layout components to autoscalingPolicy directory Currently, the only Typescript/React components of the autoscaling policy modal are specific to the scale-in control feature. In the next commit, we will add support for predictive autoscaling, so in order to share these interfaces and layout components, lift them to the top level. * feat(google): add predictive autoscaling support (add/edit policy modal) * feat(google): add predictive autoscaling support (SG details view) * fix(google): sp/scaleDownInConfigured/scaleInControlsConfigured I think we missed one spot when we renamed scale-in to scale-down. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a6f9bc0
commit 0be2a84
Showing
14 changed files
with
109 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/scripts/modules/google/src/autoscalingPolicy/IGceAutoscalingPolicy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export interface IGceAutoscalingPolicy { | ||
cpuUtilization: IGceAutoscalingCpuUtilization; | ||
scaleInControl: IGceScaleInControl; | ||
} | ||
|
||
export interface IGceScaleInControl { | ||
maxScaledInReplicas?: { | ||
fixed?: number; | ||
percent?: number; | ||
}; | ||
timeWindowSec?: number; | ||
} | ||
|
||
export interface IGceAutoscalingCpuUtilization { | ||
predictiveMethod?: GcePredictiveMethod; | ||
utilizationTarget?: number; | ||
} | ||
|
||
export enum GcePredictiveMethod { | ||
NONE = 'NONE', | ||
STANDARD = 'STANDARD', | ||
} |
53 changes: 53 additions & 0 deletions
53
...dules/google/src/autoscalingPolicy/components/metricSettings/GcePredictiveAutoscaling.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { module } from 'angular'; | ||
|
||
import React from 'react'; | ||
import { react2angular } from 'react2angular'; | ||
|
||
import { CheckboxInput, FormField, HelpField, IFormInputProps, LayoutProvider } from '@spinnaker/core'; | ||
|
||
import { GceAutoScalingFieldLayout } from '../../GceAutoScalingFieldLayout'; | ||
import { IGceAutoscalingPolicy, GcePredictiveMethod } from '../../IGceAutoscalingPolicy'; | ||
import { GCEProviderSettings } from '../../../gce.settings'; | ||
|
||
interface IGcePredictiveAutoscalingProps { | ||
policy: IGceAutoscalingPolicy; | ||
updatePolicy: (policy: IGceAutoscalingPolicy) => void; | ||
} | ||
|
||
function GcePredictiveAutoscaling({ policy, updatePolicy }: IGcePredictiveAutoscalingProps) { | ||
if (!GCEProviderSettings.feature.predictiveAutoscaling) { | ||
return null; | ||
} | ||
|
||
function togglePredictiveAutoscaling(predictiveMethod: GcePredictiveMethod) { | ||
updatePolicy({ | ||
...policy, | ||
cpuUtilization: { | ||
...policy.cpuUtilization, | ||
predictiveMethod, | ||
}, | ||
}); | ||
} | ||
|
||
return ( | ||
<LayoutProvider value={GceAutoScalingFieldLayout}> | ||
<div className="row"> | ||
<FormField | ||
help={<HelpField id="gce.serverGroup.scalingPolicy.predictiveAutoscaling" />} | ||
input={(inputProps: IFormInputProps) => <CheckboxInput {...inputProps} />} | ||
label="Enable predictive autoscaling" | ||
onChange={(e: React.ChangeEvent<any>) => { | ||
togglePredictiveAutoscaling(e.target.checked ? GcePredictiveMethod.STANDARD : GcePredictiveMethod.NONE); | ||
}} | ||
value={policy?.cpuUtilization?.predictiveMethod === GcePredictiveMethod.STANDARD} | ||
/> | ||
</div> | ||
</LayoutProvider> | ||
); | ||
} | ||
|
||
export const GCE_PREDICTIVE_AUTOSCALING = 'spinnaker.gce.predictiveAutoscaling'; | ||
module(GCE_PREDICTIVE_AUTOSCALING, []).component( | ||
'gcePredictiveAutoscaling', | ||
react2angular(GcePredictiveAutoscaling, ['policy', 'updatePolicy']), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...alingPolicy/modal/gceScaleInControls.less → ...lingPolicy/gceAutoscalingFieldLayout.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './IGceAutoscalingPolicy'; | ||
export * from './GceAutoScalingFieldLayout'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters