-
-
Save blessedwithsins/da3678e236059db80e0c2b5f36769528 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: DaemonSet | |
apiVersion: apps/v1 | |
metadata: | |
name: downgradecontainerd | |
namespace: kube-system | |
labels: | |
app: downgradecontainerd | |
spec: | |
selector: | |
matchLabels: | |
name: downgradecontainerd | |
template: | |
metadata: | |
labels: | |
name: downgradecontainerd | |
spec: | |
hostPID: true | |
hostNetwork: true | |
nodeSelector: | |
beta.kubernetes.io/os: linux | |
containers: | |
- name: nsenter | |
image: mcr.microsoft.com/azure-policy/alpine:prod_20200505.1 | |
imagePullPolicy: IfNotPresent | |
securityContext: | |
privileged: true | |
command: | |
- nsenter | |
- --target | |
- "1" | |
- --mount | |
- --uts | |
- --ipc | |
- --net | |
- --pid | |
- -- | |
- sh | |
- -c | |
- | | |
#! /bin/sh | |
set -u | |
while true; do | |
CURRENT_VERSION=$(containerd -version | cut -d " " -f 3 | sed 's|v||' | cut -d "+" -f 1) | |
echo "running containerd ${CURRENT_VERSION}" | |
if [ $CURRENT_VERSION != "1.4.4" ]; then | |
echo "running containerd ${CURRENT_VERSION}, no need to downgrade" | |
sleep infinity | |
fi | |
echo "downgrading to containerd v1.4.3" | |
apt-get -y -f install moby-containerd=1.4.3* moby-runc=1.0.0~rc92* --allow-downgrades | |
if [ $? -ne 0 ]; then | |
echo "downgrade was not successful, exited with status $?" | |
exit 1 | |
fi | |
CURRENT_VERSION=$(containerd -version | cut -d " " -f 3 | sed 's|v||' | cut -d "+" -f 1) | |
if [ $CURRENT_VERSION != "1.4.3" ]; then | |
echo "containerd version ${CURRENT_VERSION} not at 1.4.3" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment