Merge pull request #602 from mikebrow/critools-install-minor-update
update critools
This commit is contained in:
commit
047df7aca6
@ -28,10 +28,10 @@ CHECK_PERIOD=${CHECK_PERIOD:-10}
|
|||||||
SLEEP_SECONDS=${SLEEP_SECONDS:-120}
|
SLEEP_SECONDS=${SLEEP_SECONDS:-120}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# Use crictl sandboxes because it requires both containerd and
|
# Use crictl pods because it requires both containerd and
|
||||||
# cri-containerd to be working.
|
# cri-containerd to be working.
|
||||||
if ! timeout ${COMMAND_TIMEOUT} ${CRICTL} sandboxes > /dev/null; then
|
if ! timeout ${COMMAND_TIMEOUT} ${CRICTL} pods > /dev/null; then
|
||||||
echo "crictl sandboxes timeout!"
|
echo "crictl pods timeout!"
|
||||||
pkill containerd
|
pkill containerd
|
||||||
pkill cri-containerd
|
pkill cri-containerd
|
||||||
# Wait for a while, as we don't want to kill it again before it is really up.
|
# Wait for a while, as we don't want to kill it again before it is really up.
|
||||||
|
@ -50,19 +50,19 @@ $ cat sandbox-config.json
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ crictl runs sandbox-config.json
|
$ crictl runp sandbox-config.json
|
||||||
e1c83b0b8d481d4af8ba98d5f7812577fc175a37b10dc824335951f52addbb4e
|
e1c83b0b8d481d4af8ba98d5f7812577fc175a37b10dc824335951f52addbb4e
|
||||||
$ crictl sandboxes
|
$ crictl pods
|
||||||
SANDBOX ID CREATED STATE NAME NAMESPACE ATTEMPT
|
PODSANDBOX ID CREATED STATE NAME NAMESPACE ATTEMPT
|
||||||
e1c83b0b8d481 2 hours ago SANDBOX_READY nginx-sandbox default 1
|
e1c83b0b8d481 2 hours ago SANDBOX_READY nginx-sandbox default 1
|
||||||
$ crictl inspects e1c8
|
$ crictl inspects e1c8
|
||||||
... displays information about the pod and the sandbox pause container.
|
... displays information about the pod and the pod sandbox pause container.
|
||||||
```
|
```
|
||||||
* Note: As shown above, you may use truncated IDs if they are unique.
|
* Note: As shown above, you may use truncated IDs if they are unique.
|
||||||
* Other commands to manage the pod include `stops ID` to stop a running pod and
|
* Other commands to manage the pod include `stops ID` to stop a running pod and
|
||||||
`rms ID` to remove a pod sandbox.
|
`rmp ID` to remove a pod sandbox.
|
||||||
|
|
||||||
## Create and Run a Container in a Sandbox (using a config file)
|
## Create and Run a Container in a Pod Sandbox (using a config file)
|
||||||
```console
|
```console
|
||||||
$ cat sandbox-config.json
|
$ cat sandbox-config.json
|
||||||
{
|
{
|
||||||
|
@ -29,14 +29,14 @@ crictl_rm_stopped_containers() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
crictl_stop_sandboxes() {
|
crictl_stop_pods() {
|
||||||
for x in $($CRICTL_CLI sandboxes | awk '{ print $1 }' | awk '{if(NR>1)print}') ;do
|
for x in $($CRICTL_CLI pods | awk '{ print $1 }' | awk '{if(NR>1)print}') ;do
|
||||||
$CRICTL_CLI stops $x
|
$CRICTL_CLI stops $x
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
crictl_rm_sandboxes() {
|
crictl_rm_pods() {
|
||||||
for x in $($CRICTL_CLI sandboxes | awk '{ print $1 }' | awk '{if(NR>1)print}') ;do
|
for x in $($CRICTL_CLI pods | awk '{ print $1 }' | awk '{if(NR>1)print}') ;do
|
||||||
$CRICTL_CLI rms $x
|
$CRICTL_CLI rms $x
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -50,6 +50,6 @@ crictl_rm_images() {
|
|||||||
command -v crictl >/dev/null 2>&1 || { echo >&2 "crictl not installed. Install from https://github.com/kubernetes-incubator/cri-tools. Aborting."; exit 2; }
|
command -v crictl >/dev/null 2>&1 || { echo >&2 "crictl not installed. Install from https://github.com/kubernetes-incubator/cri-tools. Aborting."; exit 2; }
|
||||||
crictl_stop_running_containers
|
crictl_stop_running_containers
|
||||||
crictl_rm_stopped_containers
|
crictl_rm_stopped_containers
|
||||||
crictl_stop_sandboxes
|
crictl_stop_pods
|
||||||
crictl_rm_sandboxes
|
crictl_rm_pods
|
||||||
crictl_rm_images
|
crictl_rm_images
|
||||||
|
@ -178,7 +178,7 @@ ${sudo} sh -c "PATH=${PATH} make install -e DESTDIR=${CONTAINERD_DIR}"
|
|||||||
checkout_repo ${CRITOOL_PKG} ${CRITOOL_VERSION}
|
checkout_repo ${CRITOOL_PKG} ${CRITOOL_VERSION}
|
||||||
cd ${GOPATH}/src/${CRITOOL_PKG}
|
cd ${GOPATH}/src/${CRITOOL_PKG}
|
||||||
make crictl
|
make crictl
|
||||||
${sudo} install -D -m 755 ${GOPATH}/bin/crictl ${CRICTL_DIR}/crictl
|
${sudo} make install-crictl -e BINDIR=${CRICTL_DIR} GOPATH=${GOPATH}
|
||||||
${sudo} mkdir -p ${CRICTL_CONFIG_DIR}
|
${sudo} mkdir -p ${CRICTL_CONFIG_DIR}
|
||||||
${sudo} bash -c 'cat >'${CRICTL_CONFIG_DIR}'/crictl.yaml <<EOF
|
${sudo} bash -c 'cat >'${CRICTL_CONFIG_DIR}'/crictl.yaml <<EOF
|
||||||
runtime-endpoint: /var/run/cri-containerd.sock
|
runtime-endpoint: /var/run/cri-containerd.sock
|
||||||
|
@ -2,5 +2,5 @@ RUNC_VERSION=9f9c96235cc97674e935002fc3d78361b696a69e
|
|||||||
CNI_VERSION=v0.6.0
|
CNI_VERSION=v0.6.0
|
||||||
CONTAINERD_VERSION=f12ba2407e328c98f8be5eacbb9c510b073dd4c0
|
CONTAINERD_VERSION=f12ba2407e328c98f8be5eacbb9c510b073dd4c0
|
||||||
CONTAINERD_REPO=
|
CONTAINERD_REPO=
|
||||||
CRITOOL_VERSION=v1.0.0-alpha.0
|
CRITOOL_VERSION=ded07bb08aa23492fa0233bb3af8c4629875f286
|
||||||
KUBERNETES_VERSION=v1.9.0
|
KUBERNETES_VERSION=v1.9.0
|
||||||
|
@ -71,7 +71,7 @@ func (in *instrumentedService) ListPodSandbox(ctx context.Context, r *runtime.Li
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Error("ListPodSandbox failed")
|
logrus.WithError(err).Error("ListPodSandbox failed")
|
||||||
} else {
|
} else {
|
||||||
log.Tracef("ListPodSandbox returns sandboxes %+v", res.GetItems())
|
log.Tracef("ListPodSandbox returns pod sandboxes %+v", res.GetItems())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return in.c.ListPodSandbox(ctx, r)
|
return in.c.ListPodSandbox(ctx, r)
|
||||||
|
@ -452,7 +452,7 @@ func cleanupOrphanedSandboxDirs(cntrs []containerd.Container, sandboxesRoot stri
|
|||||||
// Cleanup orphaned sandbox directories.
|
// Cleanup orphaned sandbox directories.
|
||||||
dirs, err := ioutil.ReadDir(sandboxesRoot)
|
dirs, err := ioutil.ReadDir(sandboxesRoot)
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
return fmt.Errorf("failed to read sandboxes directory %q: %v", sandboxesRoot, err)
|
return fmt.Errorf("failed to read pod sandboxes directory %q: %v", sandboxesRoot, err)
|
||||||
}
|
}
|
||||||
cntrsMap := make(map[string]containerd.Container)
|
cntrsMap := make(map[string]containerd.Container)
|
||||||
for _, cntr := range cntrs {
|
for _, cntr := range cntrs {
|
||||||
@ -460,7 +460,7 @@ func cleanupOrphanedSandboxDirs(cntrs []containerd.Container, sandboxesRoot stri
|
|||||||
}
|
}
|
||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
if !d.IsDir() {
|
if !d.IsDir() {
|
||||||
logrus.Warnf("Invalid file %q found in sandboxes directory", d.Name())
|
logrus.Warnf("Invalid file %q found in pod sandboxes directory", d.Name())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, ok := cntrsMap[d.Name()]; ok {
|
if _, ok := cntrsMap[d.Name()]; ok {
|
||||||
@ -469,9 +469,9 @@ func cleanupOrphanedSandboxDirs(cntrs []containerd.Container, sandboxesRoot stri
|
|||||||
}
|
}
|
||||||
sandboxDir := filepath.Join(sandboxesRoot, d.Name())
|
sandboxDir := filepath.Join(sandboxesRoot, d.Name())
|
||||||
if err := system.EnsureRemoveAll(sandboxDir); err != nil {
|
if err := system.EnsureRemoveAll(sandboxDir); err != nil {
|
||||||
logrus.WithError(err).Warnf("Failed to remove sandbox directory %q", sandboxDir)
|
logrus.WithError(err).Warnf("Failed to remove pod sandbox directory %q", sandboxDir)
|
||||||
} else {
|
} else {
|
||||||
logrus.Debugf("Cleanup orphaned sandbox directory %q", sandboxDir)
|
logrus.Debugf("Cleanup orphaned pod sandbox directory %q", sandboxDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user