Control: GKE clusters network policy should be enabled
Description
This control ensures that GKE clusters network policy is enabled.
Usage
Run the control in your terminal:
powerpipe control run gcp_compliance.control.kubernetes_cluster_network_policy_enabled
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run gcp_compliance.control.kubernetes_cluster_network_policy_enabled --share
SQL
This control uses a named query:
select self_link resource, case when (addons_config -> 'NetworkPolicyConfig' ->> 'disabled' = 'true' or addons_config -> 'NetworkPolicyConfig' -> 'enabled' is null or addons_config -> 'NetworkPolicyConfig' ->> 'enabled' = 'false' ) and network_config ->> 'DatapathProvider' <> 'ADVANCED_DATAPATH' then 'alarm' else 'ok' end as status, case when (addons_config -> 'NetworkPolicyConfig' ->> 'disabled' = 'true' or addons_config -> 'NetworkPolicyConfig' -> 'enabled' is null or addons_config -> 'NetworkPolicyConfig' ->> 'enabled' = 'false' ) and network_config ->> 'DatapathProvider' <> 'ADVANCED_DATAPATH' then title || ' network policy disabled.' else title || ' network policy enabled.' end as reason , location as location, project as projectfrom gcp_kubernetes_cluster;