-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepare_cluster
executable file
·51 lines (42 loc) · 1.51 KB
/
prepare_cluster
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -e
export LIBVIRT_DEFAULT_URI=qemu:///system
POOL=default
cd "$(dirname $0)"
POOL_PATH=$(virsh pool-dumpxml $POOL | xmllint --xpath "/pool/target/path/child::text()" -)
POOL_TYPE=$(virsh pool-dumpxml $POOL | xmllint --xpath "/pool/attribute::type" -)
if [ "$POOL_TYPE" != " type=\"dir\"" ]; then
echo "This script works only if the $POOL storage pool is of type: dir"
exit 1
fi
#
# Enable KSM
#
echo 1 > /sys/kernel/mm/ksm/run
#
# Download a pristine qemu image of CoreOS
#
wget -N -P "$POOL_PATH" http://alpha.release.core-os.net/amd64-usr/current/coreos_production_qemu_image.img.bz2
bunzip2 -f "$POOL_PATH/coreos_production_qemu_image.img.bz2"
# #
# # Download kubernetes
# #
# kub_path="$POOL_PATH/kubernetes/bin"
# mkdir -p "$kub_path"
# wget -N -P "$kub_path" http://storage.googleapis.com/kubernetes/apiserver
# wget -N -P "$kub_path" http://storage.googleapis.com/kubernetes/controller-manager
# wget -N -P "$kub_path" http://storage.googleapis.com/kubernetes/kubecfg
# wget -N -P "$kub_path" http://storage.googleapis.com/kubernetes/kubelet
# wget -N -P "$kub_path" http://storage.googleapis.com/kubernetes/proxy
# wget -N -P "$kub_path" http://storage.googleapis.com/kubernetes/scheduler
# chmod +x "$kub_path/apiserver"
# chmod +x "$kub_path/controller-manager"
# chmod +x "$kub_path/kubecfg"
# chmod +x "$kub_path/kubelet"
# chmod +x "$kub_path/proxy"
# chmod +x "$kub_path/scheduler"
#
# Create a CoreOS config drive
#
mkdir -p "$POOL_PATH/coreos_configdrive"
chmod 777 "$POOL_PATH/coreos_configdrive"