Skip to content

Commit

Permalink
apply fix for old policies dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ewojtach committed Oct 28, 2023
1 parent 4b29116 commit b315b86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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 b315b86

Please sign in to comment.