Skip to content

Commit 26d0a7a

Browse files
sircthulhuclaude
andcommitted
fix(migration): preserve VM MAC address during virtual-machine to vm-instance migration
Kube-OVN reads MAC address exclusively from the pod annotation ovn.kubernetes.io/mac_address, not from the IP resource spec.macAddress. Without pod-level annotations, migrated VMs receive a new random MAC, breaking OS-level network config that matches by MAC (e.g. netplan). Add a Helm lookup for the Kube-OVN IP resource in the vm-instance chart template. When the IP resource exists, its macAddress and ipAddress are automatically injected as pod annotations. This removes the need for fragile Flux postRenderers on the HelmRelease — the chart itself handles MAC/IP preservation based on actual cluster state. Remove the postRenderers approach from migration 29 since the chart now handles this natively. Co-Authored-By: Claude <[email protected]> Signed-off-by: Kirill Ilin <[email protected]>
1 parent 25f0b91 commit 26d0a7a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • packages/apps/vm-instance/templates

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ spec:
3434
metadata:
3535
annotations:
3636
kubevirt.io/allow-pod-bridge-network-live-migration: "true"
37+
{{- $ovnIPName := printf "%s.%s" (include "virtual-machine.fullname" .) .Release.Namespace }}
38+
{{- $ovnIP := lookup "kubeovn.io/v1" "IP" "" $ovnIPName }}
39+
{{- if $ovnIP }}
40+
ovn.kubernetes.io/mac_address: {{ $ovnIP.spec.macAddress | quote }}
41+
ovn.kubernetes.io/ip_address: {{ $ovnIP.spec.ipAddress | quote }}
42+
{{- end }}
3743
labels:
3844
{{- include "virtual-machine.labels" . | nindent 8 }}
3945
spec:

0 commit comments

Comments
 (0)