Skip to content

Commit e6df544

Browse files
committed
[vm] Remove egress restrictions on non-isolated vm
## What this PR does Virtual machines with a public IP have a network policy that explicitly allows them to communicate with the external internet. When created in a non-isolated tenant that has no network policies by default, creating such a policy, instead, **restricts** egress traffic originating from the VM from going anywhere, __except__ the outside internet. Instead of allowing VMs to communicate with the outside internet via a network policy, this patch now adds a label to the VMs by which they will be targetted by Cozystack's default network policies, if such policies exist. When no policies are present, the VM's egress traffic will no longer be policed. Resolves #1601. ### Release note ```release-note [virtual-machine,vm-instance] Remove the egress network policy from virtual machines and govern egress traffic by default network policies instead, resolving the bug in #1601. ``` Signed-off-by: Timofei Larkin <[email protected]>
1 parent 5b96190 commit e6df544

4 files changed

Lines changed: 2 additions & 6 deletions

File tree

‎packages/apps/virtual-machine/templates/service.yaml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ spec:
4949
- port: {{ quote . }}
5050
{{- end }}
5151
{{- end }}
52-
egress:
53-
- toEntities:
54-
- world

‎packages/apps/virtual-machine/templates/vm.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ kind: VirtualMachine
1010
metadata:
1111
name: {{ include "virtual-machine.fullname" . }}
1212
labels:
13+
policy.cozystack.io/allow-external-communication: "true"
1314
{{- include "virtual-machine.labels" . | nindent 4 }}
1415
spec:
1516
running: {{ .Values.running | default "true" }}

‎packages/apps/vm-instance/templates/service.yaml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ spec:
4949
- port: {{ quote . }}
5050
{{- end }}
5151
{{- end }}
52-
egress:
53-
- toEntities:
54-
- world

‎packages/apps/vm-instance/templates/vm.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ kind: VirtualMachine
1010
metadata:
1111
name: {{ include "virtual-machine.fullname" . }}
1212
labels:
13+
policy.cozystack.io/allow-external-communication: "true"
1314
{{- include "virtual-machine.labels" . | nindent 4 }}
1415
spec:
1516
running: {{ .Values.running }}

0 commit comments

Comments
 (0)