/srv/irclogs.ubuntu.com/2021/06/07/#cloud-init.txt

=== cpaelzer_ is now known as cpaelzer
=== cpaelzer_ is now known as cpaelzer
=== rharper_ is now known as rharper
=== milosz_ is now known as milosz
saimshHi all, I am from Azure Linux Escalation Support team and I have a customer who is attempting to implement resolv conf module in custom-data. However, in our endorsed ubuntu 18.04 images,resolv conf is not listed as a module under /etc/cloud/cloud.cfg. Is it ok to manually add it to the config file? and if so, what would be the correct location(20:21
saimshstage) to add it. I am currently testing by adding it under init stage (at the end) 20:21
saimshlooking for some valuable insights. any help is appreciated :)20:21
falcojrsaimsh: when resolv_conf is enabled, it usually goes under "cloud_init_modules" after "update_etc_hosts". They'll also need to add "resolv_conf" to "unverified_modules" since it's not normally enabled for debian/ubuntu20:28
falcojrthis explains why it's not normally enabled20:28
falcojrhttps://cloudinit.readthedocs.io/en/latest/topics/modules.html?highlight=resolv#resolv-conf20:28
saimsh@falcojr this is very helpful. Thank you very much :)20:45
saimshjust to be sure the unverified20:46
saimshoops .. hit enter20:47
saimshjust to be sure the unverified_modules: ['resolv conf'] is the correct syntax to be added to /etc/cloud/cloud.cfg ? Also, this module has a space in between resolv and conf. do we need to use the internal name resolv_conf instead?20:48
falcojrsaimsh: resolv_conf (with the underscore)20:52
saimshregarding the location, i believe we can either add it directly to /etc/cloud/cloud.cfg or within a new file in /etc/cloud/cloud.cfg.d correct?20:53
falcojryes20:53
=== meena6 is now known as meena
falcojrI'm looking at an issue where we're trying to convert a v2 config to something other than netplan21:40
falcojrhttps://paste.ubuntu.com/p/MVKch3Fx2d/21:40
falcojr^ is the debug output from cloud-init devel net-convert 21:40
falcojreverything under "config" is the v2 config that was passed21:41
falcojreverything after is our internal network configuration that the renderers are supposed to use to render their respective configs21:41
falcojrbut it looks like all of the nameserver info has disappeared completely21:42
falcojrwhich is somewhat surprising given how long we've had v2 for now21:42
falcojrrharper or smoser , I noticed both of you fairly involved on a possibly related bug (pad.lv/1750884) , is this just a bug? Or is there a reason we're doing things this way?21:44
blackboxswall I can find/recall is that we used to have v1 config in most places and I know a lot of work&bugs were fixed related to v1 -> v2 network conversion related to handling global DNS in v1 -> device-specific nameservers in v2/netplan.  As you said, this might be a bug in v2 -> internal network_state dns because generally on netplan aware systems we just do passthrough v2 -> netplan output, we really look at internal network_state22:05
blackboxswso trying to map v2 input to internal network_state probably needs tests as well as adding some logic into either NetworkStateInterpreter._v2_common maybe to fix how nameservers are promoted to common internal network_state maybe?22:10
blackboxswfalcojr: FWIW It actually looks like the "command" dict we construct in https://github.com/canonical/cloud-init/blob/master/cloudinit/net/network_state.py#L716 is incorrect because it should be "address" key instead of "addresses" (v1 config is used internally to reprsent network_state)22:19
blackboxswfalcojr: FWIW It actually looks like the "command" dict we construct in https://github.com/canonical/cloud-init/blob/master/cloudinit/net/network_state.py#L716 is incorrect because it should be "address" key instead of "addresses" (v1 config is used internally to represent network_state)22:19
blackboxswwhen I look at what is cobbled together in _v2_common vs what handle_nameserver() expects, the keys don't line up22:19
blackboxswhttps://github.com/canonical/cloud-init/blob/master/cloudinit/net/network_state.py#L529-L530 here 22:20
blackboxswand since no "address" key is in the dict, we skip_broken=True22:20
rharperno bot here for bug expansion ... man 22:28
Xehow do i use cloud-init to run commands before all filesystems are mounted?22:28
rharperXe: cloud-init does not run before local-fs is mounted22:29
rharperbootcmd is the earliest path, but rootfs and /var are required.   22:30
blackboxswrharper: will double check that bug expansion bot ubot5 config w/ paride22:30
rharperfalcojr: re: v2 to other formats we're lacking robust "round-trip" rendering, we have a few of those in unittests, but it's not complete;   there's also some subtle issues with v2 dhcp *and* nameservers; that is, the expectation is that if you've enabled dhcp on your interface, you are getting DNS from your dhcp response ... netplan does have dhcp-overrides which allow users to ignore the DNS or Route reponse from the dhcp server 22:35
rharper... for sure, cloud-init internal network state is not checking if that's set and adjusting whether we keep dns information around to be rendered to something else. 22:35
rharperfalcojr: that said, in the orignal config, the overrides are not in place, so even if the nameserver is set , it's not going to get used as the dhcp client DNS will be used instead (without override). 22:36
rharperthe internal state will also need to account for per-interface dns settings which can be configured in netplan/systemd ;  I believe they can be set in sysconfig (per ifcfg-$IFACE file) but I'm not sure what exactly happens when you have DHCP=yes and NAMESERVERS=XXXX in sysconfig (and I'm sure it's per-distro specific, ie, rhel vs suse likely differ in whether DHCP DNS settings override or are ignored) 22:37
blackboxswrharper: thx for context. falcojr too,    here's a patch (I avoided extra indenting of unchanged lines for clarity of functional changeset)   https://paste.ubuntu.com/p/y5dQQn3FJF/22:40
blackboxswbut basically v2 we need to actually look into each specific device "nameservers" settings and look for "addresses" . We also need to set "address" as the command key we pass into handle_nameserver() as that's the "v1" command the internal state parses22:41
rharperaddresses and search 22:42
blackboxswthat'll kindof help the photonos folks22:42
falcojrcool, thanks for all the help and info 22:43
blackboxswwhen I apply that patch I see the following internal state: line 41-49 https://pastebin.ubuntu.com/p/gMz4Xrr287/22:43
blackboxswusing the same "source" v222:43
falcojrgotcha, that makes sense 22:43

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!