Skip to content

Commit

Permalink
Use kubeadm stable for systesting
Browse files Browse the repository at this point in the history
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 <wtie@cisco.com>
  • Loading branch information
tiewei committed Jan 9, 2018
1 parent 8dd92da commit 7bd4809
Show file tree
Hide file tree
Showing 16 changed files with 721 additions and 1,081 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ netplugin-version
scripts/netContain/*.tgz
scripts/netContain/*.tar.bz2

vagrant/k8s/export/.contiv.yaml*
vagrant/k8s/export/admin.conf
vagrant/k8s/export/*contiv*
vagrant/k8s/contrib
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

DEFAULT_DOCKER_VERSION := 1.12.6
V2PLUGIN_DOCKER_VERSION := 1.13.1
DEFAULT_CONTIV_K8S_VERSION := v1.8.6
SHELL := /bin/bash
# TODO: contivmodel should be removed once its code passes golint and misspell
EXCLUDE_DIRS := bin docs Godeps scripts vagrant vendor install contivmodel
Expand Down Expand Up @@ -135,7 +136,8 @@ start:
# ===================================================================
# kubernetes cluster bringup/cleanup targets
k8s-cluster:
cd vagrant/k8s/ && CONTIV_K8S_USE_KUBEADM=1 ./setup_cluster.sh
vagrant plugin install vagrant-cachier
cd vagrant/k8s/ && vagrant up

k8s-l3-cluster:
CONTIV_L3=1 make k8s-cluster
Expand All @@ -148,7 +150,8 @@ k8s-l3-destroy:

# ===================================================================
# kubernetes test targets
k8s-test: k8s-cluster
k8s-test:
CONTIV_TEST=1 make k8s-cluster
cd vagrant/k8s/ && vagrant ssh k8master -c 'bash -lc "cd /opt/gopath/src/github.com/contiv/netplugin && make run-build"'
cd $(GOPATH)/src/github.com/contiv/netplugin/scripts/python && PYTHONIOENCODING=utf-8 ./createcfg.py -scheduler 'k8s' -binpath contiv/bin -install_mode 'kubeadm'
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)
Expand Down
42 changes: 28 additions & 14 deletions install/k8s/cluster/bootstrap_centos.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
#!/bin/bash

if [ $EUID -ne 0 ]; then
echo "Please run this script as root user"
echo "Please run this script as root user"
exit 1
fi

set -e

swapoff -a
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
/etc/init.d/network restart

cp /shared/.etc_hosts /etc/hosts

cat <<EOF >> /etc/docker/daemon.json
{
"storage-driver": "devicemapper"
}
EOF

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

setenforce 0
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

sysctl --system

yum remove -y docker \
docker-common \
Expand All @@ -23,15 +45,7 @@ yum remove -y docker \
docker-engine \
docker-engine-selinux

yum install -y docker ebtables \
https://fedorapeople.org/groups/kolla/kubeadm-1.6.0-0.alpha.0.2074.a092d8e0f95f52.x86_64.rpm \
https://fedorapeople.org/groups/kolla/kubectl-1.5.4-0.x86_64.rpm \
https://fedorapeople.org/groups/kolla/kubelet-1.5.4-0.x86_64.rpm \
https://fedorapeople.org/groups/kolla/kubernetes-cni-0.3.0.1-0.07a8a2.x86_64.rpm
yum install -y docker kubelet kubeadm kubectl

systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet

systemctl stop firewalld
systemctl disable firewalld

15 changes: 14 additions & 1 deletion install/k8s/cluster/k8smaster_centos.sh
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
kubeadm init --token=$1 --api-advertise-addresses=$2 --skip-preflight-checks=true --use-kubernetes-version $3
#!/bin/bash -x
kubeadm init --token $1 --apiserver-advertise-address $2 --ignore-preflight-errors all --kubernetes-version $3

kubectl taint nodes --all node-role.kubernetes.io/master-

if [ ! -z "$CONTIV_TEST" ]; then
cp /etc/kubernetes/admin.conf /shared/admin.conf
chmod 0644 /etc/kubernetes/admin.conf
cd /opt/gopath/src/github.com/contiv/netplugin/install/k8s/contiv/
./contiv-compose add-systest ./base.yaml > /shared/contiv.yaml
else
cp /opt/gopath/src/github.com/contiv/netplugin/install/k8s/contiv/base.yaml /shared/contiv.yaml
fi
kubectl apply -f /shared/contiv.yaml
7 changes: 6 additions & 1 deletion install/k8s/cluster/k8sworker_centos.sh
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
kubeadm join --token=$1 --skip-preflight-checks=true $2
#!/bin/bash -x
kubeadm join --token "$1" "$2" --ignore-preflight-errors all --discovery-token-unsafe-skip-ca-verification
if [ ! -z "$CONTIV_TEST" ]; then
cp /shared/admin.conf /etc/kubernetes/admin.conf
chmod 0644 /etc/kubernetes/admin.conf
fi
Loading

0 comments on commit 7bd4809

Please sign in to comment.