To include a way to restart every Longhorn components automatically with the latest image. 1. Now `lm-update.sh` will set `imagePullPolicy: Always` for the manager and the driver. 2. Now update-image-pull-policy.sh will update the `imagePullPolicy` for all the running deployments and daemonsets in the `longhorn-system` namespace, including CSI components. Signed-off-by: Sheng Yang <sheng.yang@rancher.com>
25 lines
556 B
Bash
Executable File
25 lines
556 B
Bash
Executable File
#!/bin/bash
|
|
|
|
NS=longhorn-system
|
|
KINDS="daemonset deployments"
|
|
|
|
function patch_kind {
|
|
kind=$1
|
|
list=$(kubectl -n $NS get $kind -o name)
|
|
for obj in $list
|
|
do
|
|
echo Updating $obj to imagePullPolicy: Always
|
|
name=${obj##*/}
|
|
kubectl -n $NS patch $obj -p '{"spec": {"template": {"spec":{"containers":[{"name":"'$name'","imagePullPolicy":"Always"}]}}}}'
|
|
done
|
|
}
|
|
|
|
for kind in $KINDS
|
|
do
|
|
patch_kind $kind
|
|
done
|
|
|
|
echo "Warning: Make sure check and wait for all pods running again!"
|
|
echo "Current status: (CTRL-C to exit)"
|
|
kubectl get pods -w -n longhorn-system
|