Control: Kubernetes clusters created over 90 days ago should be reviewed
Description
Kubernetes clusters created over 90 days ago should be reviewed and deleted if not required.
Usage
Run the control in your terminal:
powerpipe control run digitalocean_thrifty.control.kubernetes_long_runningSnapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run digitalocean_thrifty.control.kubernetes_long_running --shareSteampipe Tables
SQL
select a.urn as resource, date_part('day', now() - created_at), case when status = 'deleted' then 'skip' when date_part('day', now() - created_at) > $1 and status in ('invalid', 'error') then 'alarm' when date_part('day', now() - created_at) > $1 then 'info' else 'ok' end as status, case when status = 'deleted' then ' SKIP' when date_part('day', now() - created_at) > $1 and status in ('invalid', 'error') then a.title || ' instance status is ' || status || ', has been launced for ' || date_part('day', now() - created_at) || ' day(s).' else a.title || ' has been launced for ' || date_part('day', now() - created_at) || ' day(s).' end as reason , b.name as region from digitalocean_kubernetes_cluster a left join digitalocean_region as b on b.slug = a.region_slug;
Params
| Args | Name | Default | Description | Variable |
|---|---|---|---|---|
| $1 | kubernetes_cluster_age_max_days | | The maximum number of days kubernetes clusters are allowed to run. |