You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 403e5fd
Browse filesBrowse the repository at this point in the historyBrowse files
fix(vm-instance): make the netplan network-data opt-in
Keying the network-data on instanceProfile reached every VM that never
set the field, because the profile defaults to ubuntu whatever image
the disk holds. The sysconfig, NetworkManager and eni renderers turn
each match stanza into an interface literally named after the netplan
ID, so a non-netplan guest left on the default profile would lose the
DHCP it gets today. A VM with neither cloudInit nor sshKeys would also
gain a cloud-init disk on upgrade, and KubeVirt's NoCloud instance-id
is new to that guest, so its next boot would regenerate host keys as a
first boot.
The configuration also shadows a static NIC set up through netplan:
netplan emits one networkd file per ID, networkd applies only the first
file in lexical order that matches a link, and 10-netplan-cozy-en sorts
before the file for enp2s0. The external-VLAN recipe claimed otherwise.
An explicit netplanDhcp value, off by default, leaves every existing
VM rendering exactly as before and lets the documentation say when not
to turn it on.
Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <[email protected]>
Copy file name to clipboardExpand all lines: docs/vm-external-vlan.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,7 +112,7 @@ spec:
112
112
113
113
## Step 3 — Attach the VM and assign a static address
114
114
115
-
Reference the NAD by name in the `vm-instance` values. The chart's own `networkData` only asks every ethernet for DHCP, and this VLAN has no DHCP server, so the static address goes into cloud-init `userData` (`cloudInit`), written by the guest at first boot:
115
+
Reference the NAD by name in the `vm-instance` values. This VLAN has no DHCP server, so the static address goes into cloud-init `userData` (`cloudInit`), written by the guest at first boot, and `netplanDhcp` stays off (see [Gotchas](#gotchas)):
116
116
117
117
```yaml
118
118
# vm-instance values
@@ -145,7 +145,7 @@ The VM ends up with two interfaces: the always-present **pod-network** NIC (`def
145
145
## Gotchas
146
146
147
147
- **VMs are dual-homed.** The `vm-instance` chart always adds the pod-network NIC in addition to any `networks` you declare; there is no single-homed (VLAN-only) option today. Address the VLAN NIC inside the guest and leave the pod NIC to the cluster.
148
-
- **`networkData` is the chart's, not yours.** For a guest whose `instanceProfile` is `ubuntu` or `debian` the chart supplies its own cloud-init network-data, asking every `en*` and `eth*` interface for DHCP, and there is no value that replaces it. It does not conflict with the recipe above — netplan merges `/etc/netplan/*.yaml`, and a higher-numbered file wins — but a static address still has to come from `userData`, as above.
148
+
- **Leave `netplanDhcp` off on a VM with a static NIC.** `netplanDhcp: true` makes the chart supply cloud-init network-data that asks every `en*` and `eth*` interface for DHCP, under the netplan IDs `cozy-en` and `cozy-eth`. Netplan writes one networkd file per ID, and systemd-networkd applies only the first `.network` file in lexical order that matches a link, so `10-netplan-cozy-en.network` shadows the `10-netplan-enp2s0.network` the recipe above produces and the static address is never applied, whatever number the recipe's netplan file carries. The key is off by default and is meant for guests whose every interface takes its address over DHCP, such as a VM on a VPC subnet.
149
149
- **MAC changes on VM re-creation.** KubeVirt generates a fresh guest MAC each time the VM object is re-created, and `vm-instance` exposes no way to pin it, so re-creating a VM changes its MAC. The upstream gateway then holds a stale ARP entry for the old MAC for a few minutes, so "gateway unreachable" immediately after re-creating a VM is expected — wait for the ARP entry to age out (~5 min) rather than treating it as a fault.
150
150
- **Host ↔ VM traffic.** If the host must talk to the VMs (a proxy, a health check), give the bridge a host address on the VLAN (step 1) — traffic through a bare VLAN sub-interface to bridge-attached guests will not work the way `macvlan` users expect.
Copy file name to clipboardExpand all lines: packages/apps/vm-instance/values.schema.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -220,6 +220,11 @@
220
220
"type": "string",
221
221
"default": ""
222
222
},
223
+
"netplanDhcp": {
224
+
"description": "Supply cloud-init network-data that requests DHCP on every `en*` and `eth*` interface and keeps the DNS search domains DHCP offers. Needed for a netplan guest (Ubuntu, Debian) to address a secondary network such as a VPC subnet. Leave it off for a guest rendered by anything other than netplan, which would lose DHCP on every interface, and for a guest that configures an interface statically through netplan, which this configuration would shadow. Turning it on for a VM that has neither `cloudInit` nor `sshKeys` adds a cloud-init disk, and the guest's next boot is then treated as a first boot.",
225
+
"type": "boolean",
226
+
"default": false
227
+
},
223
228
"cloudInitSeed": {
224
229
"description": "Seed string to generate SMBIOS UUID for the VM.",
Copy file name to clipboardExpand all lines: packages/apps/vm-instance/values.yaml
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,9 @@ cloudInit: ""
115
115
## chpasswd: { expire: False }
116
116
##
117
117
118
+
## @param {bool} netplanDhcp - Supply cloud-init network-data that requests DHCP on every `en*` and `eth*` interface and keeps the DNS search domains DHCP offers. Needed for a netplan guest (Ubuntu, Debian) to address a secondary network such as a VPC subnet. Leave it off for a guest rendered by anything other than netplan, which would lose DHCP on every interface, and for a guest that configures an interface statically through netplan, which this configuration would shadow. Turning it on for a VM that has neither `cloudInit` nor `sshKeys` adds a cloud-init disk, and the guest's next boot is then treated as a first boot.
119
+
netplanDhcp: false
120
+
118
121
## @param {string} cloudInitSeed - Seed string to generate SMBIOS UUID for the VM.
0 commit comments