Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mode enum and scale down controls for Compute AutoScaler #247

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
16 changes: 16 additions & 0 deletions plugins/modules/gcp_compute_autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@
type: int
aliases:
- cooldownPeriod
mode:
description:
- Defines operating mode for this policy.
- 'Some valid choices include: "OFF", "ONLY_UP", "ON"'
required: false
default: 'ON'
type: str
version_added: '2.10'
cpu_utilization:
description:
- Defines the CPU utilization policy that allows the autoscaler to scale based
Expand Down Expand Up @@ -381,6 +389,11 @@
do this, create an instance and time the startup process.
returned: success
type: int
mode:
description:
- Defines operating mode for this policy.
returned: success
type: str
cpuUtilization:
description:
- Defines the CPU utilization policy that allows the autoscaler to scale based
Expand Down Expand Up @@ -490,6 +503,7 @@ def main():
min_num_replicas=dict(type='int', aliases=['minReplicas']),
max_num_replicas=dict(required=True, type='int', aliases=['maxReplicas']),
cool_down_period_sec=dict(default=60, type='int', aliases=['cooldownPeriod']),
mode=dict(default='ON', type='str'),
cpu_utilization=dict(type='dict', options=dict(utilization_target=dict(type='str', aliases=['target']))),
custom_metric_utilizations=dict(
type='list',
Expand Down Expand Up @@ -686,6 +700,7 @@ def to_request(self):
u'minNumReplicas': self.request.get('min_num_replicas'),
u'maxNumReplicas': self.request.get('max_num_replicas'),
u'coolDownPeriodSec': self.request.get('cool_down_period_sec'),
u'mode': self.request.get('mode'),
u'cpuUtilization': AutoscalerCpuutilization(self.request.get('cpu_utilization', {}), self.module).to_request(),
u'customMetricUtilizations': AutoscalerCustommetricutilizationsArray(
self.request.get('custom_metric_utilizations', []), self.module
Expand All @@ -700,6 +715,7 @@ def from_response(self):
u'minNumReplicas': self.request.get(u'minNumReplicas'),
u'maxNumReplicas': self.request.get(u'maxNumReplicas'),
u'coolDownPeriodSec': self.request.get(u'coolDownPeriodSec'),
u'mode': self.request.get(u'mode'),
u'cpuUtilization': AutoscalerCpuutilization(self.request.get(u'cpuUtilization', {}), self.module).from_response(),
u'customMetricUtilizations': AutoscalerCustommetricutilizationsArray(
self.request.get(u'customMetricUtilizations', []), self.module
Expand Down
5 changes: 5 additions & 0 deletions plugins/modules/gcp_compute_autoscaler_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@
To do this, create an instance and time the startup process.
returned: success
type: int
mode:
description:
- Defines operating mode for this policy.
returned: success
type: str
cpuUtilization:
description:
- Defines the CPU utilization policy that allows the autoscaler to scale
Expand Down