From 0953440e39df3a855e705cb3d3067185cdd7a3cc Mon Sep 17 00:00:00 2001 From: Cesar Rodriguez Date: Thu, 19 Nov 2020 21:26:03 -0500 Subject: [PATCH 1/2] fixes gcp cos node image policy --- .../gcp/google_container_node_pool/cosNodeImageUsed.rego | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego b/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego index e427d5ca7..892fde1f1 100755 --- a/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego +++ b/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego @@ -2,6 +2,7 @@ package accurics cosNodeImageUsed[api.id]{ api := input.google_container_node_pool[_] - node := api.config.node_config[_] - node.image_type != "cos" -} \ No newline at end of file + node := api.config.node_config[_] + not startswith(node.image_type, "cos") +} + From be1937543ff65b96fdd6cd9f36810ddf29de3b50 Mon Sep 17 00:00:00 2001 From: Cesar Rodriguez Date: Thu, 19 Nov 2020 22:16:42 -0500 Subject: [PATCH 2/2] makes case agnostic --- .../rego/gcp/google_container_node_pool/cosNodeImageUsed.rego | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego b/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego index 892fde1f1..308bddee8 100755 --- a/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego +++ b/pkg/policies/opa/rego/gcp/google_container_node_pool/cosNodeImageUsed.rego @@ -3,6 +3,5 @@ package accurics cosNodeImageUsed[api.id]{ api := input.google_container_node_pool[_] node := api.config.node_config[_] - not startswith(node.image_type, "cos") + not startswith(lower(node.image_type), "cos") } -