Skip to content

Commit

Permalink
Install crictl in Agent containers (#418)
Browse files Browse the repository at this point in the history
Signed-off-by: Kate Goldenring <[email protected]>
  • Loading branch information
kate-goldenring authored Nov 23, 2021
1 parent 9ca234e commit e462573
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 68 deletions.
30 changes: 3 additions & 27 deletions .github/workflows/run-test-cases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,58 +105,40 @@ jobs:
kube:
- runtime: MicroK8s-1.16
version: 1.16/stable
crictl: v1.16.0
- runtime: MicroK8s-1.17
version: 1.17/stable
crictl: v1.16.0
- runtime: MicroK8s-1.18
version: 1.18/stable
crictl: v1.17.0
- runtime: MicroK8s-1.19
version: 1.19/stable
crictl: v1.17.0
- runtime: MicroK8s-1.20
version: 1.20/stable
crictl: v1.17.0
- runtime: MicroK8s-1.21
version: 1.21/stable
crictl: v1.17.0
- runtime: K3s-1.16
version: v1.16.14+k3s1
crictl: v1.16.0
- runtime: K3s-1.17
version: v1.17.17+k3s1
crictl: v1.16.0
- runtime: K3s-1.18
version: v1.18.9+k3s1
crictl: v1.17.0
- runtime: K3s-1.19
version: v1.19.10+k3s1
crictl: v1.17.0
- runtime: K3s-1.20
version: v1.20.6+k3s1
crictl: v1.17.0
- runtime: K3s-1.21
version: v1.21.5+k3s1
crictl: v1.17.0
- runtime: Kubernetes-1.16
version: 1.16.15-00
crictl: UNUSED
- runtime: Kubernetes-1.17
version: 1.17.14-00
crictl: UNUSED
- runtime: Kubernetes-1.18
version: 1.18.12-00
crictl: UNUSED
- runtime: Kubernetes-1.19
version: 1.19.4-00
crictl: UNUSED
- runtime: Kubernetes-1.20
version: 1.20.1-00
crictl: UNUSED
- runtime: Kubernetes-1.21
version: 1.21.0-00
crictl: UNUSED
test:
- case: end-to-end
file: test/run-end-to-end.py
Expand Down Expand Up @@ -209,10 +191,7 @@ jobs:
sudo chmod g+r /etc/rancher/k3s/k3s.yaml
sudo chmod 666 /etc/rancher/k3s/*
mkdir -p ~/.kube/ && cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/${{ matrix.kube.crictl }}/crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz --output crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz
sudo tar zxvf crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz
echo "--set agent.host.crictl=/usr/local/bin/crictl --set agent.host.dockerShimSock=/run/k3s/containerd/containerd.sock" > /tmp/cri_args_to_test.txt
echo "--set agent.host.dockerShimSock=/run/k3s/containerd/containerd.sock" > /tmp/cri_args_to_test.txt
echo 'kubectl' > /tmp/runtime_cmd_to_test.txt
echo '~/.kube/config' > /tmp/kubeconfig_path_to_test.txt
until kubectl get node ${HOSTNAME,,} -o jsonpath='{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status}' | grep 'Ready=True'; do echo "waiting for k3s to become ready"; sleep 10; done
Expand Down Expand Up @@ -249,7 +228,7 @@ jobs:
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl taint nodes --all node-role.kubernetes.io/master-
echo '--set agent.host.crictl=/usr/bin/crictl --set agent.host.dockerShimSock=/var/run/dockershim.sock' > /tmp/cri_args_to_test.txt
echo '--set agent.host.dockerShimSock=/var/run/dockershim.sock' > /tmp/cri_args_to_test.txt
echo 'kubectl' > /tmp/runtime_cmd_to_test.txt
echo '~/.kube/config' > /tmp/kubeconfig_path_to_test.txt
until kubectl get node ${HOSTNAME,,} -o jsonpath='{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status}' | grep 'Ready=True'; do echo "waiting for kubernetes to become ready"; sleep 10; done
Expand Down Expand Up @@ -277,10 +256,7 @@ jobs:
sudo sed -i 's/memory.available<100Mi,nodefs.available<1Gi,imagefs.available<1Gi/memory.available<25Mi,nodefs.available<50Mi,imagefs.available<50Mi/' /var/snap/microk8s/current/args/kubelet
sudo systemctl restart snap.microk8s.daemon-kubelet
until sudo microk8s.status --wait-ready; do sleep 5s; echo "Try again"; done
curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/${{ matrix.kube.crictl }}/crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz --output crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz
sudo tar zxvf crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-${{ matrix.kube.crictl }}-linux-amd64.tar.gz
echo '--set agent.host.crictl=/usr/local/bin/crictl --set agent.host.dockerShimSock=/var/snap/microk8s/common/run/containerd.sock' > /tmp/cri_args_to_test.txt
echo '--set agent.host.dockerShimSock=/var/snap/microk8s/common/run/containerd.sock' > /tmp/cri_args_to_test.txt
echo 'microk8s kubectl' > /tmp/runtime_cmd_to_test.txt
echo '~/.kube/config' > /tmp/kubeconfig_path_to_test.txt
Expand Down
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "agent"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>", "<[email protected]>"]
edition = "2018"

Expand Down
9 changes: 8 additions & 1 deletion build/containers/Dockerfile.agent
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}"
# Link the container to the Akri repository
LABEL org.opencontainers.image.source https://github.com/project-akri/akri

RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean
# Install crictl and openssl dependencies
RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl curl ca-certificates && \
VERSION="v1.17.0" && \
curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz --output crictl-$VERSION-linux-amd64.tar.gz && \
tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin && \
rm -f crictl-$VERSION-linux-amd64.tar.gz && \
apt-get remove -y curl ca-certificates && apt-get clean

COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/agent /agent
ENV RUST_LOG agent,akri_shared
CMD ["./agent"]
8 changes: 7 additions & 1 deletion build/containers/Dockerfile.agent-full
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ RUN echo "Using Rust binaries from ${CROSS_BUILD_TARGET}/${BUILD_TYPE}"
# Link the container to the Akri repository
LABEL org.opencontainers.image.source https://github.com/project-akri/akri

RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl && apt-get clean
RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev openssl curl ca-certificates && \
VERSION="v1.17.0" && \
curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz --output crictl-$VERSION-linux-amd64.tar.gz && \
tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin && \
rm -f crictl-$VERSION-linux-amd64.tar.gz && \
apt-get remove -y curl ca-certificates && apt-get clean

COPY ./target/${CROSS_BUILD_TARGET}/${BUILD_TYPE}/agent-full /agent
ENV RUST_LOG agent,akri_shared,akri_debug_echo
CMD ["./agent"]
2 changes: 1 addition & 1 deletion controller/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "controller"
version = "0.7.5"
version = "0.7.6"
authors = ["<[email protected]>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions deployment/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.7.5
version: 0.7.6

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 0.7.5
appVersion: 0.7.6
7 changes: 1 addition & 6 deletions deployment/helm/templates/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ spec:
value: {{ .Values.debugEcho.configuration.shared | quote }}
{{- end }}
- name: HOST_CRICTL_PATH
value: /host/usr/bin/crictl
value: /usr/local/bin/crictl
- name: HOST_RUNTIME_ENDPOINT
value: unix:///host/var/run/dockershim.sock
- name: HOST_IMAGE_ENDPOINT
Expand All @@ -79,8 +79,6 @@ spec:
mountPath: /var/lib/akri
- name: device-plugin
mountPath: /var/lib/kubelet/device-plugins
- name: usr-bin-crictl
mountPath: /host/usr/bin/crictl
- name: var-run-dockershim
mountPath: /host/var/run/dockershim.sock
{{- if .Values.agent.host.udev }}
Expand All @@ -103,9 +101,6 @@ spec:
- name: device-plugin
hostPath:
path: "{{ .Values.agent.host.kubeletDevicePlugins }}"
- name: usr-bin-crictl
hostPath:
path: "{{ .Values.agent.host.crictl }}"
- name: var-run-dockershim
hostPath:
path: "{{ .Values.agent.host.dockerShimSock }}"
Expand Down
2 changes: 0 additions & 2 deletions deployment/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ agent:
discoveryHandlers: /var/lib/akri
# kubeletDevicePlugins is the location of the kubelet device-plugin sockets
kubeletDevicePlugins: /var/lib/kubelet/device-plugins
# crictl is the node path to crictl
crictl: /usr/bin/crictl
# dockerShimSock is the node path of the docker socket
dockerShimSock: /var/run/dockershim.sock
# udev is the node path of udev, usually at `/run/udev`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "debug-echo-discovery-handler"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "onvif-discovery-handler"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "opcua-discovery-handler"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "udev-discovery-handler"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/debug-echo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akri-debug-echo"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/onvif/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akri-onvif"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/opcua/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akri-opcua"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-handlers/udev/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akri-udev"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion discovery-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akri-discovery-utils"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion samples/brokers/udev-video-broker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "udev-video-broker"
version = "0.7.5"
version = "0.7.6"
authors = ["Kate Goldenring <[email protected]>", "<[email protected]>"]
edition = "2018"

Expand Down
Loading

0 comments on commit e462573

Please sign in to comment.