Skip to content

Commit

Permalink
Merge pull request #2874 from BenTheElder/fuseblk
Browse files Browse the repository at this point in the history
rework snapshotter selection, detect fuseblk and use overlayfs-fuse
  • Loading branch information
k8s-ci-robot authored Aug 18, 2022
2 parents 8eb4a13 + 391395e commit 7ad4201
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
30 changes: 22 additions & 8 deletions images/base/files/usr/local/bin/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,36 @@ overlayfs_preferrable() {

configure_containerd() {
local snapshotter=${KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER:-}
if [[ -n "$userns" ]]; then
# userns (rootless) configs

# Adjust oomScoreAdj
# handle userns (rootless)
if [[ -n "$userns" ]]; then
# enable restrict_oom_score_adj
sed -i 's/restrict_oom_score_adj = false/restrict_oom_score_adj = true/' /etc/containerd/config.toml

# Use fuse-overlayfs if overlayfs is not preferrable: https://github.com/kubernetes-sigs/kind/issues/2275
if [[ -z "$snapshotter" ]] && ! overlayfs_preferrable; then
snapshotter="fuse-overlayfs"
fi
else
# we need to switch to the 'native' snapshotter on zfs
if [[ -z "$snapshotter" ]] && [[ "$(stat -f -c %T /kind)" == 'zfs' ]]; then
snapshotter="native"
fi

# if we have not already overridden the snapshotter, attempt to auto select
if [[ -z "$snapshotter" ]]; then
# we need to switch to 'native' or 'fuse-overlayfs' on zfs
container_filesystem="$(stat -f -c %T /kind)"
if [[ "$container_filesystem" == 'zfs' ]]; then
# if fuse is present, use fuse-overlayfs, else fallback to native
# we do not use the ZFS snapshotter because of skew issues vs the host
if [[ -e /dev/fuse ]]; then
snapshotter="fuse-overlayfs"
else
snapshotter="native"
fi
# fuse likely implies fuse-overlayfs, we should switch to fuse-overlayfs (or native)
elif [[ "$container_filesystem" == 'fuseblk' ]]; then
snapshotter="fuse-overlayfs"
fi
fi

# if we've overridden or auto-selected the snapshotter vs the default, update containerd
if [[ -n "$snapshotter" ]]; then
echo "INFO: changing snapshotter from \"overlayfs\" to \"$snapshotter\""
sed -i "s/snapshotter = \"overlayfs\"/snapshotter = \"$snapshotter\"/" /etc/containerd/config.toml
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/config/defaults/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ limitations under the License.
package defaults

// Image is the default for the Config.Image field, aka the default node image.
const Image = "kindest/node:v1.24.3@sha256:e1a5c449fb2556b5fbba29fb43f28055cacb12ce53d1f281e8be442d0dd5cd1d"
const Image = "kindest/node:v1.24.3@sha256:09961d2443a557dfa59126ce8b5388e9c06610b0276dc0a986a74d3d0f01e53e"
2 changes: 1 addition & 1 deletion pkg/build/nodeimage/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ package nodeimage
const DefaultImage = "kindest/node:latest"

// DefaultBaseImage is the default base image used
const DefaultBaseImage = "docker.io/kindest/base:v20220808-a2dcbb47"
const DefaultBaseImage = "docker.io/kindest/base:v20220811-20da9c7c"

0 comments on commit 7ad4201

Please sign in to comment.