feat(query): implements "Beta - Cluster Without Network Policy Support"#7907
Merged
cx-rui-araujo merged 12 commits intoJan 26, 2026
Merged
Conversation
Contributor
…upports_network_policies
…21531_53_ensure_that_the_cni_in_use_supports_network_policies
…upports_network_policies
…upports_network_policies
cx-miguel-dasilva
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Reason for Proposed Changes
Currently there is no query to ensure that a "google_container_cluster" resource allows support for a network policy.
Quoting CIS_Google_Kubernetes_Engine_(GKE)_Benchmark_v1.9.0 page 64: "
There are a variety of CNI plugins available for Kubernetes. If the CNI in use does not support Network Policies it may not be possible to effectively restrict traffic in the cluster.Proposed Changes
Implemented the missing query.
The remediation suggested in the Benchmark helps bridge the gap between CNI plugins and their compatibility with network policies and what we must actually check in the terraform IaC samples : "
To use a CNI plugin with Network Policy, enable Network Policy in GKE, and the CNI plugin will be updated."To ensure a given "google_container_cluster" resource supports use of a "network policy" it must be setup with the "network_policy.enabled" field set to true. The documentation seems to imply changing the "network_policy.provider" field can be done without the need to recreate the cluster whilst the "enabled" field would require said re creation.
With this the query will flag the target "google_container_cluster" if it:
true(since "enabled" is a required field the scenario of it missing was not included in the tests)I submit this contribution under the Apache-2.0 license.