fix(linkerd2-cni): execute container preStop command `kill` command as shell builtin (#5453)

The container-image `ghcr.io/linkerd/cni-plugin:stable-2.9.1` does not contain the `kill` command as an executable. Instead, it is available as a shell built-in. In its current state, Kubernetes emits error events whenever linkerd2-cni pods are terminated because the `kill` command can not be found.

Signed-off-by: Mitch Hulscher <mitch.hulscher@lib.io>
This commit is contained in:
Mitch Hulscher 2021-01-07 16:24:24 +01:00 committed by GitHub
parent 57460bdc42
commit 462fe32ef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 48 additions and 8 deletions

View File

@ -220,9 +220,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
{{- if ne .Values.destCNIBinDir .Values.destCNINetDir }} {{- if ne .Values.destCNIBinDir .Values.destCNINetDir }}
- mountPath: /host{{.Values.destCNIBinDir}} - mountPath: /host{{.Values.destCNIBinDir}}

View File

@ -185,9 +185,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/opt/cni/bin - mountPath: /host/opt/cni/bin
name: cni-bin-dir name: cni-bin-dir

View File

@ -186,9 +186,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/opt/my-cni/bin - mountPath: /host/opt/my-cni/bin
name: cni-bin-dir name: cni-bin-dir

View File

@ -186,9 +186,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/etc/kubernetes/cni/net.d - mountPath: /host/etc/kubernetes/cni/net.d
name: cni-net-dir name: cni-net-dir

View File

@ -176,9 +176,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/opt/my-cni/bin - mountPath: /host/opt/my-cni/bin
name: cni-bin-dir name: cni-bin-dir

View File

@ -185,9 +185,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/opt/cni/bin - mountPath: /host/opt/cni/bin
name: cni-bin-dir name: cni-bin-dir

View File

@ -187,9 +187,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/opt/cni/bin - mountPath: /host/opt/cni/bin
name: cni-bin-dir name: cni-bin-dir

View File

@ -188,9 +188,14 @@ spec:
- name: SLEEP - name: SLEEP
value: "true" value: "true"
lifecycle: lifecycle:
# In some edge-cases this helps ensure that cleanup() is called in the container's script
# https://github.com/linkerd/linkerd2/issues/2355
preStop: preStop:
exec: exec:
command: ["kill","-15","1"] command:
- /bin/sh
- -c
- kill -15 1
volumeMounts: volumeMounts:
- mountPath: /host/opt/cni/bin-test - mountPath: /host/opt/cni/bin-test
name: cni-bin-dir name: cni-bin-dir