Fix for new canal.yaml location

Fix for new canal.yaml location

Change-Id: Ib4e6ac01501373eb04c388b1290f77f9563d130d
This commit is contained in:
Serguei Bezverkhi 2017-05-01 18:26:31 -04:00
parent 7c8e2af29f
commit 03dbb4e09e
7 changed files with 48 additions and 18 deletions

View File

@ -4,7 +4,12 @@ l=$(sudo iptables -L INPUT --line-numbers | grep openstack-INPUT | \
awk '{print $1}')
sudo iptables -D INPUT $l
ip a | sed '/^[^1-9]/d;' | awk '{print $2}' | sed 's/://' | \
if [ -f /usr/sbin/ip ]; then
ip_command="/usr/sbin/ip a"
else
ip_command="ip a"
fi
$ip_command | sed '/^[^1-9]/d;' | awk '{print $2}' | sed 's/://' | \
grep -v '^lo$' | while read line; do
sudo iptables -I INPUT 1 -i $line -j openstack-INPUT
done

View File

@ -3,12 +3,41 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
url="https://raw.githubusercontent.com/projectcalico/canal/master"
url="$url/k8s-install/kubeadm/1.6/canal.yaml"
url="$url/k8s-install/1.6/canal.yaml"
curl "$url" -o /tmp/canal.yaml
sed -i "s@192.168.0.0/16@172.16.132.0/22@" /tmp/canal.yaml
sed -i "s@10.96.232.136@172.16.128.100@" /tmp/canal.yaml
url="https://raw.githubusercontent.com/projectcalico/canal/master"
url="$url/k8s-install/1.6/rbac.yaml"
curl "$url" -o /tmp/rbac.yaml
kubectl create -f /tmp/rbac.yaml
#
# Instead of hardcoding cluster cidr, let's get it from
# controller manager manifest.
#
cluster_cidr=$(sudo grep cluster-cidr /etc/kubernetes/manifests/kube-controller-manager.yaml || true)
cluster_cidr=${cluster_cidr##*=}
#
# NOTE(sbezverk) Temporary workaround to canal.yaml bug. It is
# missing net-conf.json file. The code will add it if it does not exist.
#
network_conf=$(grep net-conf.json /tmp/canal.yaml || true)
if [ "x$network_conf" == "x" ]; then
sed -i '/masquerade:/a\
net-conf.json: |\
{\
"Network": "'$cluster_cidr'",\
"Backend": {\
"Type": "vxlan"\
}\
}' /tmp/canal.yaml
else
sed -i 's@"Network":.*"@"Network": "'$cluster_cidr'"@' /tmp/canal.yaml
fi
kubectl create -f /tmp/canal.yaml

View File

@ -11,12 +11,12 @@ IP=172.18.0.1
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
. "$DIR/setup_gate_common.sh"
# Setting up iptables
setup_iptables
# Installating required software packages
setup_packages $DISTRO $CONFIG
# Setting up iptables
setup_iptables
# Setting up an interface and a bridge
setup_bridge

View File

@ -10,7 +10,7 @@ DISTRO=$1
CONFIG=$2
if [ "x$DISTRO" == "xubuntu" ]; then
sudo apt-get update
sudo apt-get install lvm2
sudo apt-get install lvm2 iproute2
sudo apt-get remove -y open-iscsi
sudo apt-get install -y bridge-utils tftp
(echo server:; echo " interface: 172.19.0.1"; echo " access-control: 0.0.0.0/0 allow") | \
@ -20,7 +20,7 @@ else
sudo yum-config-manager --enable epel
sudo yum remove -y iscsi-initiator-utils
sudo yum install -y bridge-utils tftp
sudo yum install -y lvm2
sudo yum install -y lvm2 iproute
(echo server:; echo " interface: 172.19.0.1"; echo " access-control: 0.0.0.0/0 allow") | \
sudo /bin/bash -c "cat > /etc/unbound/conf.d/kubernetes.conf"
fi

View File

@ -10,12 +10,12 @@ PIPELINE="$7"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )"
. "$DIR/setup_gate_common.sh"
# Setting up iptables
setup_iptables
# Installating required software packages
setup_packages $DISTRO $CONFIG
# Setting up iptables
setup_iptables
# Setting up an interface and a bridge
setup_bridge

View File

@ -14,8 +14,6 @@ gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOEF
yum install -y docker kubeadm kubelet kubectl kubernetes-cni ebtables
sed -i 's|KUBELET_KUBECONFIG_ARGS=|KUBELET_KUBECONFIG_ARGS=--cgroup-driver=systemd --enable-cri=false |g' \
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
sed -i 's/10.96.0.10/172.16.128.10/g' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
EOF
else
@ -26,8 +24,7 @@ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.l
apt-get update
apt-get install -y docker.io kubeadm kubelet kubectl kubernetes-cni
cgroup_driver=$(docker info | grep "Cgroup Driver" | awk '{print $3}')
docker info
sed -i 's|KUBELET_KUBECONFIG_ARGS=|KUBELET_KUBECONFIG_ARGS=--cgroup-driver='$cgroup_driver' --enable-cri=false |g' \
sed -i 's|KUBELET_KUBECONFIG_ARGS=|KUBELET_KUBECONFIG_ARGS=--cgroup-driver='$cgroup_driver' |g' \
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf
sed -i 's/10.96.0.10/172.16.128.10/g' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
EOF
@ -44,7 +41,7 @@ EOF
if [ "$1" == "master" ]; then
cat >> /tmp/setup.$$ <<"EOF"
[ -d /etc/kubernetes/manifests ] && rmdir /etc/kubernetes/manifests || true
kubeadm init --skip-preflight-checks --service-cidr 172.16.128.0/24 \
kubeadm init --skip-preflight-checks --service-cidr 172.16.128.0/24 --pod-network-cidr 172.16.132.0/22 \
--apiserver-advertise-address $(cat /etc/nodepool/primary_node_private) | tee /tmp/kubeout
grep 'kubeadm join --token' /tmp/kubeout | awk '{print $4}' > /etc/kubernetes/token.txt
grep 'kubeadm join --token' /tmp/kubeout | awk '{print $5}' > /etc/kubernetes/ip.txt

View File

@ -26,7 +26,6 @@ spec:
command: ["sh", "-xc"]
args:
- |
curl -s http://172.16.128.100:6666/version
cat /etc/resolv.conf
ping -c 20 8.8.8.8
cat > /tmp/dns-test.py << "EOEF"