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

docker: Fix userdata bind mount path inside the container #2222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 3 additions & 1 deletion src/cloud-api-adaptor/pkg/paths/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ const (
InitDataPath = "/run/peerpod/initdata"
AgentCfgPath = "/run/peerpod/agent-config.toml"
ForwarderCfgPath = "/run/peerpod/daemon.json"
UserDataPath = "/run/media/cidata/user-data"
// This is not mounted under /run to avoid conflicting with
// docker provider mounts.
UserDataPath = "/var/tmp/media/cidata/user-data"
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Service]
# mount config disk if available
ExecStartPre=-/bin/mkdir -p /run/media/cidata
ExecStartPre=-/bin/mount -t iso9660 -o ro /dev/disk/by-label/cidata /run/media/cidata
ExecStartPre=-/bin/mkdir -p /var/tmp/media/cidata
ExecStartPre=-/bin/mount -t iso9660 -o ro /dev/disk/by-label/cidata /var/tmp/media/cidata
# The digest is a string in hex representation, we truncate it to a 32 bytes hex string
ExecStartPost=-/bin/bash -c 'tpm2_pcrextend 8:sha256=$(head -c64 /run/peerpod/initdata.digest)'
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/podvm/qcow2/copy-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ -e /tmp/files/etc/aa-offline_fs_kbc-resources.json ]; then
fi

if [ -e /tmp/files/etc/certificates/tls.crt ] && [ -e /tmp/files/etc/certificates/tls.key ]; then
sudo mkdir -p /etc/certificates
sudo mkdir -p /etc/certificates
sudo cp -a /tmp/files/etc/certificates/tls.crt /etc/certificates/
sudo cp -a /tmp/files/etc/certificates/tls.key /etc/certificates/
fi
Expand Down
4 changes: 2 additions & 2 deletions src/cloud-providers/docker/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ func (p *dockerProvider) CreateInstance(ctx context.Context, podName, sandboxID

// Create volume binding for the container

// mount userdata to /run/media/cidata/user-data
// mount userdata to /var/tmp/media/cidata/user-data
// This file will be read by process-user-data and daemon.json will be written to
// /run/peerpods/daemon.json at runtime
volumeBinding := []string{
// note: we are not importing that path from the CAA package to avoid circular dependencies
fmt.Sprintf("%s:%s", instanceUserdataFile, "/run/media/cidata/user-data"),
fmt.Sprintf("%s:%s", instanceUserdataFile, "/var/tmp/media/cidata/user-data"),
}

// Add host bind mount for /run/kata-containers and /run/image to avoid
Expand Down
Loading