forked from cloud-custodian/cloud-custodian
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gcp - add autoscalers resource, actions, docs (cloud-custodian#4538)
- Loading branch information
1 parent
9b263e6
commit 64535c8
Showing
13 changed files
with
1,526 additions
and
942 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Compute Engine - Enforce minimal CPU utilization target for autoscalers | ||
======================================================================= | ||
|
||
In the example below, the policy checks the CPU utilization target of newly added autoscalers and modifies it when needed | ||
guaranteeing the target won't be less than 80%. | ||
|
||
.. code-block:: yaml | ||
vars: | ||
min-utilization-target: &min-utilization-target 0.8 | ||
policies: | ||
- name: gcp-autoscalers-enforced | ||
resource: gcp.autoscaler | ||
mode: | ||
type: gcp-audit | ||
methods: | ||
- v1.compute.autoscalers.insert | ||
filters: | ||
- type: value | ||
key: autoscalingPolicy.cpuUtilization.utilizationTarget | ||
op: less-than | ||
value: *min-utilization-target | ||
actions: | ||
- type: set | ||
cpuUtilization: | ||
utilizationTarget: 0.8 |
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,36 @@ | ||
{ | ||
"protoPayload": { | ||
"@type": "type.googleapis.com/google.cloud.audit.AuditLog", | ||
"authenticationInfo": { | ||
"principalEmail": "[email protected]" | ||
}, | ||
"requestMetadata": { | ||
"callerIp": "86.57.255.94", | ||
"callerSuppliedUserAgent": "Mozilla/5.0" | ||
}, | ||
"serviceName": "compute.googleapis.com", | ||
"methodName": "v1.compute.autoscalers.insert", | ||
"resourceName": "projects/mitrop-custodian/zones/us-central1-a/autoscalers/instance-group-1", | ||
"request": { | ||
"@type": "type.googleapis.com/compute.autoscalers.insert" | ||
} | ||
}, | ||
"insertId": "-usokkzd2z2q", | ||
"resource": { | ||
"type": "gce_autoscaler", | ||
"labels": { | ||
"project_id": "mitrop-custodian", | ||
"location": "us-central1-a", | ||
"autoscaler_id": "5429453110968806653" | ||
} | ||
}, | ||
"timestamp": "2019-08-01T11:50:44.355Z", | ||
"severity": "NOTICE", | ||
"logName": "projects/mitrop-custodian/logs/cloudaudit.googleapis.com%2Factivity", | ||
"operation": { | ||
"id": "operation-1564660241223-58f0cd9df4f28-a10f4a9b-180f61fb", | ||
"producer": "compute.googleapis.com", | ||
"last": true | ||
}, | ||
"receiveTimestamp": "2019-08-01T11:50:44.900727394Z" | ||
} |
37 changes: 37 additions & 0 deletions
37
...pute-v1-projects-mitrop-custodian-zones-us-central1-a-autoscalers-instance-group-1_1.json
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,37 @@ | ||
{ | ||
"body": { | ||
"status": "ACTIVE", | ||
"kind": "compute#autoscaler", | ||
"target": "https://www.googleapis.com/compute/v1/projects/mitrop-custodian/zones/us-central1-a/instanceGroupManagers/instance-group-1", | ||
"zone": "https://www.googleapis.com/compute/v1/projects/mitrop-custodian/zones/us-central1-a", | ||
"autoscalingPolicy": { | ||
"maxNumReplicas": 10, | ||
"cpuUtilization": { | ||
"utilizationTarget": 0.6 | ||
}, | ||
"minNumReplicas": 1, | ||
"coolDownPeriodSec": 60 | ||
}, | ||
"creationTimestamp": "2019-08-01T04:50:42.846-07:00", | ||
"id": "5429453110968806653", | ||
"selfLink": "https://www.googleapis.com/compute/v1/projects/mitrop-custodian/zones/us-central1-a/autoscalers/instance-group-1", | ||
"name": "instance-group-1" | ||
}, | ||
"headers": { | ||
"status": "200", | ||
"content-length": "710", | ||
"x-xss-protection": "0", | ||
"content-location": "https://www.googleapis.com/compute/v1/projects/mitrop-custodian/zones/us-central1-a/autoscalers/instance-group-1?alt=json", | ||
"x-content-type-options": "nosniff", | ||
"transfer-encoding": "chunked", | ||
"vary": "Origin, X-Origin, Referer", | ||
"server": "ESF", | ||
"etag": "U3Hub-fnYwxz_B40C0r-WLK-ITk=/AhL5qFuurUay6pe6bo2RDy7W_uM=", | ||
"cache-control": "private", | ||
"date": "Thu, 01 Aug 2019 12:41:57 GMT", | ||
"x-frame-options": "SAMEORIGIN", | ||
"alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43,39\"", | ||
"content-type": "application/json; charset=UTF-8", | ||
"-content-encoding": "gzip" | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...ts/autoscaler-query/get-compute-v1-projects-cloud-custodian-aggregated-autoscalers_1.json
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,49 @@ | ||
{ | ||
"body": { | ||
"items": { | ||
"zones/us-central1-a": { | ||
"autoscalers": [ | ||
{ | ||
"status": "ACTIVE", | ||
"kind": "compute#autoscaler", | ||
"target": "https://www.googleapis.com/compute/v1/projects/cloud-custodian/zones/us-central1-a/instanceGroupManagers/micro-instance-group-1-to-10", | ||
"zone": "https://www.googleapis.com/compute/v1/projects/cloud-custodian/zones/us-central1-a", | ||
"autoscalingPolicy": { | ||
"maxNumReplicas": 10, | ||
"cpuUtilization": { | ||
"utilizationTarget": 0.6 | ||
}, | ||
"minNumReplicas": 1, | ||
"coolDownPeriodSec": 60 | ||
}, | ||
"creationTimestamp": "2019-06-10T07:56:43.615-07:00", | ||
"id": "3503520257074778436", | ||
"selfLink": "https://www.googleapis.com/compute/v1/projects/cloud-custodian/zones/us-central1-a/autoscalers/micro-instance-group-1-to-10", | ||
"name": "micro-instance-group-1-to-10" | ||
} | ||
] | ||
} | ||
}, | ||
"kind": "compute#autoscalerAggregatedList", | ||
"id": "projects/cloud-custodian/aggregated/autoscalers", | ||
"selfLink": "https://www.googleapis.com/compute/v1/projects/cloud-custodian/aggregated/autoscalers" | ||
}, | ||
"headers": { | ||
"status": "200", | ||
"content-length": "22703", | ||
"x-xss-protection": "1; mode=block", | ||
"content-location": "https://www.googleapis.com/compute/v1/projects/cloud-custodian/aggregated/autoscalers?alt=json", | ||
"x-content-type-options": "nosniff", | ||
"transfer-encoding": "chunked", | ||
"expires": "Mon, 10 Jun 2019 15:30:40 GMT", | ||
"vary": "Origin, X-Origin", | ||
"server": "GSE", | ||
"-content-encoding": "gzip", | ||
"etag": "\"MrcvN7ChCTB9ru9NDAWX9W-A0rg=/XvUjxb2s6a37Q0G7NF3Qbxv0tik=\"", | ||
"cache-control": "private, max-age=0, must-revalidate, no-transform", | ||
"date": "Mon, 10 Jun 2019 15:30:40 GMT", | ||
"x-frame-options": "SAMEORIGIN", | ||
"alt-svc": "quic=\":443\"; ma=2592000; v=\"46,44,43,39\"", | ||
"content-type": "application/json; charset=UTF-8" | ||
} | ||
} |
Oops, something went wrong.