*: initial wire in of crictl from cri-tools
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
8088d7a1e2
commit
49bdd59406
3 changed files with 58 additions and 27 deletions
11
Dockerfile
11
Dockerfile
|
@ -76,6 +76,17 @@ RUN set -x \
|
||||||
&& cp bin/* /opt/cni/bin/ \
|
&& cp bin/* /opt/cni/bin/ \
|
||||||
&& rm -rf "$GOPATH"
|
&& rm -rf "$GOPATH"
|
||||||
|
|
||||||
|
# Install crictl
|
||||||
|
ENV CRICTL_COMMIT a2d0e8f7bc7e80111a7d79052ab9aca3469609aa
|
||||||
|
RUN set -x \
|
||||||
|
&& export GOPATH="$(mktemp -d)" \
|
||||||
|
&& git clone https://github.com/kubernetes-incubator/cri-tools.git "$GOPATH/src/github.com/kubernetes-incubator/cri-tools" \
|
||||||
|
&& cd "$GOPATH/src/github.com/kubernetes-incubator/cri-tools" \
|
||||||
|
&& git checkout -q "$CRICTL_COMMIT" \
|
||||||
|
&& go install github.com/kubernetes-incubator/cri-tools/cmd/crictl \
|
||||||
|
&& cp "$GOPATH"/bin/crictl /usr/bin/ \
|
||||||
|
&& rm -rf "$GOPATH"
|
||||||
|
|
||||||
COPY test/plugin_test_args.bash /opt/cni/bin/plugin_test_args.bash
|
COPY test/plugin_test_args.bash /opt/cni/bin/plugin_test_args.bash
|
||||||
|
|
||||||
# Make sure we have some policy for pulling images
|
# Make sure we have some policy for pulling images
|
||||||
|
|
|
@ -127,6 +127,12 @@
|
||||||
async: 600
|
async: 600
|
||||||
poll: 10
|
poll: 10
|
||||||
when: xunit
|
when: xunit
|
||||||
|
- name: git clone crictl repo
|
||||||
|
git:
|
||||||
|
repo: https://github.com/kubernetes-incubator/cri-tools
|
||||||
|
dest: /root/src/github.com/kubernetes-incubator/cri-tools
|
||||||
|
async: 600
|
||||||
|
poll: 10
|
||||||
- name: git clone runc repo
|
- name: git clone runc repo
|
||||||
git:
|
git:
|
||||||
repo: https://github.com/opencontainers/runc
|
repo: https://github.com/opencontainers/runc
|
||||||
|
@ -193,6 +199,12 @@
|
||||||
chdir: /root/src/github.com/opencontainers/runc
|
chdir: /root/src/github.com/opencontainers/runc
|
||||||
async: 600
|
async: 600
|
||||||
poll: 10
|
poll: 10
|
||||||
|
- name: make crictl
|
||||||
|
shell: |
|
||||||
|
go install github.com/kubernetes-incubator/cri-tools/cmd/crictl && \
|
||||||
|
cp $GOPATH/bin/crictl /usr/bin/crictl
|
||||||
|
args:
|
||||||
|
chdir: /root/src/github.com/kubernetes-incubator/cri-o/
|
||||||
- name: make runc
|
- name: make runc
|
||||||
make:
|
make:
|
||||||
params: BUILDTAGS="seccomp selinux"
|
params: BUILDTAGS="seccomp selinux"
|
||||||
|
|
|
@ -11,8 +11,9 @@ CRIO_ROOT=${CRIO_ROOT:-$(cd "$INTEGRATION_ROOT/../.."; pwd -P)}
|
||||||
|
|
||||||
# Path of the crio binary.
|
# Path of the crio binary.
|
||||||
CRIO_BINARY=${CRIO_BINARY:-${CRIO_ROOT}/cri-o/crio}
|
CRIO_BINARY=${CRIO_BINARY:-${CRIO_ROOT}/cri-o/crio}
|
||||||
# Path of the crioctl binary.
|
# Path of the crictl binary.
|
||||||
OCIC_BINARY=${OCIC_BINARY:-${CRIO_ROOT}/cri-o/crioctl}
|
CRICTL_PATH=$(command -v crictl || true)
|
||||||
|
CRICTL_BINARY=${CRICTL_PATH:-/usr/bin/crictl}
|
||||||
# Path to kpod binary.
|
# Path to kpod binary.
|
||||||
KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/cri-o/kpod}
|
KPOD_BINARY=${KPOD_BINARY:-${CRIO_ROOT}/cri-o/kpod}
|
||||||
# Path of the conmon binary.
|
# Path of the conmon binary.
|
||||||
|
@ -151,11 +152,18 @@ function crio() {
|
||||||
"$CRIO_BINARY" --listen "$CRIO_SOCKET" "$@"
|
"$CRIO_BINARY" --listen "$CRIO_SOCKET" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# DEPRECATED
|
||||||
|
OCIC_BINARY=${OCIC_BINARY:-${CRIO_ROOT}/cri-o/crioctl}
|
||||||
# Run crioctl using the binary specified by $OCIC_BINARY.
|
# Run crioctl using the binary specified by $OCIC_BINARY.
|
||||||
function crioctl() {
|
function crioctl() {
|
||||||
"$OCIC_BINARY" --connect "$CRIO_SOCKET" "$@"
|
"$OCIC_BINARY" --connect "$CRIO_SOCKET" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run crictl using the binary specified by $CRICTL_BINARY.
|
||||||
|
function crictl() {
|
||||||
|
"$CRICTL_BINARY" -r "$CRIO_SOCKET" -i "$CRIO_SOCKET" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# Communicate with Docker on the host machine.
|
# Communicate with Docker on the host machine.
|
||||||
# Should rarely use this.
|
# Should rarely use this.
|
||||||
function docker_host() {
|
function docker_host() {
|
||||||
|
@ -184,7 +192,7 @@ function retry() {
|
||||||
|
|
||||||
# Waits until the given crio becomes reachable.
|
# Waits until the given crio becomes reachable.
|
||||||
function wait_until_reachable() {
|
function wait_until_reachable() {
|
||||||
retry 15 1 crioctl runtimeversion
|
retry 15 1 crictl status
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start crio.
|
# Start crio.
|
||||||
|
@ -228,14 +236,14 @@ function start_crio() {
|
||||||
"$CRIO_BINARY" --debug --config "$CRIO_CONFIG" & CRIO_PID=$!
|
"$CRIO_BINARY" --debug --config "$CRIO_CONFIG" & CRIO_PID=$!
|
||||||
wait_until_reachable
|
wait_until_reachable
|
||||||
|
|
||||||
run crioctl image status --id=redis:alpine
|
run crictl image status redis:alpine
|
||||||
if [ "$status" -ne 0 ] ; then
|
if [ "$status" -ne 0 ] ; then
|
||||||
crioctl image pull redis:alpine
|
crictl image pull redis:alpine
|
||||||
fi
|
fi
|
||||||
REDIS_IMAGEID=$(crioctl image status --id=redis:alpine | head -1 | sed -e "s/ID: //g")
|
REDIS_IMAGEID=$(crictl image status redis:alpine | head -1 | sed -e "s/ID: //g")
|
||||||
run crioctl image status --id=mrunalp/oom
|
run crictl image status mrunalp/oom
|
||||||
if [ "$status" -ne 0 ] ; then
|
if [ "$status" -ne 0 ] ; then
|
||||||
crioctl image pull mrunalp/oom
|
crictl image pull mrunalp/oom
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -248,63 +256,63 @@ function start_crio() {
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
REDIS_IMAGEID_DIGESTED="redis@sha256:03789f402b2ecfb98184bf128d180f398f81c63364948ff1454583b02442f73b"
|
REDIS_IMAGEID_DIGESTED="redis@sha256:03789f402b2ecfb98184bf128d180f398f81c63364948ff1454583b02442f73b"
|
||||||
run crioctl image status --id $REDIS_IMAGEID_DIGESTED
|
run crictl image status $REDIS_IMAGEID_DIGESTED
|
||||||
if [ "$status" -ne 0 ]; then
|
if [ "$status" -ne 0 ]; then
|
||||||
crioctl image pull $REDIS_IMAGEID_DIGESTED
|
crictl image pull $REDIS_IMAGEID_DIGESTED
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
run crioctl image status --id=runcom/stderr-test
|
run crictl image status runcom/stderr-test
|
||||||
if [ "$status" -ne 0 ] ; then
|
if [ "$status" -ne 0 ] ; then
|
||||||
crioctl image pull runcom/stderr-test:latest
|
crictl image pull runcom/stderr-test:latest
|
||||||
fi
|
fi
|
||||||
STDERR_IMAGEID=$(crioctl image status --id=runcom/stderr-test | head -1 | sed -e "s/ID: //g")
|
STDERR_IMAGEID=$(crictl image status runcom/stderr-test | head -1 | sed -e "s/ID: //g")
|
||||||
run crioctl image status --id=busybox
|
run crictl image status busybox
|
||||||
if [ "$status" -ne 0 ] ; then
|
if [ "$status" -ne 0 ] ; then
|
||||||
crioctl image pull busybox:latest
|
crictl image pull busybox:latest
|
||||||
fi
|
fi
|
||||||
BUSYBOX_IMAGEID=$(crioctl image status --id=busybox | head -1 | sed -e "s/ID: //g")
|
BUSYBOX_IMAGEID=$(crictl image status busybox | head -1 | sed -e "s/ID: //g")
|
||||||
run crioctl image status --id=mrunalp/image-volume-test
|
run crictl image status mrunalp/image-volume-test
|
||||||
if [ "$status" -ne 0 ] ; then
|
if [ "$status" -ne 0 ] ; then
|
||||||
crioctl image pull mrunalp/image-volume-test:latest
|
crictl image pull mrunalp/image-volume-test:latest
|
||||||
fi
|
fi
|
||||||
VOLUME_IMAGEID=$(crioctl image status --id=mrunalp/image-volume-test | head -1 | sed -e "s/ID: //g")
|
VOLUME_IMAGEID=$(crictl image status mrunalp/image-volume-test | head -1 | sed -e "s/ID: //g")
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_ctrs() {
|
function cleanup_ctrs() {
|
||||||
run crioctl ctr list --quiet
|
run crictl ctr ls --quiet
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
if [ "$output" != "" ]; then
|
if [ "$output" != "" ]; then
|
||||||
printf '%s\n' "$output" | while IFS= read -r line
|
printf '%s\n' "$output" | while IFS= read -r line
|
||||||
do
|
do
|
||||||
crioctl ctr stop --id "$line"
|
crictl ctr stop "$line"
|
||||||
crioctl ctr remove --id "$line"
|
crictl ctr rm "$line"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_images() {
|
function cleanup_images() {
|
||||||
run crioctl image list --quiet
|
run crictl image ls --quiet
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
if [ "$output" != "" ]; then
|
if [ "$output" != "" ]; then
|
||||||
printf '%s\n' "$output" | while IFS= read -r line
|
printf '%s\n' "$output" | while IFS= read -r line
|
||||||
do
|
do
|
||||||
crioctl image remove --id "$line"
|
crictl image rm "$line"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup_pods() {
|
function cleanup_pods() {
|
||||||
run crioctl pod list --quiet
|
run crictl sandbox ls --quiet
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
if [ "$output" != "" ]; then
|
if [ "$output" != "" ]; then
|
||||||
printf '%s\n' "$output" | while IFS= read -r line
|
printf '%s\n' "$output" | while IFS= read -r line
|
||||||
do
|
do
|
||||||
crioctl pod stop --id "$line"
|
crictl sandbox stop "$line"
|
||||||
crioctl pod remove --id "$line"
|
crictl sandbox rm "$line"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue