-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
containerd/cri: enable the btrfs snapshotter (#4316)
* vendor: btrfs * enable the btrfs snapshotter * testing: snapshotter/btrfs Signed-off-by: Jacob Blain Christen <jacob@rancher.com>
- Loading branch information
Showing
22 changed files
with
1,644 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Snapshotter Testing | ||
on: | ||
push: | ||
paths-ignore: | ||
- "install.sh" | ||
- "tests/cgroup2/**" | ||
- "tests/install/**" | ||
- "tests/integration/**" | ||
- "tests/unitcoverage/**" | ||
pull_request: | ||
paths-ignore: | ||
- "install.sh" | ||
- "tests/cgroup2/**" | ||
- "tests/install/**" | ||
- "tests/integration/**" | ||
- "tests/unitcoverage/**" | ||
workflow_dispatch: {} | ||
jobs: | ||
build: | ||
name: "Build" | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 40 | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
- name: "Build" | ||
run: DOCKER_BUILDKIT=1 SKIP_VALIDATE=1 make | ||
- name: "Upload Binary" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: k3s | ||
path: dist/artifacts/k3s | ||
- name: "Upload Images" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: k3s-airgap-images-amd64.tar | ||
path: dist/artifacts/k3s-airgap-images-amd64.tar | ||
test: | ||
name: "Test" | ||
# nested virtualization is only available on macOS hosts | ||
runs-on: macos-10.15 | ||
needs: build | ||
timeout-minutes: 40 | ||
strategy: | ||
matrix: | ||
vm: [opensuse-leap] | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
- name: "Download Binary" | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: k3s | ||
path: dist/artifacts/ | ||
- name: "Download Images" | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: k3s-airgap-images-amd64.tar | ||
path: dist/artifacts/ | ||
- name: "Vagrant Plugin(s)" | ||
working-directory: tests/snapshotter/btrfs/${{ matrix.vm }} | ||
run: vagrant plugin install vagrant-k3s | ||
- name: "Vagrant VM" | ||
working-directory: tests/snapshotter/btrfs/${{ matrix.vm }} | ||
env: | ||
VAGRANT_EXPERIMENTAL: disks | ||
run: vagrant up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
# | ||
|
||
ENV['TEST_VM_NAME'] ||= 'snapshotter-btrfs' | ||
ENV['TEST_VM_HOSTNAME'] ||= 'test' | ||
|
||
Vagrant.configure("2") do |config| | ||
config.vagrant.plugins = { | ||
'vagrant-k3s' => {:version => '~> 0.1.3'}, | ||
} | ||
config.vm.define ENV['TEST_VM_NAME'], primary: true do |test| | ||
test.vm.box = "opensuse/Leap-15.3.x86_64" | ||
test.vm.hostname = ENV['TEST_VM_HOSTNAME'] | ||
test.vm.provision 'k3s-prepare', type: 'shell', run: 'once', privileged: true do |sh| | ||
sh.inline = <<~EOF | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
zypper install -y btrfsprogs hostname | ||
mkdir -p /var/lib/rancher/k3s /etc/rancher/k3s /usr/local/bin | ||
if ! mountpoint -q /var/lib/rancher/k3s; then | ||
: ${BTRFS_DEV:=#{ENV['BTRFS_DEV']}} | ||
for disk in sd[b-d] vd[b-d] xd[b-d]; do | ||
if [ -n "${BTRFS_DEV}" ]; then break; fi | ||
: ${BTRFS_DEV:=$(test -b /dev/$disk && echo $disk)} | ||
done | ||
btrfs filesystem show /dev/${BTRFS_DEV:?unable to determine automatically, please specify} 2>/dev/null || mkfs -t btrfs /dev/${BTRFS_DEV} | ||
mountpoint -q /mnt || mount -t btrfs /dev/${BTRFS_DEV} /mnt | ||
btrfs subvolume show /mnt/@k3s 2>/dev/null || btrfs subvolume create /mnt/@k3s | ||
umount /mnt | ||
mount -t btrfs -o subvol=@k3s /dev/${BTRFS_DEV} /var/lib/rancher/k3s | ||
fi | ||
if [ -e /vagrant/k3s ]; then | ||
cp -vf /vagrant/k3s /usr/local/bin/ | ||
chmod -v +x /usr/local/bin/k3s | ||
fi | ||
if [ -e /vagrant/*.tar ]; then | ||
mkdir -vp /var/lib/rancher/k3s/agent/images | ||
for tar in /vagrant/*.tar; do | ||
cp -vf $tar /var/lib/rancher/k3s/agent/images/ | ||
done | ||
fi | ||
EOF | ||
end | ||
test.vm.provision 'k3s-install', type: 'k3s', run: 'once' do |k3s| | ||
k3s.args = %w[server --snapshotter=btrfs] | ||
k3s.env = %w[INSTALL_K3S_NAME=server INSTALL_K3S_SKIP_DOWNLOAD=true K3S_TOKEN=vagrant] | ||
k3s.config = { | ||
'disable' => %w[local-storage metrics-server servicelb traefik], | ||
'disable-helm-controller' => true, | ||
'disable-network-policy' => true, | ||
'write-kubeconfig-mode' => '0644', | ||
} | ||
k3s.config_mode = '0644' # side-step https://github.com/k3s-io/k3s/issues/4321 | ||
end | ||
test.vm.provision "k3s-ready", type: "shell", run: "once" do |sh| | ||
sh.env = { :PATH => "/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" } | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
echo 'Waiting for node to be ready ...' | ||
time timeout 120 bash -c 'while ! (kubectl wait --for condition=ready node/$(hostname) 2>/dev/null); do sleep 5; done' | ||
time timeout 300 bash -c 'while ! (kubectl --namespace kube-system rollout status --timeout 10s deploy/coredns 2>/dev/null); do sleep 5; done' | ||
SHELL | ||
end | ||
test.vm.provision "k3s-status", type: "shell", run: "once" do |sh| | ||
sh.env = { :PATH => "/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin" } | ||
sh.inline = <<~SHELL | ||
#!/usr/bin/env bash | ||
set -eux -o pipefail | ||
kubectl get node,all -A -o wide | ||
btrfs subvolume list /var/lib/rancher/k3s/agent/containerd/io.containerd.snapshotter.v1.btrfs | ||
SHELL | ||
end | ||
end | ||
|
||
%w[hyperv libvirt virtualbox vmware_desktop].each do |p| | ||
config.vm.provider p do |v| | ||
v.cpus = ENV['CPUS'] || 2 | ||
v.memory = ENV['MEMORY'] || 2048 | ||
end | ||
end | ||
|
||
config.vm.provider :hyperv do |v,o| | ||
o.vm.disk :disk, name: "btrfs", size: "8GB" # Requires VAGRANT_EXPERIMENTAL="disks" | ||
end | ||
|
||
config.vm.provider :libvirt do |v,o| | ||
v.storage :file, :size => '8G' | ||
end | ||
|
||
config.vm.provider :virtualbox do |v,o| | ||
v.gui = false | ||
v.check_guest_additions = false | ||
o.vm.disk :disk, name: "btrfs", size: "8GB" # Requires VAGRANT_EXPERIMENTAL="disks" | ||
end | ||
|
||
config.vm.synced_folder '../../../../dist/artifacts', '/vagrant', type: 'rsync', disabled: ['1', 'true'].include?(ENV['RSYNC_DISABLE']), | ||
rsync__exclude: ENV['RSYNC_EXCLUDE'] || '*.tar.*' | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.