Skip to content

Commit 7b392cc

Browse files
committed
PLAT-1431 Added docs for harvester-restricted-network-vm
1 parent 2b871ec commit 7b392cc

File tree

2 files changed

+85
-51
lines changed

2 files changed

+85
-51
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
image:https://github.com/kubewarden/community/blob/main/badges/kubewarden-policies.svg[Kubewarden Policy Repository, link=https://github.com/kubewarden/community/blob/main/REPOSITORIES.md#policy-scope]
2+
image:https://img.shields.io/badge/status-stable-brightgreen?style=for-the-badge[Stable, link=https://github.com/kubewarden/community/blob/main/REPOSITORIES.md#stable]
3+
4+
== harvester-restricted-network-vm
5+
6+
This policy protects shared Istio Gateway resources by watching changes to VirtualService resources.
7+
For configured Gateway resources, it will ensure that VirtualService resources are correctly configured.
8+
9+
This policy protects Harvester VM networks, by specifying which namespaces are allowed.
10+
11+
=== Settings
12+
13+
|===
14+
| Field | Description
15+
16+
| namespaceNetworkBindings
17+
18+
map[string, link:#settingsNamespaceNetworkBinding[Namespace Network Binding]] | A map of namespace network bindings.
19+
|===
20+
21+
[[settingsNamespaceNetworkBinding]]
22+
==== Namespace Network Binding
23+
24+
|===
25+
| Field | Description
26+
27+
| namespaces
28+
29+
string | The namespace.
30+
31+
| network
32+
33+
string | The Harvester VM Network in the format `namespace/network-name`.
34+
|===
35+
36+
=== Specifications
37+
38+
1. You should be able to create a VM with any of the specified combinations of namespace and network.
39+
2. You should not be able to create a VM from any namespace or network that is in the settings, but the exact combination is not in the settings.
40+
3. Any namespace or network that is not on the settings is not restricted
41+
42+
=== Example
43+
44+
[source, yaml]
45+
----
46+
apiVersion: policies.kubewarden.io/v1
47+
kind: ClusterAdmissionPolicy
48+
metadata:
49+
name: restricted-network-vm-policy-1
50+
spec:
51+
module: registry://ghcr.io/suse/openplatform-kubewarden-policies/harvester-restricted-network-vm:latest
52+
rules:
53+
- apiGroups: ["kubevirt.io"]
54+
apiVersions: ["v1"]
55+
resources: ["virtualmachines"]
56+
operations: ["CREATE", "UPDATE"]
57+
settings:
58+
namespaceNetworkBindings:
59+
- namespace: test-restricted-1-network-1
60+
network: test-restricted-1-network-1/network-1
61+
- namespace: test-restricted-2-network-1
62+
network: test-restricted-1-network-1/network-1
63+
- namespace: test-restricted-3-network-3
64+
network: test-restricted-3-network-3/network-3
65+
mutating: false
66+
policyServer: default
67+
----
68+
69+
Here would be the result of the above policy.
70+
71+
|===
72+
| namespace | network | Result
73+
74+
| test-restricted-1-network-1 | test-restricted-1-network-1/network-1 | ALLOW
75+
| test-restricted-2-network-1 | test-restricted-1-network-1/network-1 | ALLOW
76+
| test-restricted-3-network-3 | test-restricted-3-network-3/network-3 | ALLOW
77+
| random-namespace | random-network | ALLOW
78+
| test-restricted-3-network-3 | test-restricted-1-network-1/network-1 | REJECT
79+
| test-restricted-1-network-1 | test-restricted-3-network-3/network-3 | REJECT
80+
| random-namespace | test-restricted-1-network-1/network-1 | REJECT
81+
| random-namespace | test-restricted-3-network-3/network-3 | REJECT
82+
| test-restricted-1-network-1 | random-network | REJECT
83+
| test-restricted-2-network-2 | random-network | REJECT
84+
| test-restricted-3-network-3 | random-network | REJECT
85+
|===

policies/harvester-restricted-network-vm/README.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)