canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.87k stars 856 forks source link

[docs]: NoCloud doesn't document its datasource keys #5062

Closed ralph-mcardell closed 2 months ago

ralph-mcardell commented 6 months ago

Original request

On the NoCloud data source page the configuration from local filesystem (Method 1) section states:

"For this method to work, the filesystem volume must be labelled CIDATA."

However, I seem to have a distribution with configuration settings similar to:

datasource_list: [NoCloud, None] datasource: NoCloud: fs_label: NOT-CIDATA

Which seems to indicate that the volume label can be values other than CIDATA if so configured. Suggesting the label needs to be CIDATA by default rather than having to absolutely be CIDATA and using any other value is not possible at all.


Reported from: https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html

More context from @TheRealFalcon

NoCloud supports some Datasource keys in /etc/cloud/cloud.cfg , but we don't document them. A quick glance at the code shows a user can configure: seedfrom, user-data, meta-data, fs_label

We should document these like we document datasource keys for other datasources

TheRealFalcon commented 6 months ago

@ralph-mcardell , This section of the documentation is referring to providng a filesystem with meta data and user data used by cloud-init. One common way to use cloud-init is to provide a separate configuration ISO, but cloud-init won't use that ISO (or any other filesystem) unless it has a label of CIDATA. We have an example later in the page of how to achieve this.

What you're doing here is providing a different configuration to tell the DataSource how to query/obtain the meta data and user data. In this case, the fs_label: NOT-CIDATA will have no effect.

Does that distinction help?

This does hightlight that should have a better way of distinguishing between the two types of configuration, and we also need to document the supported datasource keys. I can open a separate ticket for that.

I'll close this one as invalid, but feel free to re-open in case I have missed something.

TheRealFalcon commented 6 months ago

@ralph-mcardell , sorry, I think I misunderstood what you meant. Yes, fs_label can be used to specify a different label to use when checking fs labels, but that is not documented.

holmanb commented 5 months ago

However, I seem to have a distribution with configuration settings similar to:

datasource_list: [NoCloud, None] datasource: NoCloud: fs_label: NOT-CIDATA

@ralph-mcardell which distribution is this? That choice for a default is odd. Why would a distribution set this default to be different?

I've seen this setting in the past and explicitly chose not to document it because I couldn't find a reason that a user would need anything but the default.

ralph-mcardell commented 5 months ago

Hello holmanb,

First note I said 'similar to' I used a generic example placeholder of NOT-CIDATA for the fs_label value, this is not a verbatim label value of any distribution AFAIK.

The actual distribution I came across was for the Turing Pi RK1 board with a fs_label value of 'system-boot'.

This is a Rockchip based board and uses a Ubuntu 22.04 distribution build based on Joshua Riek's ubuntu-rockchip distribution GitHub repository: https://github.com/Joshua-Riek/ubuntu-rockchip/tree/main

What is odd is it looks like the ubuntu-rockchip distribution build scripts set the boot partition label to 'CIDATA' in scripts/build-image.sh, which contains the lines:

# Create filesystems on partitions mkfs.vfat -i "${boot_uuid}" -F32 -n CIDATA "${disk}${partition_char}1"

However, it seems the applicable script in this case is the overlay/usr/bin/ubuntu-rockchip-install script ( https://github.com/Joshua-Riek/ubuntu-rockchip/blob/main/overlay/usr/bin/ubuntu-rockchip-install ), which has the lines:

# Create filesystems on partitions mkfs.vfat -i "${boot_uuid}" -F32 -n system-boot "${disk}${partition_char}1" &> /dev/null

The etc/cloud/cloud.cfg.d file that sets fs_label is written by the scripts/built-rootfs.sh script ( https://github.com/Joshua-Riek/ubuntu-rockchip/blob/main/scripts/build-rootfs.sh ). Around line 247 can be found:

# Configure cloud-init for NoCloud cat << EOF > ${chroot_dir}/etc/cloud/cloud.cfg.d/99-fake_cloud.cfg datasource_list: [ NoCloud, None ] datasource: NoCloud: fs_label: system-boot EOF

Hope this helps

Ralph

holmanb commented 2 months ago

@ralph-mcardell thanks for reporting.

This key is now deprecated, and the distribution that you mentioned has shifted to using a supported label since this was reported. I'm going to close this issue.