Skip to content

Commit 7bd4809

Browse files
author
Wei Tie
committed
Use kubeadm stable for systesting
This commit updated to use kubeadm stable for system testing, and created a single base yaml file for contiv deployment, also created a contiv-compose to update the base yaml file to support system testing, prometheus, auth_proxy and ACI(not yet). Update system testings to allow running netplugin on master nodes, so that service like kube-dns and kube-dashboard could be created correctly. Also formated ruby files and updated vagrant file so kube master could have more memories. Signed-off-by: Wei Tie <[email protected]>
1 parent 8dd92da commit 7bd4809

File tree

16 files changed

+721
-1081
lines changed

16 files changed

+721
-1081
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,6 @@ netplugin-version
7171
scripts/netContain/*.tgz
7272
scripts/netContain/*.tar.bz2
7373

74-
vagrant/k8s/export/.contiv.yaml*
74+
vagrant/k8s/export/admin.conf
75+
vagrant/k8s/export/*contiv*
7576
vagrant/k8s/contrib

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
DEFAULT_DOCKER_VERSION := 1.12.6
99
V2PLUGIN_DOCKER_VERSION := 1.13.1
10+
DEFAULT_CONTIV_K8S_VERSION := v1.8.6
1011
SHELL := /bin/bash
1112
# TODO: contivmodel should be removed once its code passes golint and misspell
1213
EXCLUDE_DIRS := bin docs Godeps scripts vagrant vendor install contivmodel
@@ -135,7 +136,8 @@ start:
135136
# ===================================================================
136137
# kubernetes cluster bringup/cleanup targets
137138
k8s-cluster:
138-
cd vagrant/k8s/ && CONTIV_K8S_USE_KUBEADM=1 ./setup_cluster.sh
139+
vagrant plugin install vagrant-cachier
140+
cd vagrant/k8s/ && vagrant up
139141

140142
k8s-l3-cluster:
141143
CONTIV_L3=1 make k8s-cluster
@@ -148,7 +150,8 @@ k8s-l3-destroy:
148150

149151
# ===================================================================
150152
# kubernetes test targets
151-
k8s-test: k8s-cluster
153+
k8s-test:
154+
CONTIV_TEST=1 make k8s-cluster
152155
cd vagrant/k8s/ && vagrant ssh k8master -c 'bash -lc "cd /opt/gopath/src/github.com/contiv/netplugin && make run-build"'
153156
cd $(GOPATH)/src/github.com/contiv/netplugin/scripts/python && PYTHONIOENCODING=utf-8 ./createcfg.py -scheduler 'k8s' -binpath contiv/bin -install_mode 'kubeadm'
154157
CONTIV_K8S_USE_KUBEADM=1 CONTIV_NODES=3 go test -v -timeout 540m ./test/systemtests -check.v -check.abort -check.f $(K8S_SYSTEM_TESTS_TO_RUN)

install/k8s/cluster/bootstrap_centos.sh

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
11
#!/bin/bash
22

33
if [ $EUID -ne 0 ]; then
4-
echo "Please run this script as root user"
4+
echo "Please run this script as root user"
55
exit 1
66
fi
7+
78
set -e
9+
10+
swapoff -a
11+
setenforce 0
12+
systemctl stop firewalld
13+
systemctl disable firewalld
14+
/etc/init.d/network restart
15+
16+
cp /shared/.etc_hosts /etc/hosts
17+
18+
cat <<EOF >> /etc/docker/daemon.json
19+
{
20+
"storage-driver": "devicemapper"
21+
}
22+
EOF
23+
824
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
925
[kubernetes]
1026
name=Kubernetes
11-
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
27+
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
1228
enabled=1
13-
gpgcheck=0
14-
repo_gpgcheck=0
29+
gpgcheck=1
30+
repo_gpgcheck=1
31+
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
1532
EOF
1633

17-
setenforce 0
34+
cat <<EOF > /etc/sysctl.d/k8s.conf
35+
net.bridge.bridge-nf-call-ip6tables = 1
36+
net.bridge.bridge-nf-call-iptables = 1
37+
EOF
38+
39+
sysctl --system
1840

1941
yum remove -y docker \
2042
docker-common \
@@ -23,15 +45,7 @@ yum remove -y docker \
2345
docker-engine \
2446
docker-engine-selinux
2547

26-
yum install -y docker ebtables \
27-
https://fedorapeople.org/groups/kolla/kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm \
28-
https://fedorapeople.org/groups/kolla/kubectl-1.5.4-0.x86_64.rpm \
29-
https://fedorapeople.org/groups/kolla/kubelet-1.5.4-0.x86_64.rpm \
30-
https://fedorapeople.org/groups/kolla/kubernetes-cni-0.3.0.1-0.07a8a2.x86_64.rpm
48+
yum install -y docker kubelet kubeadm kubectl
3149

3250
systemctl enable docker && systemctl start docker
3351
systemctl enable kubelet && systemctl start kubelet
34-
35-
systemctl stop firewalld
36-
systemctl disable firewalld
37-
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
kubeadm init --token=$1 --api-advertise-addresses=$2 --skip-preflight-checks=true --use-kubernetes-version $3
1+
#!/bin/bash -x
2+
kubeadm init --token $1 --apiserver-advertise-address $2 --ignore-preflight-errors all --kubernetes-version $3
3+
4+
kubectl taint nodes --all node-role.kubernetes.io/master-
5+
6+
if [ ! -z "$CONTIV_TEST" ]; then
7+
cp /etc/kubernetes/admin.conf /shared/admin.conf
8+
chmod 0644 /etc/kubernetes/admin.conf
9+
cd /opt/gopath/src/github.com/contiv/netplugin/install/k8s/contiv/
10+
./contiv-compose add-systest ./base.yaml > /shared/contiv.yaml
11+
else
12+
cp /opt/gopath/src/github.com/contiv/netplugin/install/k8s/contiv/base.yaml /shared/contiv.yaml
13+
fi
14+
kubectl apply -f /shared/contiv.yaml
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
kubeadm join --token=$1 --skip-preflight-checks=true $2
1+
#!/bin/bash -x
2+
kubeadm join --token "$1" "$2" --ignore-preflight-errors all --discovery-token-unsafe-skip-ca-verification
3+
if [ ! -z "$CONTIV_TEST" ]; then
4+
cp /shared/admin.conf /etc/kubernetes/admin.conf
5+
chmod 0644 /etc/kubernetes/admin.conf
6+
fi

0 commit comments

Comments
 (0)