turbot/kubernetes_compliance

Query: replicaset_container_kubernetes_dashboard_not_deployed

Usage

powerpipe query kubernetes_compliance.query.replicaset_container_kubernetes_dashboard_not_deployed

Steampipe Tables

SQL

select
coalesce(uid, concat(path, ':', start_line)) as resource,
case
when c ->> 'image' is null or c ->> 'image' = '' then 'ok'
when not pg_typeof(c->>'image') = 'text'::regtype then 'alarm'
when c ->> 'image' = 'kubernetes-dashboard'
or c ->> 'image' = 'kubernetesui'
or labels ->> 'apps' = 'kubernetes-dashboard'
or labels ->> 'k8s-app' = 'kubernetes-dashboard' then 'alarm'
else 'ok'
end as status,
case
when c ->> 'image' is null or c ->> 'image' = '' then c ->> 'name' || ' no image specified.'
when not pg_typeof(c->>'image') = 'text'::regtype then c ->> 'name' || ' image invalid.'
when c ->> 'image' = 'kubernetes-dashboard'
or c ->> 'image' = 'kubernetesui'
or labels ->> 'apps' = 'kubernetes-dashboard'
or labels ->> 'k8s-app' = 'kubernetes-dashboard' then c ->> 'name' || ' kubernetes dashboard deployed.'
else c ->> 'name' || ' kubernetes dashboard not deployed.'
end as reason,
name as replicaset_name
, coalesce(context_name, '') as context_name, namespace, source_type, coalesce(path || ':' || start_line || '-' || end_line, '') as path
from
kubernetes_replicaset,
jsonb_array_elements(template -> 'spec' -> 'containers') as c;

Controls

The query is being used by the following controls: