This message was deleted.
# elemental
a
This message was deleted.
a
The main reasons I want to do this are: a) Writing config for the Harvester cloud provider to
/etc/kubernetes/cloud-config
as in https://docs.harvesterhci.io/v1.3/rancher/cloud-provider/#deploying-to-the-k3s-cluster-with-harvester-node-driver-experimental. I think this might be doable at the
MachineRegistration
level but I’ve run into a few other issues trying to get this to work 😅 b) Setting the hostname to my VM name when creating the machine (at some point I’ll revisit https://github.com/rancher-sandbox/linuxkit/pull/5 so this isn’t needed, I just haven’t had time lately 😢 )
s
I am not sure I follow you. Sorry I am not that versed about Harvester. > 6.0 seems to be ignoring whatever I put in the cloud config user data in Harvester. Do you have an example of this
user data in Harvester
? from what you say I understand this is then added as
/oem/userdata
in the VM OS, is that correct? In oder to get the
/oem/userdata
seen as a data source user data you should add the file datasource provider. See here, we are considering only block devices (cdrom or vfat block devices). Could be changed to something like:
Copy code
name: "Elemental cloud-config datasources"
stages:
  initramfs:
  - datasource:
      providers: ["cdrom", "file"]
      path: "/oem"
On that area I can't see a difference between 5.4, 5.5 and 6.0 based images, they all include the same datasource provider setup as part of
/system/oem/02_datasources.yaml
so I think I might not fully understand the issue you are exposing. Regarding https://github.com/rancher-sandbox/linuxkit/pull/5, the offer still stands, we can proceed with it if you don't have time or need help. As said in the comment just ask if you need help or want us to continue with it. Frankly speaking I forgot about it during summer...
a
Thanks for the response David, apologies it’s taken me this long to get back to you! I’ve done a bit more poking around to try and improve my own understanding, hopefully the following explanation is a bit clearer:
When defining a VM in Harvester, you can provide cloud-init config like so
This gets attached to the VM as a volume, in my case
/dev/vdc
, containing two files,
meta-data
, and
user-data
I’ve temporarily mounted this to /home to show the content is the same as what I provided in Harvester
this file has the correct name to be picked up by the CD-ROM provider, and as I can see in my Micro 5.5 VM (toolkit version 1.1.6), subsequently appears in
/oem
(slack’s thumbnail for this screenshot doesn’t show it, you have to open the image)
This seems to sort of work in my Micro 6.0 VM (toolkit version 2.1.1), but I have since noticed that I only have the file
userdata
in
/oem
, and not also
userdata.yaml
After reading the elemental docs again, this stood out to me
At boot the
user-data
file will be copied as is to
/oem/user-data
and in case it contains cloud-config data an extra copy will be added as
/oem/user-data.yaml
. The file
/oem/user-data.yaml
will be parsed on any later cloud-init stage.
If the
user-data
is not containing cloud-config data the Elemental client will just copy it as is to
/oem/user-data
. Only
*.yaml
files are parsed when executing cloud-init stages, so in that case the file will be ignored by cloud-init services.
I also don’t understand why the file is getting renamed from
user-data
to
userdata
in both cases since this contradicts the docco but given it seems fine in my 5.5 / 1.1.6 example I’ll ignore that for now
I understand now my issue is not with the OS, but likely some change to the provider / cloud-config handling in the toolkit. Hopefully this makes a bit more sense to you now 🤞
Looks like this is responsible for seeing if userdata contains cloud-config or not. There’s only one change made to this file since the 1.1.6 release of the elemental toolkit, and I don’t think that change could have affected this
Oh, I think I’m mistaken… looks like we fully switched from muddler/yip to rancher/yip between these releases. I expect there’s something in there that’s causing this?
I can’t think of anything else this could be (although haven’t had a chance to look in any more detail) so unless anyone has any thoughts I’ll raise an issue in GitHub later