Skip to content

Commit

Permalink
docs: fix userdata indentation (#2784)
Browse files Browse the repository at this point in the history
* fix userdata indentation

* fix indentation

* indentation

* fix identation issues

---------

Co-authored-by: Lenny Chen <lenny.chen@spectrocloud.com>
(cherry picked from commit d772c77)
  • Loading branch information
lennessyy committed May 7, 2024
1 parent e73af8e commit edfc7a9
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,45 +80,34 @@ artifacts at the same time.

- **earthly.sh** - Script to invoke the Earthfile, and generate target artifacts.

6. Review the **.arg** file containing the customizable arguments, such as image tag, image registry, image repository,
and OS distribution. The table below shows all arguments, their default value, and allowed values.

| **Argument** | **Description** | **Default Value** | **Allowed Values** |
| ------------------ | ------------------------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------- |
| `CUSTOM_TAG` | Tag for the provider images | demo | Lowercase alphanumeric string without spaces. |
| `IMAGE_REGISTRY` | Image registry name | ttl.sh | Your image registry hostname, without `http` or `https` <br /> Example: docker.io/spectrocloud |
| `OS_DISTRIBUTION` | OS Distribution | ubuntu | ubuntu, opensuse-leap |
| `IMAGE_REPO` | Image repository name.<br /> It is the same as the OS distribution. | `$OS_DISTRIBUTION` | Your image repository name. |
| `OS_VERSION` | OS version, only applies to Ubuntu | 22.04 | 20, 22.04 |
| `K8S_DISTRIBUTION` | Kubernetes Distribution | k3s | k3s, rke2, kubeadm |
| `ARCH` | Architecture of the image. | `amd64` | `amd64`, `arm64` |

7. Issue the command below to assign an image tag value that will be used when creating the provider images. This guide
6. Issue the command below to assign an image tag value that will be used when creating the provider images. This guide
uses the value `palette-learn` as an example. However, you can assign any lowercase and alphanumeric string to the
`CUSTOM_TAG` argument.

```bash
export CUSTOM_TAG=palette-learn
```

8. Use the command below to save the Docker Hub image registry hostname in the `IMAGE_REGISTRY` argument. Before you
execute the command, replace `[DOCKER-ID]` in the declaration below with your Docker ID. Your image registry hostname
7. Use the command below to save the image registry hostname in the `IMAGE_REGISTRY` argument. Before you execute the
command, replace `[REGISTRY-HOSTNAME]` in the declaration below with your Docker ID. Your image registry hostname
must comply with standard DNS rules and may not contain underscores.

```bash
export IMAGE_REGISTRY=docker.io/[DOCKER-ID]
export IMAGE_REGISTRY=[REGISTRY-HOSTNAME]
```

9. Issue the following command to use the Ubuntu OS distribution and use the 22.04 version.
8. Issue the following command to use the Ubuntu OS distribution and use the 22.04 version.

```bash
export OS_DISTRIBUTION=ubuntu
export OS_VERSION=22.04
```

10. Issue the command below to create the **.arg** file containing the custom tag, Docker Hub image registry hostname,
and openSUSE Leap OS distribution. The **.arg** file uses the default values for the remaining arguments. You can
refer to the existing **.arg.template** file to learn more about the available customizable arguments.
9. Open the **Earthfile** in the CanvOS directory. Under `build-provider-images`, remove the lines containing Kubernetes
versions that you do not need.

10. Issue the command below to create an **.arg** file. The **.arg** file uses the default values for the remaining
arguments.

```bash
cat << EOF > .arg
Expand All @@ -136,10 +125,9 @@ artifacts at the same time.
EOF
```
11. Open the **Earthfile** in the CanvOS directory. Under `build-provider-images`, remove the lines containing
Kubernetes versions that you do not need.
Refer to [Edge Artifact Build Configurations](./arg.md) for all available arguments.
12. CanvOS utility uses [Earthly](https://earthly.dev/) to build the target artifacts. Issue the following command to
11. CanvOS utility uses [Earthly](https://earthly.dev/) to build the target artifacts. Issue the following command to
start the build process.
```bash
Expand All @@ -152,19 +140,18 @@ artifacts at the same time.
Share your logs with an Earthly account (experimental)! Register for one at https://ci.earthly.dev.
```
13. To use the provider images in your cluster profile, push them to your image registry mentioned in the **.arg** file.
12. To use the provider images in your cluster profile, push them to your image registry mentioned in the **.arg** file.
Issue the following command to log in to Docker Hub. Provide your Docker ID and password when prompted.
```bash
docker login
```
14. Use the following commands to push the provider images to the Docker Hub image registry you specified. Replace the
`[DOCKER-ID]` and version numbers in the command below with your Docker ID and respective Kubernetes versions that
the utility created.
13. Use the following commands to push the provider images to the Docker Hub image registry you specified. Replace the
`[REGISTRY-HOSTNAME]` and version numbers in the command below.
```bash
docker push docker.io/[DOCKER-ID]/ubuntu:k3s-1.28.2-v4.3.0-palette-learn
docker push [REGISTRY-HOSTNAME]/ubuntu:k3s-1.28.2-v4.3.0-palette-learn
```
## Validate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,39 @@ to a bootable device, such as a USB stick.
```

For example, you can include the following content in the **user-data** file to connect your Edge host to Wi-Fi.
This requires wpa_supplicant to be included in your base OS image. For more information, refer to
Replace `wifi-network-name` with the name of your Wi-Fi network and the `wifi-password` with the password of your
network. This requires wpa_supplicant to be included in your base OS image. For more information, refer to
[Connect Intel NUC Edge Host to Wifi](../../networking/connect-wifi.md).

```yaml
#cloud-config
install:
bind_mounts:
- /var/lib/wpa
bind_mounts:
- /var/lib/wpa
stages:
network.before:
- name: "Connect to wifi"
commands:
- |
# Find the first wireless network interface
wireless_interface=""
for interface in $(ip link | grep -oP '^\d+: \K[^:]+(?=:)')
do
if [ -d "/sys/class/net/$interface/wireless" ]; then
wireless_interface=$interface
break
fi
done
# Check if a wireless interface was found and connect it to WiFi
if [ -n "$wireless_interface" ]; then
wpa_passphrase Madrid supersup | tee /var/lib/wpa/wpa_supplicant.conf
wpa_supplicant -B -c /var/lib/wpa/wpa_supplicant.conf -i $wireless_interface
dhclient $wireless_interface
else
echo "No wireless network interface found."
fi
network.before:
- name: "Connect to wifi"
commands:
- |
# Find the first wireless network interface
wireless_interface=""
for interface in $(ip link | grep -oP '^\d+: \K[^:]+(?=:)')
do
if [ -d "/sys/class/net/$interface/wireless" ]; then
wireless_interface=$interface
break
fi
done
# Check if a wireless interface was found and connect it to WiFi
if [ -n "$wireless_interface" ]; then
wpa_passphrase wifi-network-name wifi-password | tee /var/lib/wpa/wpa_supplicant.conf
wpa_supplicant -B -c /var/lib/wpa/wpa_supplicant.conf -i $wireless_interface
dhclient $wireless_interface
else
echo "No wireless network interface found."
fi
```

2. Create an empty **meta-data** file:
Expand All @@ -76,39 +77,41 @@ to a bootable device, such as a USB stick.

3. Create an ISO using the following command.

<Tabs>
<TabItem label="macOS/Linux" value="mac-linux">
<Tabs>

<TabItem label="macOS/Linux" value="mac-linux">

```shell
mkisofs -output site-user-data.iso -volid cidata -joliet -rock user-data meta-data
```

</TabItem>
</TabItem>

<TabItem label="Windows" value="windows">
<TabItem label="Windows" value="windows">

```shell
genisoimage -output site-user-data.iso -volid cidata -joliet -rock user-data meta-data
```

</TabItem>
</Tabs>
</TabItem>

</Tabs>

This generates an ISO file called **site-user-data.iso** in the current directory.
This generates an ISO file called **site-user-data.iso** in the current directory.

4. Flash your bootable device such as a USB drive with the ISO file you just created.
4. Flash your bootable device such as a USB drive with the ISO file you just created.

:::info
:::info

You can use several software tools to create a bootable USB drive, such as
[balenaEtcher](https://www.balena.io/etcher). For a PXE server, there are open-source projects such as
[Fog](https://fogproject.org/download) or
[Windows Deployment Services](https://learn.microsoft.com/en-us/windows/deployment/wds-boot-support) for Windows.
You can use several software tools to create a bootable USB drive, such as
[balenaEtcher](https://www.balena.io/etcher). For a PXE server, there are open-source projects such as
[Fog](https://fogproject.org/download) or
[Windows Deployment Services](https://learn.microsoft.com/en-us/windows/deployment/wds-boot-support) for Windows.

:::
:::

5. Once the Edge host arrives at the physical site. Load the USB drive to the Edge host before powering it on. The Edge
Installer will apply the new user data during the installation process.
5. Once the Edge host arrives at the physical site. Load the USB drive to the Edge host before powering it on. The Edge
Installer will apply the new user data during the installation process.

## Validate

Expand Down

0 comments on commit edfc7a9

Please sign in to comment.