turbot/steampipe-mod-kubernetes-compliance

Control: Namespaces should be restricted on memory usage with resourceQuota memory limit

Description

Administrators should use resourceQuota memory limit to restrict namespaces memory usage.

Usage

Run the control in your terminal:

powerpipe control run kubernetes_compliance.control.namespace_resource_quota_memory_limit

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run kubernetes_compliance.control.namespace_resource_quota_memory_limit --share

SQL

This control uses a named query:

select
distinct(coalesce(n.uid, concat(n.path, ':', n.start_line))) as resource,
case
when q.spec_hard -> 'limits.memory' is null then 'alarm'
else 'ok'
end as status,
case
when q.spec_hard -> 'limits.memory' is null then n.name || ' do not have ResourceQuota for memory limit.'
else n.name || ' have ResourceQuota for memory limit.'
end as reason
, coalesce(n.context_name, '') as context_name, n.name, n.source_type, coalesce(n.path || ':' || n.start_line || '-' || n.end_line, '') as path
from
kubernetes_namespace n
left join kubernetes_resource_quota q
on n.name = q.namespace;

Tags