Some more details:

1) Juju has a parser for a subset of the Netplan schema.

During the provisioning stage it will read all the YAML files from
/etc/netplan and merge them like libnetplan does.

If these YAMLs contain valid Netplan configuration that is not part of
Juju's own schema, the provisioner will fail.

Juju's parser seems to implement things that Netplan itself does
support, for example a top level "network.routes" block [1].

Juju can build Netplan configuration in code and then save it back to
disk.

2) The files initially found at /etc/netplan are created by cloud-init

When python3-netplan is not available, cloud-init will create the file
exactly like it was passed to it. This configuration was carefully
crafted so Juju will know how to parse it.

When python3-netplan is available, cloud-init will use it to validate
and emit the YAML. In this case, the YAML file might have settings that
are not supported by Juju. It boils down to the fact that Juju only
implements a subset of Netplan's schema.

3) Possible solutions

a) If this initial YAML file is always created in a controlled way and
it's guaranteed that Juju will not try to parse them anymore (because
any changes could break it), Juju could simply implement the changes
that caused the problem. This should be simple.

That seems to be the better long term solution.

Ideally Juju would use libnetplan to do that, but we don't have a full
set of Go bindings yet.

b) Cloud-init stops using libnetplan to save Juju configuration on
Jammy.

That is an acceptable workaround while we wait until Juju's parser is
fixed but it probably shouldn't be disabled forever.

4) Note about libnetplan

This is not a fix we could do on Netplan. If we change the format of the
YAML emitted be libnetplan it will be yet another regression and might
break something else.


[1] - https://github.com/juju/juju/blob/3.6/network/netplan/netplan.go#L132

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2084444

Title:
  juju can not parse new 50-cloud-init.yaml properly after netplan 0.107
  under 22.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/juju/+bug/2084444/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to