/srv/irclogs.ubuntu.com/2018/03/21/#cloud-init.txt

smoserblackboxsw: merged your branch uploaded to bionic02:03
blackboxswthanks smoser02:10
smoserand /me is out.02:13
march__Hello #cloud-init09:23
march__I'm looking for a way to disable a specific service to start. Basically my service is not provisioned yet and I want to delay the service start after custom script execution09:24
march__maybe with bootcmd and systemctl disable09:55
=== daniel is now known as Guest77671
=== Guest77671 is now known as Odd_Bloke
danmcdI've a silly question, and I'm happy to take doc pointers as an answer.18:33
danmcdI'm in charge of a DataSource.  I have something new:   "routes" to provide.18:34
danmcd<prefix, dst, linklocal>18:34
danmcdprefix and dst should be straightforward.  "linklocal" is what indicates if this is an "interface route".18:35
danmcdIf I turned those tuples into route(1M/8) commands, e.g.:18:35
danmcd<10.1.2.0/24 10.1.1.1, false> ==> route add 10.1.2.0/24 10.1.1.118:35
danmcd<10.51.50.0/24, 10.1.1.5, true> ==> route add -interface 10.51.50.0/24 10.1.1.518:36
danmcd(And 10.1.1.5 damned well better be your local IP.)18:36
danmcdHow would a DataSource feed such information up to its consumer in cloud-init?18:37
rharperdanmcd: which datasource are you using ?18:50
danmcdSmartOS.  I'm trying to modify it to turn the tuples I mention into something nice for cloud-init.18:51
rharperah18:51
danmcdhttp://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v1.html#route18:51
rharperso smartos has a helper to convert the sdc:nics info18:51
danmcdnot sdc:nics.18:51
danmcdsdc:routes18:51
danmcdWhich correspond, I think, to the cloud-init concept whose documentation I linked to above.18:51
rharperthere are two places to set routes in the v1 config;  there is the top-level type: route which has gateway,network;  or each subnet entry under an interface can accept a routes list18:53
rharperthose end up in /etc/network/interfaces as post-{up/down} route commands18:53
danmcdNo way to specify interface routes then?18:54
rharperthere is, if you hang the routes under the interface subnets configuration18:54
danmcdOkay.18:54
danmcdWait..18:58
danmcdLet me gist something...18:58
danmcdhttps://gist.github.com/danmcd/15a9bdeadbfb1bfbc018fa293a1af26b18:59
danmcdIt's still not obvious whether or not I can add an interface route.19:00
danmcdThe pointed examples where I'm shouting.... it's not clear from the documentation that's allowed.19:01
rharperwe don't explicitly add the -interface, those stanzas result in a route add -net <network> gw  <gateway>19:01
danmcdSo if I want to add -interface routes, what do I do?19:03
rharperwe don't have a way to add the -interface19:04
danmcdTHere's something about outputting scripts... do I just hack that in there?19:05
rharperyou can certainly have a script run that19:05
danmcdOkay.  THank you.19:05
danmcdFor your time & patience.  :)19:06
rharpernp, on the -interface vs. the -net gw  ; does that generate a different static route ?19:06
danmcdYes.19:07
danmcd-interface is essentially:  "Hey, ARP these destinations".19:07
danmcdOr "NDP these" if it's IPv6.19:07
danmcdYou can't have both with a matching prefix, it's one or the other.19:08
rharperdanmcd: hrm, ok;  I need to read more;19:09
danmcdI hear you...19:09
rharperI suspect we can file a bug to track this is missing;19:09
danmcdSure.19:10
rharperI think this might be a BSD thing in route?  net-tools on linux route doesn't have a -interface parameter19:12
danmcd-interface originates from 4.3BSD yes...19:14
rharperdanmcd: you might try the syntax you gist'ed and see what route you end up with;  the gw value is used to determine which interface to us, the man page mentions this is a BSDism ;  so I wonder if that's equivalent ?19:17
danmcdMaybe.19:17
danmcdFinding out locally.  Thank you.19:17
rharperyw19:17
danmcdYes, BTW, "route add -net <pfx> -gw <my-local-ip>" is like "route add -interfaces <pfx> <my-local-ip>" on BSD and illumos.19:25
smoserblackboxsw: https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/34185119:27
smosercan you give that a review ?19:27
blackboxswnp smoser19:39
=== pickle is now known as dhill_
AscIIcloud-init generates a strange/broken netplan config if the ipv6 gateway is a link local address19:49
AscIIhttps://paste.ubuntu.com/p/M7Yd4vvSS5/19:49
AscIIif I remove the routes section, everything works as expected19:51
AscIIthis route section also triggers the following warning19:53
AscII (generate:666): GLib-WARNING **: 18:19:49.916: GError set over the top of a previous GError or uninitialized memory.19:53
AscIIin case of v1, I get19:54
AscII post-up route add -net :: netmask 0 gw fe80::1%eth0 || true19:55
AscIIwhich doesn't hur19:55
AscIIt19:55
AscIIAny idea how to disable these extra routes?19:56
AscIIotherwise the newly added Hetzner datasource works in the official bionic images19:58
AscII(which seem to have a broken protective MBR)19:58
AscIIsmoser: thanks for the merge, btw19:58
smoserAscII: /me is embarassed though20:03
smoseri stole your credit with our merge tool20:03
smoser:-(20:03
smoseri'm apt to stuff a commit message in with your name proper.20:04
smoserthe squash took the top-most author20:04
AscIIoh well20:05
smoserAscII: can you give the input ?20:05
smoserAscII: the only good thing about someone steeling your credit is that they get blame if theere are bugs :)20:06
smoseri'm really sorry that happened though.20:06
AscIIhehe20:06
AscIIno worries20:06
smoserthe input, what was the input config... ie, did cloud-init  mangle the input to break things ? or is netplan just doing the wrong thing .20:08
AscIIno mangling. The config is just wrong20:08
AscIIThe routes shouldn't be there20:09
AscIIthey are not pushed20:09
AscIInet/netplan.py20:10
blackboxswfwiw, we got credit right on the debian/changelog for Markus :)20:10
smoseryeah, blackboxsw saves the day20:10
AscIIhehe20:10
blackboxswafter breaking it. shame on review-mps tool20:11
AscIIso L114 in net/netplan.py generates routes for the subnet20:11
AscIIalways20:11
AscIIno matter what20:11
blackboxswhrm if routes is unspecified on the subnet it should be empty list and remain unset  right?20:12
AscIIyes, something like that20:13
AscIInet/eni.py does a the same thing for v1 in L36120:14
AscIIbut that results in the no-op 'post-up route add -net :: netmask 0..'20:15
AscIIwell, actually this command is wrong as well, but the added '|| true' prevents any problems20:17
AscIIthere is a comment above that section in net/eni.py that says:  We may at somepoint not want to emit this additional postfix20:18
AscIIah, that relates to the ||true20:19
AscIIhmm20:19
blackboxswAscII: sry I'm still trying to get the rest of the context on this. Do you have /var/log/cloud-init.log or a tarfile produced by 'cloud-init collect-logs'20:22
blackboxswI'm specifically wondering about the log message Applying network configuration from...20:22
AscIIsure20:23
blackboxswwhich should contain the netconfig we base rendering on20:23
blackboxswwhich may or may not have the 'routes' incorrectly specified20:23
AscIIhttps://paste.ubuntu.com/p/RVrBH9YqBb/20:26
blackboxswAscII: ok so ilne 89 in your paste shows that we are feeding in 'incorrect' route information to the netplan generator20:28
blackboxswI'm trying to grok where that comes from20:28
blackboxswAscII: it looks like it comes from HetznerCloud datasource.metadata['network-config']20:32
blackboxswcat /run/cloud-init/instance-data.json will show you the metadata harvested on the cloud20:32
blackboxswunder 'ds':'meta-data' keys20:33
AscIIhmm, that file is not present (anymore). Possibly because I corrected the generated netplan yaml20:36
blackboxswsmoser: I posted comment/question on https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/34185120:39
blackboxswsmoser: simpoir: I finally got ci to like me on https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/341543  turns out you actually have to 'git add' a new module that you've coded up otherwise those silly import errors. ¯\_(ツ)_/¯20:40
AscIIblackboxsw: ah, crap. My bad. It seems we actually have these routes in the metadata20:40
blackboxswAscII: I like to pass the blame around ;)20:41
AscIINeed to check with my team why. I guess some other distro needed it20:41
blackboxswgood deal.20:41
simpoirblackboxsw: I just saw. I having a second look at it.20:42
blackboxswsimpoir: I'm on your landscape branch atm20:42
blackboxswit will happen today ;()20:42
simpoir👍20:43
AscIIwell, it looks like rhel/fedora is to blame20:46
AscIIthey add the route as gateway20:47
AscIIIPV6_DEFAULTGW=fe80::1%eth020:47
AscIIand I think, we couldn't directly pass the interface in the gateway20:48
AscIIsince the gateway is not in the subnet (L346) it doesn't get rendered there, but later during routes (L392)20:52
AscIIgreat20:53
AscIIso, the only way to work around this, would be to render the meta-data with routes to rhel/centos/fedora and without to debian/ubuntu, I guess20:58
AscIIAt least for now20:58
papertigersrharper: are routes not picked up on ever reboot?22:02
rharperpapertigers: not following, could you provide some more context ?22:02
rharperpapertigers: are you manually modifying network configuration after cloud-init has generated one for you?22:03
papertigersfollowing up on what danmcd was asking about earlier. It seems only certain things are setup again on reboot.  For example I had to run 'cloud-init clean' to get DNS resolvers to change in systemd on this box22:03
danmcdBut my newly-parsed-by-DataSourceSmartOS.py "route" doesn't seem to work.22:04
danmcdHere's some json output I got from the logfile, including teased-out to show things clearly:https://gist.github.com/danmcd/7d1ae639d7877e760a47ad83489a342f22:04
rharpernetwork configuration is rendered per-instance;, so a reboot won't modify it; if you're adding additional configuration manually via a script, that would need to be marked per-always rather than per-instance22:11
rharperdns resolves should be encoded in /etc/network/interfaces.d/50-cloud-init.cfg22:11
rharperin which case they survive reboots on the same instance22:11
rharperdanmcd: yeah, the nameserver should be under the loopback interface in the eni file I refernced, resolvconf reads eni config and updates /etc/resolv.conf which is symlink to /run/resolvconf/resolcv.conf maintained by the resolvconf program22:12
danmcdSo nameserver can apply with "cloud-init clean" and a reboot.22:16
danmcdI'm wondering how I can tell why my "route" directive isn't being acted upon.22:16
danmcdSorry if papertigers didn't make that clear.22:16
danmcd(See the gist above.)22:16
rharpercan you paste your /etc/network/interfaces.d/50-cloud-init.cfg ? or if cloud-init collect-logs and share that?22:18
rharperfrom the yaml in your gist, it should render this:  https://paste.ubuntu.com/p/RDbq9qsFJ9/22:18
papertigersI dont seem to have a at /etc/network/interfaces.d/50-cloud-init.cfg22:25
rharperare you booting ubuntu ?22:26
danmcd"cloud-init collect-logs" barfs22:26
rharperif so , what release? Xenial22:26
papertigersUbuntu 17.1022:27
rharperah, netplan22:28
rharperfun22:28
rharperlet me rephrase the output22:28
rharperso, /etc/netplan/50-cloud-init.yaml is what youll have,  the resolvers should show up under systemd-resolve --status;  the static routes appear to be dropped;  =/22:30
blackboxswdanmcd: I'd also be curious about the collect-logs barfs comment, as that script doesn't do much except tar files on the system and run journalctl22:30
rharperwe'll need to refactor the network  conversion to put the sdc:routes data under the network interfaces22:31
blackboxswahh but it definitely needs a fix for non-deb systems as it leverages dpkg-query22:31
danmcdit's missing routes...22:31
danmcdSo do I need to do any more work in DataSourceSmartOS.py?  Or is this a consumer-of-that's problem?22:31
danmcdblackboxsw: hang on...22:32
danmcdblackboxsw: https://gist.github.com/danmcd/577325259016909c33fd8e18f01cb1c222:32
blackboxswahh sudo cloud-init collect-logs danmcd22:33
danmcdDOH!22:33
blackboxswthe instance-data.json is protected root readonly22:33
danmcdsilent.22:33
blackboxsw:)22:33
rharperdanmcd: yes, we need to fix the converter to put the routes under the interface22:33
danmcdPhew!22:33
rharperdanmcd: one sec, lemme paste22:33
rharperhttp://paste.ubuntu.com/p/ScdyqwMq6z/22:34
danmcdI'm a newb in this arena, so thanks for your patience.22:34
rharperno worries, we'll file a bug and it should be an easy adjustment22:34
rharperwith the change, then the netplan config file looks like this: http://paste.ubuntu.com/p/htRC3hcK5m/22:34
rharperwhich will include the routes22:34
danmcdSo what you pasted... that is something I'll have to fix.22:35
rharperdanmcd: I'll file the bug, and we just need to stuff the sdc:routes data in a different location22:35
blackboxswsorry danmcd on the silent run of collect-logs, smoser asked me to add a print saying 'Wrote cloud-init.tar.gz' in your cwd.22:35
rharperthe subnet we generate, can accept a 'routes' array22:35
danmcdSince now I hang the routes as their own same-level-as-physical.  But according to your pastebin, I'll have to put it inside the physical "object".22:35
danmcdright?22:35
blackboxswI forgot to add that output to the collect-logs cmd. But anyway not a problem you care about at the moment22:36
rharperyeah, under the subnets for the interface22:36
danmcdOkay, so that is my problem.  Since I'm fixing sdc:routes anyway.22:36
danmcdBTW, since sdc:routes is independent of interface, I'm going to have to collect them, and then hang them under all interfaces.22:36
danmcdWhich shouldn't be a problem,. even for multi-homed?22:37
rharperyeah, we struggled with the routes22:37
danmcdOkay...22:37
rharperin a sense a  route has to go out *one* interface22:37
rharperso, for the netplan format, the routes are stuffed under interfaces22:37
danmcdOh, this is a netplan thing?22:37
rharperyeah, 17.10+ has netplan22:37
danmcd(Sorry, I come from the illumos TCP/IP stack...)22:37
danmcdOkay, I see.  It'll be more challenging, but at least I understand WTF is going on now.  You've been very helpful.  Thanks for your time & patience.22:38
rharpernp22:41
papertigersif we do this work for netplan, does that break anything below 17.10?23:15
rharperpapertigers: no, v1 renders the global routes correctly already23:16
rharper16.04 should work as-is with the config that danmcd posted in his gist23:16
danmcdI'm trying brute-force... putting it in both places.23:17
danmcdIsn't the idea it works in one form and deploys everywhere, though?23:17
rharperthat may cause issues on 16.0423:17
rharperyes, cloud-init converts the v1 into internal network state, then renders to the distro's format (eni, netplan or sysconfig)23:18
papertigersrharper: and my question earlier was basically after the yml file or interfaces file gets written out to disk on first boot it doesn't try to set things up again unless you run 'cloud-init clean'?23:18
danmcdSo putting "routes" as a peer of "physical" should not be done?23:18
rharperwhat we're hitting is that netplan doesn't handle "global" static routes per the design choice that routes should be bound to at least one interface, since they have to egress one anyhow23:18
rharperpapertigers: so on 17.10, after your first boot, run systemd-resolve --status23:19
danmcdThat seems to be a problem beyond just DataSourceSmartOS, right?23:19
rharperyou should see your DNS enatries there23:19
papertigersrharper: yeah I know that works.  I am saying if the data in sdc:resolvers changes, cloud-init wont attempt to change that unless you run clean. Just want to confirm behavior23:20
rharperpapertigers: cloud-init writes out either an eni on 16.04, or netplan on 17.10 before the "networking" layer starts, then ifupdown or networkd brings the config up23:20
rharperso you shouldn't need to do anything to have all of your network config applied23:20
rharperpapertigers: yes, we don't yet have dynamic network config changes23:20
rharperthat's something we're actively discussing23:21
papertigerscool, thanks.  That would be super useful to us if the discussions is a matter of if and not when23:21
rharperhttps://hackmd.io/M1Tae41PQBC7a9qMsurTJw23:22
rharperthat was one of the discussion we've had with the community23:22
rharperwe're very interested in feedback , especially from datasource folks23:22
rharperpapertigers: danmcd: I've got to step our for bit; feel free to leave comments, issues, I'll see them later tonight, and if not then tomorrow23:24
danmcdRIght now, I generate multiple "routes" entries.23:25
danmcdI'll find out the hard way if that's a real problem or not.23:25
danmcdThanks rharper23:25

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