/srv/irclogs.ubuntu.com/2025/01/27/#cloud-init.txt

=== kuraudo1 is now known as kuraudo
faiqusholmanb: i think a restart is necessary. or at the very least we can restart the config and final modes? 15:35
=== dbungert1 is now known as dbungert
holmanbconnor_k: yeah maybe - I didn't bother to ask why you are using vendor-data18:13
holmanbfaiqus: shouldn't be18:14
holmanbfaiqus: are you going to support the code that you're using?18:15
faiqusholmanb: yeah its going to be supported by CAPA maintianers/open source community 18:16
holmanbare you a CAPA maintainer?18:16
faiqusreviewer18:17
holmanbah18:17
faiqusdo you think this approach makes any sense? throwing out/ignoring the idea of restarting it or not.18:18
holmanbfaiqus: I mean, I wrote the code. What do you think I'm going to say :P18:19
holmanbfaiqus: restarting is _really_ undesireable for a number of reasons18:20
holmanbfaiqus: I just don't have the ability to test it18:20
faiqushaha, no i meant having this two part approach where the user-data starts as a script off by fetching some code and that replaces the old user-data18:21
holmanbahhh, I see18:21
holmanbuhh18:21
faiqusthat's the part that is confusing me. i think this stuff needs to be executed as something else and not necessarily as user-data? Maybe a boothook. I'm not sure though.18:22
holmanbit would be much simpler to just write the whole datasource in Python - this approach was just a hack to prove that it is possible to do without the restart18:23
holmanband the person I was working with tested it18:23
holmanband it apparently worked - maybe something changed or this is an old version18:23
faiqusan old version of your data source?18:24
holmanbyeah, idk18:24
holmanbI don't know if I ever put it in version control18:25
faiqusmaybe - i tried the same code richard had and didn't have any luck before experimenting on my own. 18:25
faiqusyour code was in version control - let me find it 18:26
holmanbfaiqus: I can walk you through some ideas or give you some changes to gather more info to debug the issue18:26
holmanbbut I'm a bit busy at the moment, I probably will not have time to dig into it today18:26
faiqushttps://github.com/canonical/cloud-init/commit/f2796cd8260b8f3f463aecdd19feb6524182aaf3 18:26
-ubottu:#cloud-init- Commit f2796cd in canonical/cloud-init "feat: add POC datasource for Ec2 / Kubernetes"18:26
faiqusno sweat. thanks for your support. maybe i can make the whole thing work in python. will credentials for AWS be present at the datasource time 18:27
holmanbfaiqus: apparently, yes - the script that gets pulled down has them18:28
holmanbfaiqus: does the CAPA project have the ability to modify that script?18:28
faiqussure does 18:28
faiqusif you have an idea for a direction you want to go in please let me know and i can explore it. thanks again for all the guidance you're helping us get out of a crazy hole 18:29
holmanbfaiqus: if you can modify what gets exposed by the IMDS server, what I'd suggest is to put the credentials that are exposed in that script into a configuration -> json / yaml  / whatever18:30
faiqusand have the datasource read from that source to fetch the "real" cloud-init user data?18:32
holmanbcloud-init uses the python requests library18:33
holmanbjust query the IMDS, grab the configuration file (which has the credentials and whatever else you need), convert to a dict (json.loads() / yaml.safe_load() / whatever) and then implement the rest of that bash script in python18:33
holmanbfaiqus: yeah, basically18:34
faiqusok that sounds good. i think all of these instances use some sort of instance principal authentication so maybe that credentials will simply be somewhere 18:35
holmanbcalling LOG.info() sends logs to /var/log/cloud-init.log by default (if you don't have a broken logging config)18:36
holmanband there is a helper called log_util.multi_log() if you need stuff to go to the console too (which ends up in /var/log/cloud-init-output.log)18:36
holmanb> thanks again for all the guidance you're helping us get out of a crazy hole 18:37
holmanbhappy to help18:37
holmanblike I said, I don't have a ton of time to contribute but I'd like to see it get resolved and using cloud-init in a way that is more sustainable18:38
holmanbfaiqus: one more thing18:41
holmanbthe semantics of the datasource file are non-obvious, but the tl;dr is that when your code runs is defined by the datasources = [...] list18:42
holmanbso if you have e.g.18:44
holmanbdatasources = [(DataSourceFooLocal), (sources.DEP_FILESYSTEM,)), (DataSourceFooNetwork, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK))]18:44
holmanbthen DataSourceFooLocal will be used during the "local" stage (cloud-init-local.service)18:44
holmanband DataSourceFooNetwork will be used during the "network" stage (cloud-init-network.service)18:44
holmanbfaiqus: network isn't guaranteed to be available during local stage, but on some platforms a dhcp client is used to bring up a temp network to get the configuration18:46
holmanbfor more reading: https://docs.cloud-init.io/en/latest/explanation/boot.html18:46
deanHello! I'm having a problem with cloud-init 22.4.2 on a Debian AArch64 system. I'm pulling my configs from a self-hosted NoCloud provider, both user-data and vendor-data as multi-part MIME. Both configs have files with write_files entries and I've included the merge_how hack in them. However the write_file entries in my vendor-data files are being overridden. How do I fix this?20:07
deanAny help would be greatly appreciated.20:07
minimaldean: "NoCloud provider", "multi-part MIME" - not sure exactly what you mean20:09
minimalare you using an ISO/filesystem to provide the config or HTTP/HTTPS?20:09
deanI'm using an HTTP data source.20:09
minimalso then each of the configs is pulled separately20:09
deanyes20:09
minimalso I don't see where the multi-part MIME comes in20:09
minimalif they're separately pulled then there is no multi-part20:10
deanThe user and vendor data configs are compiled from sets of #cloud-config files.into multi-part archives.20:11
deanhttps://cloudinit.readthedocs.io/en/latest/explanation/format.html#mime-multi-part-archive20:12
minimalok, haven't used that myself. So being overriden by what?20:14
deanThe write_file entries in the user-data files are being kept. The write_file entries in the vendor-data files are being dropped.20:17
deanIn theory, the merge_how hack is supposed to fix that.20:17
minimalnot familiar with the merge_how hack, it's behaviour might differ between cloud-init versions. 22.4.2 is not exactly recent, is there no more recent c-i version available to use?20:19
deanUnfortunately no.20:20
minimalI'd suggest you open a Github Issue and provide logs etc20:20
deanAlright.20:20
faiquswriting a datasource that uses aws APIs seems...strange does anyone have examples of datasoruces that reach out to services on the local cloud provider? i dont really know how im supposed to import the aws sdk either 21:53

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