#!/bin/bash # Copyright The containerd 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 -euo pipefail REMOTE_SNAPSHOT_LABEL="containerd.io/snapshot/remote" TEST_POD_NAME=testpod-$(head /dev/urandom | tr -dc a-z0-9 | head -c 10) TEST_POD_NS=ns1 TEST_CONTAINER_NAME=testcontainer-$(head /dev/urandom | tr -dc a-z0-9 | head -c 10) K3S_NODENAME="${1}" K3S_KUBECONFIG="${2}" TESTIMAGE="${3}" echo "Creating testing pod...." cat < 100" exit 1 fi ((LAYERSNUM+=1)) LABEL=$(docker exec -i "${K3S_NODENAME}" ctr --namespace="k8s.io" \ snapshots --snapshotter=stargz info "${LAYER}" \ | jq -r ".Labels.\"${REMOTE_SNAPSHOT_LABEL}\"") echo "Checking layer ${LAYER} : ${LABEL}" if [ "${LABEL}" == "null" ] ; then echo "layer ${LAYER} isn't remote snapshot" exit 1 fi done if [ ${LAYERSNUM} -eq 0 ] ; then echo "cannot get layers" exit 1 fi exit 0