Skip to content

Use template variables instead of LIMA_CIDATA_* bash variables #2123

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

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/docker-rootful.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/experimental/vnc.yaml
Original file line number Diff line number Diff line change
@@ -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-20231011/ubuntu-23.10-server-cloudimg-amd64.img"
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions examples/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: |
Expand Down
6 changes: 3 additions & 3 deletions examples/podman-rootful.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/limayaml/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down