[virtual-machine] fix: specify ports even for wholeIP mode (#1000)

There is an issue with wholeIP services: internal communication from
pods doesn't work as expected.

Cilium intercepts pod-to-pod traffic, preventing cozy-proxy from
rewriting the source IP in return packets.

This PR allows Cilium to handle specified ports, enabling hairpin
traffic to work correctly at least for these cases.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved service port configuration to ensure explicit port
definitions are respected when using the "WholeIP" method. Now, custom
external ports will not be overridden, providing more accurate and
expected service exposure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Andrei Kvapil
2025-05-28 20:53:20 +02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ spec:
selector:
{{- include "virtual-machine.selectorLabels" . | nindent 4 }}
ports:
{{- if eq .Values.externalMethod "WholeIP" }}
{{- if and (eq .Values.externalMethod "WholeIP") (not .Values.externalPorts) }}
- port: 65535
{{- else }}
{{- range .Values.externalPorts }}

View File

@@ -17,7 +17,7 @@ spec:
selector:
{{- include "virtual-machine.selectorLabels" . | nindent 4 }}
ports:
{{- if eq .Values.externalMethod "WholeIP" }}
{{- if and (eq .Values.externalMethod "WholeIP") (not .Values.externalPorts) }}
- port: 65535
{{- else }}
{{- range .Values.externalPorts }}