Merge "Gate: Permit ceph deployment from outside the cluster"
This commit is contained in:
commit
a831841716
@ -25,20 +25,17 @@ make ceph-provisioners
|
|||||||
#NOTE: Deploy command
|
#NOTE: Deploy command
|
||||||
[ -s /tmp/ceph-fs-uuid.txt ] || uuidgen > /tmp/ceph-fs-uuid.txt
|
[ -s /tmp/ceph-fs-uuid.txt ] || uuidgen > /tmp/ceph-fs-uuid.txt
|
||||||
CEPH_PUBLIC_NETWORK="$(./tools/deployment/multinode/kube-node-subnet.sh)"
|
CEPH_PUBLIC_NETWORK="$(./tools/deployment/multinode/kube-node-subnet.sh)"
|
||||||
CEPH_CLUSTER_NETWORK="$(./tools/deployment/multinode/kube-node-subnet.sh)"
|
CEPH_CLUSTER_NETWORK="${CEPH_PUBLIC_NETWORK}"
|
||||||
CEPH_FS_ID="$(cat /tmp/ceph-fs-uuid.txt)"
|
CEPH_FS_ID="$(cat /tmp/ceph-fs-uuid.txt)"
|
||||||
#NOTE(portdirect): to use RBD devices with Ubuntu kernels < 4.5 this
|
#NOTE(portdirect): to use RBD devices with kernels < 4.5 this should be set to 'hammer'
|
||||||
# should be set to 'hammer'
|
LOWEST_CLUSTER_KERNEL_VERSION=$(kubectl get node -o go-template='{{range .items}}{{.status.nodeInfo.kernelVersion}}{{"\n"}}{{ end }}' | sort -V | tail -1)
|
||||||
. /etc/os-release
|
if [ "$(echo ${LOWEST_CLUSTER_KERNEL_VERSION} | awk -F "." '{ print $1 }')" -lt "4" ] || [ "$(echo ${LOWEST_CLUSTER_KERNEL_VERSION} | awk -F "." '{ print $2 }')" -lt "15" ]; then
|
||||||
if [ "x${ID}" == "xubuntu" ] && \
|
echo "Using hammer crush tunables"
|
||||||
[ "$(uname -r | awk -F "." '{ print $2 }')" -lt "5" ]; then
|
|
||||||
CRUSH_TUNABLES=hammer
|
CRUSH_TUNABLES=hammer
|
||||||
else
|
else
|
||||||
CRUSH_TUNABLES=null
|
CRUSH_TUNABLES=null
|
||||||
fi
|
fi
|
||||||
if [ "x${ID}" == "xcentos" ]; then
|
NUMBER_OF_OSDS="$(kubectl get nodes -l ceph-osd=enabled --no-headers | wc -l)"
|
||||||
CRUSH_TUNABLES=hammer
|
|
||||||
fi
|
|
||||||
tee /tmp/ceph.yaml << EOF
|
tee /tmp/ceph.yaml << EOF
|
||||||
endpoints:
|
endpoints:
|
||||||
identity:
|
identity:
|
||||||
@ -69,8 +66,7 @@ conf:
|
|||||||
crush:
|
crush:
|
||||||
tunables: ${CRUSH_TUNABLES}
|
tunables: ${CRUSH_TUNABLES}
|
||||||
target:
|
target:
|
||||||
# NOTE(portdirect): 5 nodes, with one osd per node
|
osd: ${NUMBER_OF_OSDS}
|
||||||
osd: 5
|
|
||||||
pg_per_osd: 100
|
pg_per_osd: 100
|
||||||
storage:
|
storage:
|
||||||
osd:
|
osd:
|
||||||
|
@ -18,7 +18,7 @@ set -xe
|
|||||||
|
|
||||||
#NOTE: Deploy command
|
#NOTE: Deploy command
|
||||||
CEPH_PUBLIC_NETWORK="$(./tools/deployment/multinode/kube-node-subnet.sh)"
|
CEPH_PUBLIC_NETWORK="$(./tools/deployment/multinode/kube-node-subnet.sh)"
|
||||||
CEPH_CLUSTER_NETWORK="$(./tools/deployment/multinode/kube-node-subnet.sh)"
|
CEPH_CLUSTER_NETWORK="${CEPH_PUBLIC_NETWORK}"
|
||||||
tee /tmp/ceph-osh-infra-config.yaml <<EOF
|
tee /tmp/ceph-osh-infra-config.yaml <<EOF
|
||||||
endpoints:
|
endpoints:
|
||||||
ceph_mon:
|
ceph_mon:
|
||||||
|
@ -16,10 +16,27 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
UTILS_IMAGE=docker.io/openstackhelm/gate-utils:v0.1.0
|
UTILS_IMAGE=docker.io/openstackhelm/gate-utils:v0.1.0
|
||||||
NODE_IPS=$(mktemp --suffix=.txt)
|
NODE_IPS=$(mktemp)
|
||||||
kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP").address' | sort -V > $NODE_IPS
|
kubectl get nodes -o json | jq -r '.items[].status.addresses[] | select(.type=="InternalIP").address' | sort -V > $NODE_IPS
|
||||||
FIRST_IP_SUBNET=$(sudo docker run --rm ${UTILS_IMAGE} ipcalc "$(head -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
|
function run_and_log_ipcalc {
|
||||||
LAST_IP_SUBNET=$(sudo docker run --rm ${UTILS_IMAGE} ipcalc "$(tail -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
|
POD_NAME="tmp-$(cat /dev/urandom | env LC_CTYPE=C tr -dc a-z | head -c 5; echo)"
|
||||||
|
kubectl run ${POD_NAME} \
|
||||||
|
--generator=run-pod/v1 \
|
||||||
|
--wait \
|
||||||
|
--image ${UTILS_IMAGE} \
|
||||||
|
--restart=Never \
|
||||||
|
ipcalc -- "$1"
|
||||||
|
end=$(($(date +%s) + 900))
|
||||||
|
until kubectl get pod/${POD_NAME} -o go-template='{{.status.phase}}' | grep -q Succeeded; do
|
||||||
|
now=$(date +%s)
|
||||||
|
[ $now -gt $end ] && echo containers failed to start. && \
|
||||||
|
kubectl get pod/${POD_NAME} -o wide && exit 1
|
||||||
|
done
|
||||||
|
kubectl logs pod/${POD_NAME}
|
||||||
|
kubectl delete pod/${POD_NAME}
|
||||||
|
}
|
||||||
|
FIRST_IP_SUBNET=$(run_and_log_ipcalc "$(head -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
|
||||||
|
LAST_IP_SUBNET=$(run_and_log_ipcalc "$(tail -n 1 ${NODE_IPS})/24" | awk '/^Network/ { print $2 }')
|
||||||
rm -f $NODE_IPS
|
rm -f $NODE_IPS
|
||||||
function ip_diff {
|
function ip_diff {
|
||||||
echo $(($(echo $LAST_IP_SUBNET | awk -F '.' "{ print \$$1}") - $(echo $FIRST_IP_SUBNET | awk -F '.' "{ print \$$1}")))
|
echo $(($(echo $LAST_IP_SUBNET | awk -F '.' "{ print \$$1}") - $(echo $FIRST_IP_SUBNET | awk -F '.' "{ print \$$1}")))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user