From 2c28193aefee391ef4f860ed4d1cb74b46189210 Mon Sep 17 00:00:00 2001 From: Guo Ruijing Date: Mon, 30 Jul 2018 12:21:36 -0400 Subject: several enhancement/fix for kubeadm onap 1. add ntp for kubeadm onap 2. support vagrant cross 2 hosts 3. add beijing branch Change-Id: I50faf8448ddc0efa765b98fecd19c1d7a52bf3a3 Signed-off-by: Guo Ruijing --- src/vagrant/kubeadm_onap/Vagrantfile | 6 +- src/vagrant/kubeadm_onap/host_setup.sh | 9 +- src/vagrant/kubeadm_onap/master_setup.sh | 12 ++- src/vagrant/kubeadm_onap/onap_setup.sh | 3 +- src/vagrant/kubeadm_onap/setup_tunnel.sh | 3 + src/vagrant/kubeadm_onap/values.yaml | 149 ------------------------------- src/vagrant/kubeadm_onap/worker_setup.sh | 6 ++ 7 files changed, 25 insertions(+), 163 deletions(-) create mode 100644 src/vagrant/kubeadm_onap/setup_tunnel.sh delete mode 100644 src/vagrant/kubeadm_onap/values.yaml (limited to 'src/vagrant') diff --git a/src/vagrant/kubeadm_onap/Vagrantfile b/src/vagrant/kubeadm_onap/Vagrantfile index 73c442d..699f607 100644 --- a/src/vagrant/kubeadm_onap/Vagrantfile +++ b/src/vagrant/kubeadm_onap/Vagrantfile @@ -1,4 +1,4 @@ -$num_workers=3 +$num_workers=4 Vagrant.require_version ">= 1.8.6" Vagrant.configure("2") do |config| @@ -23,8 +23,8 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", path: "worker_setup.sh", privileged: false config.vm.network :private_network, ip: "192.168.0.#{i+20}" config.vm.provider :libvirt do |libvirt| - libvirt.memory = 51200 - libvirt.cpus = 32 + libvirt.memory = 40960 + libvirt.cpus = 16 end end end diff --git a/src/vagrant/kubeadm_onap/host_setup.sh b/src/vagrant/kubeadm_onap/host_setup.sh index 7778e3d..9cfd266 100755 --- a/src/vagrant/kubeadm_onap/host_setup.sh +++ b/src/vagrant/kubeadm_onap/host_setup.sh @@ -8,15 +8,10 @@ cat << EOF | sudo tee /etc/hosts 192.168.0.21 worker1 192.168.0.22 worker2 192.168.0.23 worker3 +192.168.0.24 worker4 EOF -cat << EOF | sudo tee /etc/resolv.conf -search svc.cluster.local cluster.local -nameserver 10.96.0.10 -nameserver 8.8.8.8 -nameserver 8.8.4.4 -options ndots:5 timeout:1 attempts:1 -EOF +sudo ifconfig eth1 mtu 1400 sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D sudo apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D diff --git a/src/vagrant/kubeadm_onap/master_setup.sh b/src/vagrant/kubeadm_onap/master_setup.sh index 6d06159..8840541 100755 --- a/src/vagrant/kubeadm_onap/master_setup.sh +++ b/src/vagrant/kubeadm_onap/master_setup.sh @@ -1,7 +1,13 @@ #!/bin/bash - set -ex +sudo apt-get -y install ntp +cat << EOF | sudo tee /etc/ntp.conf +server 127.127.1.0 +fudge 127.127.1.0 stratum 10 +EOF +sudo service ntp restart + sudo apt install nfs-kernel-server -y sudo mkdir /dockerdata-nfs sudo chmod 777 /dockerdata-nfs @@ -15,6 +21,8 @@ mkdir ~/.kube sudo cp /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config -kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml +wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml +sed -i "s/kube-subnet-mgr/kube-subnet-mgr\n - --iface=eth1/" kube-flannel.yml +kubectl apply -f kube-flannel.yml /vagrant/onap_setup.sh diff --git a/src/vagrant/kubeadm_onap/onap_setup.sh b/src/vagrant/kubeadm_onap/onap_setup.sh index d8e3dcf..e4edd8f 100755 --- a/src/vagrant/kubeadm_onap/onap_setup.sh +++ b/src/vagrant/kubeadm_onap/onap_setup.sh @@ -11,9 +11,8 @@ helm serve & helm repo remove stable helm repo add local http://127.0.0.1:8879 -git clone http://gerrit.onap.org/r/oom +git clone -b beijing http://gerrit.onap.org/r/oom cd oom/kubernetes -cp /vagrant/values.yaml onap sudo apt-get install make -y make all diff --git a/src/vagrant/kubeadm_onap/setup_tunnel.sh b/src/vagrant/kubeadm_onap/setup_tunnel.sh new file mode 100644 index 0000000..3a6ef75 --- /dev/null +++ b/src/vagrant/kubeadm_onap/setup_tunnel.sh @@ -0,0 +1,3 @@ +sudo ip link add tunnel0 type gretap local remote +sudo ifconfig tunnel0 up +sudo brctl addif
tunnel0 diff --git a/src/vagrant/kubeadm_onap/values.yaml b/src/vagrant/kubeadm_onap/values.yaml deleted file mode 100644 index 3071609..0000000 --- a/src/vagrant/kubeadm_onap/values.yaml +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -################################################################# -# Global configuration overrides. -# -# These overrides will affect all helm charts (ie. applications) -# that are listed below and are 'enabled'. -################################################################# -global: - # Change to an unused port prefix range to prevent port conflicts - # with other instances running within the same k8s cluster - nodePortPrefix: 302 - - # ONAP Repository - # Uncomment the following to enable the use of a single docker - # repository but ONLY if your repository mirrors all ONAP - # docker images. This includes all images from dockerhub and - # any other repository that hosts images for ONAP components. - #repository: nexus3.onap.org:10001 - repositoryCred: - user: docker - password: docker - - # readiness check - temporary repo until images migrated to nexus3 - readinessRepository: oomk8s - # logging agent - temporary repo until images migrated to nexus3 - loggingRepository: docker.elastic.co - - # image pull policy - pullPolicy: Always - - # default mount path root directory referenced - # by persistent volumes and log files - persistence: - mountPath: /dockerdata-nfs - - # flag to enable debugging - application support required - debugEnabled: false - -# Repository for creation of nexus3.onap.org secret -repository: nexus3.onap.org:10001 - - -################################################################# -# Enable/disable and configure helm charts (ie. applications) -# to customize the ONAP deployment. -################################################################# -aaf: - enabled: true -aai: - enabled: true -appc: - enabled: true - config: - openStackType: OpenStackProvider - openStackName: OpenStack - openStackKeyStoneUrl: http://localhost:8181/apidoc/explorer/index.html - openStackServiceTenantName: default - openStackDomain: default - openStackUserName: admin - openStackEncryptedPassword: admin -clamp: - enabled: false -cli: - enabled: true -consul: - enabled: true -dcaegen2: - enabled: false -dmaap: - enabled: true -esr: - enabled: true -log: - enabled: true -sniro-emulator: - enabled: true -oof: - enabled: true -msb: - enabled: true -multicloud: - enabled: true -nbi: - enabled: true - config: - # openstack configuration - openStackRegion: "Yolo" - openStackVNFTenantId: "1234" -policy: - enabled: true -portal: - enabled: true -robot: - enabled: true -sdc: - enabled: true -sdnc: - enabled: true - - replicaCount: 1 - - mysql: - replicaCount: 1 -so: - enabled: true - - replicaCount: 1 - - liveness: - # necessary to disable liveness probe when setting breakpoints - # in debugger so K8s doesn't restart unresponsive container - enabled: true - - # so server configuration - config: - # message router configuration - dmaapTopic: "AUTO" - # openstack configuration - openStackUserName: "vnf_user" - openStackRegion: "RegionOne" - openStackKeyStoneUrl: "http://1.2.3.4:5000" - openStackServiceTenantName: "service" - openStackEncryptedPasswordHere: "c124921a3a0efbe579782cde8227681e" - - # configure embedded mariadb - mariadb: - config: - mariadbRootPassword: password -uui: - enabled: true -vfc: - enabled: true -vid: - enabled: true -vnfsdk: - enabled: true diff --git a/src/vagrant/kubeadm_onap/worker_setup.sh b/src/vagrant/kubeadm_onap/worker_setup.sh index a088619..e65a65c 100755 --- a/src/vagrant/kubeadm_onap/worker_setup.sh +++ b/src/vagrant/kubeadm_onap/worker_setup.sh @@ -1,6 +1,12 @@ #!/bin/bash set -ex +sudo apt-get -y install ntp +cat << EOF | sudo tee /etc/ntp.conf +pool master +EOF +sudo service ntp restart + sudo kubeadm join --discovery-token-unsafe-skip-ca-verification --token 8c5adc.1cec8dbf339093f0 192.168.0.10:6443 || true sudo apt-get install nfs-common -y -- cgit 1.2.3-korg