diff --git a/examples/docker-rootful.yaml b/examples/docker-rootful.yaml index caadff967b3b..813588b1d125 100644 --- a/examples/docker-rootful.yaml +++ b/examples/docker-rootful.yaml @@ -6,7 +6,7 @@ # $ export DOCKER_HOST=$(limactl list docker-rootful --format 'unix://{{.Dir}}/sock/docker.sock') # $ docker ... -# This template requires Lima v0.8.0 or later +# This template requires Lima v0.20.0 or later images: # Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months. - location: "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-amd64.img" @@ -49,7 +49,7 @@ provision: # Alternatively we could just add the user to the "docker" group, but that requires restarting the user session cat <<-EOF >/etc/systemd/system/docker.socket.d/override.conf [Socket] - SocketUser=${LIMA_CIDATA_USER} + SocketUser={{.User}} EOF fi export DEBIAN_FRONTEND=noninteractive diff --git a/examples/experimental/vnc.yaml b/examples/experimental/vnc.yaml index a6e3f76b2e02..b573df946aec 100644 --- a/examples/experimental/vnc.yaml +++ b/examples/experimental/vnc.yaml @@ -1,5 +1,5 @@ # A template to run ubuntu using display: vnc -# This template requires Lima v0.15.0 or later. +# This template requires Lima v0.20.0 or later. images: # Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months. - location: "https://cloud-images.ubuntu.com/releases/23.10/release-20231220/ubuntu-23.10-server-cloudimg-amd64.img" @@ -33,7 +33,7 @@ provision: export DEBIAN_FRONTEND=noninteractive # x-terminal-emulator x-session-manager x-window-manager apt-get install -y xorg xterm openbox hsetroot tint2 slim - printf "auto_login yes\ndefault_user ${LIMA_CIDATA_USER}\n" >>/etc/slim.conf + printf "auto_login yes\ndefault_user {{.User}}\n" >>/etc/slim.conf # configure some nice lima green, set up panel and apps printf "hsetroot -solid \"#32CD32\" &\ntint2 &\n" >>/etc/xdg/openbox/autostart sed -i 's/Clearlooks/Clearlooks-Olive/' /etc/xdg/openbox/rc.xml # go for green diff --git a/examples/k8s.yaml b/examples/k8s.yaml index 0baf48f7c622..aa71c3de5515 100644 --- a/examples/k8s.yaml +++ b/examples/k8s.yaml @@ -10,7 +10,7 @@ # NAME STATUS ROLES AGE VERSION # lima-k8s Ready control-plane,master 44s v1.22.3 -# This template requires Lima v0.7.0 or later. +# This template requires Lima v0.20.0 or later. images: # Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months. - location: "https://cloud-images.ubuntu.com/releases/22.04/release-20231211/ubuntu-22.04-server-cloudimg-amd64.img" @@ -131,9 +131,9 @@ provision: #!/bin/bash set -eux -o pipefail export KUBECONFIG=/etc/kubernetes/admin.conf - mkdir -p ${LIMA_CIDATA_HOME}/.kube - cp -f $KUBECONFIG ${LIMA_CIDATA_HOME}/.kube/config - chown -R ${LIMA_CIDATA_USER} ${LIMA_CIDATA_HOME}/.kube + mkdir -p {{.Home}}/.kube + cp -f $KUBECONFIG {{.Home}}/.kube/config + chown -R {{.User}} {{.Home}}/.kube probes: - description: "kubeadm to be installed" script: | diff --git a/examples/podman-rootful.yaml b/examples/podman-rootful.yaml index 6793f71201b6..eb46f1d634ee 100644 --- a/examples/podman-rootful.yaml +++ b/examples/podman-rootful.yaml @@ -10,7 +10,7 @@ # $ export DOCKER_HOST=$(limactl list podman-rootful --format 'unix://{{.Dir}}/sock/podman.sock') # $ docker ... -# This template requires Lima v0.8.0 or later +# This template requires Lima v0.20.0 or later images: - location: "https://download.fedoraproject.org/pub/fedora/linux/releases/39/Cloud/x86_64/images/Fedora-Cloud-Base-39-1.5.x86_64.qcow2" arch: "x86_64" @@ -36,12 +36,12 @@ provision: mkdir -p /etc/systemd/system/podman.socket.d cat <<-EOF >/etc/systemd/system/podman.socket.d/override.conf [Socket] - SocketUser=${LIMA_CIDATA_USER} + SocketUser={{.User}} EOF fi if [ ! -e /etc/tmpfiles.d/podman.conf ]; then mkdir -p /etc/tmpfiles.d - echo "d /run/podman 0700 ${LIMA_CIDATA_USER} -" > /etc/tmpfiles.d/podman.conf + echo "d /run/podman 0700 {{.User}} -" > /etc/tmpfiles.d/podman.conf fi dnf -y install podman - mode: system diff --git a/pkg/limayaml/validate.go b/pkg/limayaml/validate.go index ed7056968358..d4faf4ccdc7d 100644 --- a/pkg/limayaml/validate.go +++ b/pkg/limayaml/validate.go @@ -187,6 +187,9 @@ func Validate(y LimaYAML, warn bool) error { return fmt.Errorf("field `provision[%d].mode` must one of %q, %q, %q, or %q", i, ProvisionModeSystem, ProvisionModeUser, ProvisionModeBoot, ProvisionModeDependency) } + if strings.Contains(p.Script, "LIMA_CIDATA") { + logrus.Warn("provisioning scripts should not reference the LIMA_CIDATA variables") + } } needsContainerdArchives := (y.Containerd.User != nil && *y.Containerd.User) || (y.Containerd.System != nil && *y.Containerd.System) if needsContainerdArchives && len(y.Containerd.Archives) == 0 {