-
Notifications
You must be signed in to change notification settings - Fork 119
[virtual-machine] fix: specify ports even for wholeIP mode #1000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
WalkthroughThe logic for configuring service ports in two YAML templates was updated. Now, when the Changes
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/apps/vm-instance/templates/service.yaml (1)
20-28
: Duplicate port-override logic—extract into a shared helper
This ports block is identical to the one invirtual-machine/templates/service.yaml
. To reduce duplication and simplify future maintenance, you might extract it into a named template, for example:{{- define "vm.ports" -}} {{- if and (eq .Values.externalMethod "WholeIP") (empty .Values.externalPorts) }} - port: 65535 {{- else }} {{- range .Values.externalPorts }} - name: port-{{ . }} port: {{ . }} targetPort: {{ . }} {{- end }} {{- end }} {{- end }}
Then invoke it in both service manifests:
ports: {{ include "vm.ports" . | nindent 2 }}
🧹 Nitpick comments (1)
packages/apps/virtual-machine/templates/service.yaml (1)
20-28
: Respect explicitexternalPorts
in WholeIP mode
The updated conditional correctly prevents defaulting to port65535
when.Values.externalPorts
is defined (even if empty lists are treated as false). This aligns perfectly with the PR objective to honor explicit port definitions underWholeIP
.
Consider using the Sprigempty
function for improved readability and to clearly convey intent:- {{- if and (eq .Values.externalMethod "WholeIP") (not .Values.externalPorts) }} + {{- if and (eq .Values.externalMethod "WholeIP") (empty .Values.externalPorts) }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/apps/virtual-machine/templates/service.yaml
(1 hunks)packages/apps/vm-instance/templates/service.yaml
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Build and Test
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.
Summary by CodeRabbit