Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Airgapped installation using LocalPath is incomplete #104

Open
ader1990 opened this issue Feb 11, 2025 · 1 comment · May be fixed by #109
Open

Airgapped installation using LocalPath is incomplete #104

ader1990 opened this issue Feb 11, 2025 · 1 comment · May be fixed by #109

Comments

@ader1990
Copy link

Hello,

The following workflow is required to more easily integrate [cluster-api-k8s](https://github.com/canonical/cluster-api-k8s) into the https://sylva-projects.gitlab.io/ project:

  • Create an Ubuntu Image using disk-image-builder project as per Sylva requirements - to contain the k8s binaries
  • Use that Ubuntu Image with cluster-api-k8s

An issue arises with this workflow, as the disk-image-builder relies on a chroot environment, thus there is no way to pre-install a snap, in this case k8s snap.

A workaround would be to just download the snap files for the k8s snap: snap download k8s, and it is possible to do it at a known path in the image, let's say /capi/snap-binaries and an image to be created.

Afterwards, using the localPath = /capi/snap-binaries/k8s.snap in the CK8sConfig, the installation of the snap k8s cannot be done in an airgapped environment (airgapped environment = no access to the Internet), because the snap k8s is not an independent snap, as it depends on the core20 snap.

Because of this, there is no way to actually use the LocalPath feature of the cluster-api-k8s in an airgapped environment, as it will always fail because snapd cannot download the core20 snap.

Is this behaviour intentional? It would be great to have a way to either be able to install a snap in a chrooted environment. Or to carry over the dependent snaps with you and snap to automatically try to install those snaps from the same directory. Or to have cluster-api-k8s install the core20 snap from the root dir of the LocalPath.

Thank you.

@claudiubelu claudiubelu linked a pull request Feb 13, 2025 that will close this issue
@claudiubelu
Copy link
Contributor

This seems to work:

sudo snap download k8s --channel 1.32-classic/stable
sudo snap ack k8s_2187.assert
sudo snap download core20
sudo snap ack core20_2434.assert

cat /capi/etc/snap-local-path
/home/ubuntu/workdir/cluster-api-k8s/core20_2434.snap /home/ubuntu/workdir/cluster-api-k8s/k8s_2187.snap

sudo bash ./pkg/cloudinit/scripts/install.sh
k8s v1.32.1 installed
Warning: flag --classic ignored for strictly confined snap core20

core20 20240911 installed

Granted, a minor change needs to be applied to install.sh: #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants