cloud-init: prefer netplan to handle all network manager config

Cloud-init cannot write directly to
/etc/NetworkManager/system-connections because subiquity may
need to emit config to /etc/netplan/00-installer.yaml and call
netplan apply for autoinstall.network use-cases.

When cloud-init's config is written directly to
/etc/NetworkManager, neither netplan nor subiquity has knowledge of
this config and this results in namespace collisions in NetworkManager
due to `netplan-` named connections and `cloud-init` connection ids
fighting over which config own a given interface name.

Deleting this config overlay allows subiquity to manage all network
setup when it needs to with netplan directly.

Subiquity already has logic to rename any unwanted netplan
configuration when it intends to write cfg and run netplan apply[1].
This should allow subiquity full control of network config when needed.

[1] https://github.com/canonical/subiquity/blob/
    92ac6544cdfedfd332d8cd94dbcfad0aab994575/subiquitycore/
        controllers/network.py#L267

LP: #2015605
fix-netboot-tarballs
Chad Smith 2 years ago
parent fce09c0e05
commit 9a82720f1c

@ -1008,17 +1008,18 @@ network:
version: 2 version: 2
renderer: NetworkManager renderer: NetworkManager
EOF EOF
# Do not limit cloud-init renderers to network-manager as suggested
# inform cloud-init of the same (LP: #1982855) # in LP: #1982855 because subiquity needs to render full networking
mkdir -p chroot/etc/cloud/cloud.cfg.d # in ephemeral boot time when autoinstall.network is provided.
cat <<EOF > chroot/etc/cloud/cloud.cfg.d/99-installer-use-networkmanager.cfg # Neither subiquity nor netplan is aware of /etc/NetworkManager config
${AUTOMATION_HEADER} # artifacts emmitted by cloud-init. It's best if cloud-init reports
# Let NetworkManager manage all devices on this system # network config directly to /etc/netplan with the configured netplan
system_info: # backend: NetworkManager per 01-network-manager-all.yaml above.
network:
renderers: ['network-manager'] # cloud-init's default renderer discovery will prefer netplan.
activators: ['network-manager'] # Any time subiquity needs to write and apply network config
EOF # it disables all previous network config in /etc/netplan so
# any previous 50-cloud-init.yaml will be rendered inert.
# Position cloud-init.service After=NetworkManager.service. # Position cloud-init.service After=NetworkManager.service.
# (LP: #2008952). # (LP: #2008952).

Loading…
Cancel
Save