turbot/digitalocean_thrifty

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_running

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run digitalocean_thrifty.control.kubernetes_long_running --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1kubernetes_cluster_age_max_days
90
The maximum number of days kubernetes clusters are allowed to run.

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;

Tags