Skip to content

Commit

Permalink
Merge branch 'main' into cis1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
mikouaj authored Oct 30, 2023
2 parents 22f0110 + 1bdccde commit 00d9299
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions gke-policies-v2/policy/node_pool_use_cos.rego
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ valid {
violation[msg] {
some pool
not lower(input.data.gke.node_pools[pool].config.image_type) in {"cos", "cos_containerd"}
not startswith(lower(input.data.gke.node_pools[pool].config.image_type), "windows")
msg := sprintf("Node pool %q does not use Container-Optimized OS.", [input.data.gke.node_pools[pool].name])
}
4 changes: 4 additions & 0 deletions gke-policies-v2/policy/node_pool_use_cos_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ test_multiple_node_pool_using_cos_but_only_one {

test_multiple_node_pool_using_cos {
valid with input as {"data": {"gke": {"name": "cluster-cos", "node_pools": [{"name": "default", "config": {"image_type": "cos"}},{"name": "custom", "config": {"image_type": "cos_containerd"}}]}}}
}

test_windows_node_pool {
valid with input as {"data": {"gke": {"name": "windows-server", "node_pools": [{"name": "default", "config": {"image_type": "windows-server"}}]}}}
}
1 change: 1 addition & 0 deletions gke-policies/policy/node_pool_use_cos.rego
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ valid {

violation[msg] {
not lower(input.node_pools[pool].config.image_type) in {"cos", "cos_containerd"}
not startswith(lower(input.node_pools[pool].config.image_type), "windows")
msg := sprintf("Node pool %q does not use Container-Optimized OS.", [input.node_pools[pool].name])
}
4 changes: 4 additions & 0 deletions gke-policies/policy/node_pool_use_cos_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ test_multiple_node_pool_using_cos_but_only_one {

test_multiple_node_pool_using_cos {
valid with input as {"name": "cluster-cos", "node_pools": [{"name": "default", "config": {"image_type": "cos"}},{"name": "custom", "config": {"image_type": "cos_containerd"}}]}
}

test_windows_node_pool {
valid with input as {"name": "cluster-windows", "node_pools": [{"name": "default", "config": {"image_type": "windows-server"}}]}
}

0 comments on commit 00d9299

Please sign in to comment.