Skip to content

Commit

Permalink
add cgroup2 CI
Browse files Browse the repository at this point in the history
  • Loading branch information
AkihiroSuda committed Jan 21, 2021
1 parent f8e85d7 commit 1c76d71
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/cgroup2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Cgroup v2

on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
docker:
name: Cgroup v2
# nested virtualization is only available on macOS hosts
runs-on: macos-10.15
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
provider: [docker, podman]
env:
KIND_EXPERIMENTAL_PROVIDER: "${{ matrix.provider }}"
HELPER: "./hack/ci/vagrant-helper.sh"
JOB_NAME: "cgroup2-${{ matrix.provider }}"
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Boot Fedora
run: |
ln -sf ./hack/ci/Vagrantfile ./Vagrantfile
vagrant up
- name: Show provider info
run: |
"$HELPER" "$KIND_EXPERIMENTAL_PROVIDER" info
"$HELPER" "$KIND_EXPERIMENTAL_PROVIDER" version
- name: Create a cluster
run: |
"$HELPER" kind create cluster -v7 --wait 1m --retain
- name: Get Cluster status
run: |
"$HELPER" kubectl wait --for=condition=ready pods --namespace=kube-system -l k8s-app=kube-dns
"$HELPER" kubectl get nodes -o wide
"$HELPER" kubectl get pods -A
- name: Export logs
if: always()
run: |
"$HELPER" kind export logs /tmp/kind/logs
mkdir -p /tmp/kind/logs
"$HELPER" tar cC /tmp/kind/logs . | tar xC /tmp/kind/logs
- name: Upload logs
if: always()
uses: actions/upload-artifact@v2
with:
name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }}
path: /tmp/kind/logs
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# macOS
.DS_Store

# Vagrant
.vagrant

# files generated by editors
.idea/
*.iml
Expand Down
34 changes: 34 additions & 0 deletions hack/ci/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrant box for testing kind with cgroup v2
Vagrant.configure("2") do |config|
config.vm.box = "fedora/33-cloud-base"
memory = 2048
cpus = 2
config.vm.provider :virtualbox do |v|
v.memory = memory
v.cpus = cpus
end
config.vm.provider :libvirt do |v|
v.memory = memory
v.cpus = cpus
end
config.vm.provision "install-packages", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
set -eux -o pipefail
dnf install -y golang-go make kubernetes-client podman
# The moby-engine package (v19.03) included in Fedora 33 does not support cgroup v2.
# So we need to install Docker 20.10 (or later) from the upstream.
curl -fsSL https://get.docker.com | sh
systemctl enable --now docker
SHELL
end
config.vm.provision "install-kind", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
set -eux -o pipefail
make -C /vagrant install INSTALL_DIR=/usr/local/bin
SHELL
end
end
25 changes: 25 additions & 0 deletions hack/ci/vagrant-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Copyright 2021 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit -o nounset -o pipefail


: "${KIND_EXPERIMENTAL_PROVIDER:=docker}"
SSH_CONFIG=".vagrant/ssh-config"
if [ ! -f "$SSH_CONFIG" ]; then
vagrant ssh-config > "$SSH_CONFIG"
fi

exec ssh -F "$SSH_CONFIG" default sudo KIND_EXPERIMENTAL_PROVIDER="$KIND_EXPERIMENTAL_PROVIDER" "$@"

0 comments on commit 1c76d71

Please sign in to comment.