Sync with Longhorn Manager
Manager commit: commit 266f566783e47ce5e351f98491ea5b7b86a875d2 Author: Sheng Yang <sheng@yasker.org> Date: Tue Aug 21 11:48:22 2018 -0700 Update images Manager: rancher/longhorn-manager:2c17d9e UI: rancher/longhorn-ui:72303d9
This commit is contained in:
parent
eb65b2f961
commit
bb1ac25afd
@ -178,7 +178,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: longhorn-manager
|
- name: longhorn-manager
|
||||||
image: rancher/longhorn-manager:v0.3-rc4
|
image: rancher/longhorn-manager:2c17d9e
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
securityContext:
|
securityContext:
|
||||||
privileged: true
|
privileged: true
|
||||||
@ -189,7 +189,7 @@ spec:
|
|||||||
- --engine-image
|
- --engine-image
|
||||||
- rancher/longhorn-engine:v0.3-rc4
|
- rancher/longhorn-engine:v0.3-rc4
|
||||||
- --manager-image
|
- --manager-image
|
||||||
- rancher/longhorn-manager:v0.3-rc4
|
- rancher/longhorn-manager:2c17d9e
|
||||||
- --service-account
|
- --service-account
|
||||||
- longhorn-service-account
|
- longhorn-service-account
|
||||||
ports:
|
ports:
|
||||||
@ -266,7 +266,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: longhorn-ui
|
- name: longhorn-ui
|
||||||
image: rancher/longhorn-ui:v0.3-rc4
|
image: rancher/longhorn-ui:72303d9
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
env:
|
env:
|
||||||
@ -305,18 +305,18 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: wait-longhorn-manager
|
- name: wait-longhorn-manager
|
||||||
image: rancher/longhorn-manager:v0.3-rc4
|
image: rancher/longhorn-manager:2c17d9e
|
||||||
command: ['sh', '-c', 'while [ $(curl -m 1 -s -o /dev/null -w "%{http_code}" http://longhorn-backend:9500/v1) != "200" ]; do echo waiting; sleep 2; done']
|
command: ['sh', '-c', 'while [ $(curl -m 1 -s -o /dev/null -w "%{http_code}" http://longhorn-backend:9500/v1) != "200" ]; do echo waiting; sleep 2; done']
|
||||||
containers:
|
containers:
|
||||||
- name: longhorn-driver-deployer
|
- name: longhorn-driver-deployer
|
||||||
image: rancher/longhorn-manager:v0.3-rc4
|
image: rancher/longhorn-manager:2c17d9e
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
command:
|
command:
|
||||||
- longhorn-manager
|
- longhorn-manager
|
||||||
- -d
|
- -d
|
||||||
- deploy-driver
|
- deploy-driver
|
||||||
- --manager-image
|
- --manager-image
|
||||||
- rancher/longhorn-manager:v0.3-rc4
|
- rancher/longhorn-manager:2c17d9e
|
||||||
- --manager-url
|
- --manager-url
|
||||||
- http://longhorn-backend:9500/v1
|
- http://longhorn-backend:9500/v1
|
||||||
# manually choose "flexvolume" or "csi"
|
# manually choose "flexvolume" or "csi"
|
||||||
|
107
scripts/environment_check.sh
Executable file
107
scripts/environment_check.sh
Executable file
@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
dependencies() {
|
||||||
|
local targets=($@)
|
||||||
|
local allFound=true
|
||||||
|
for ((i=0; i<${#targets[@]}; i++)); do
|
||||||
|
local target=${targets[$i]}
|
||||||
|
if [ "$(which $target)" == "" ]; then
|
||||||
|
allFound=false
|
||||||
|
echo Not found: $target
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ "$allFound" == "false" ]; then
|
||||||
|
echo "Please install missing dependencies."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
create_ds() {
|
||||||
|
cat <<EOF > $TEMP_DIR/environment_check.yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: longhorn-environment-check
|
||||||
|
name: longhorn-environment-check
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: longhorn-environment-check
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: longhorn-environment-check
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: longhorn-environment-check
|
||||||
|
image: busybox
|
||||||
|
args: ["/bin/sh", "-c", "sleep 1000000000"]
|
||||||
|
volumeMounts:
|
||||||
|
- name: mountpoint
|
||||||
|
mountPath: /mnt/tmp
|
||||||
|
mountPropagation: Bidirectional
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- name: mountpoint
|
||||||
|
hostPath:
|
||||||
|
path: /mnt/tmp
|
||||||
|
EOF
|
||||||
|
kubectl create -f $TEMP_DIR/environment_check.yaml
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
kubectl delete -f $TEMP_DIR/environment_check.yaml
|
||||||
|
rm -rf $TEMP_DIR
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_ds_ready() {
|
||||||
|
while true; do
|
||||||
|
local ds=$(kubectl get ds/longhorn-environment-check -o json)
|
||||||
|
local numberReady=$(echo $ds | jq .status.numberReady)
|
||||||
|
local desiredNumberScheduled=$(echo $ds | jq .status.desiredNumberScheduled)
|
||||||
|
|
||||||
|
if [ "$desiredNumberScheduled" == "$numberReady" ] && [ "$desiredNumberScheduled" != "0" ]; then
|
||||||
|
echo "all pods ready ($numberReady/$desiredNumberScheduled)"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "waiting for pods to become ready ($numberReady/$desiredNumberScheduled)"
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_pods() {
|
||||||
|
local allSupported=true
|
||||||
|
local pods=$(kubectl -l app=longhorn-environment-check get po -o json)
|
||||||
|
|
||||||
|
for ((i=0; i<1; i++)); do
|
||||||
|
local pod=$(echo $pods | jq .items[$i])
|
||||||
|
local nodeName=$(echo $pod | jq -r .spec.nodeName)
|
||||||
|
local mountPropagation=$(echo $pod | jq -r '.spec.containers[0].volumeMounts[] | select(.name=="mountpoint") | .mountPropagation')
|
||||||
|
|
||||||
|
if [ "$mountPropagation" != "Bidirectional" ]; then
|
||||||
|
allSupported=false
|
||||||
|
echo "node $nodeName: MountPropagation DISABLED"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$allSupported" != "true" ]; then
|
||||||
|
echo
|
||||||
|
echo " MountPropagation is disabled on at least one node."
|
||||||
|
echo " As a result, CSI Driver and Base Image aren't supported."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo -e "\n MountPropagation is enabled!\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies kubectl jq mktemp
|
||||||
|
TEMP_DIR=$(mktemp -d)
|
||||||
|
trap cleanup EXIT
|
||||||
|
create_ds
|
||||||
|
wait_ds_ready
|
||||||
|
validate_pods
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user