diff options
author | Peter Mikus <pmikus@cisco.com> | 2017-09-22 14:59:40 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2017-10-12 08:39:16 +0000 |
commit | 9a261ea61549fc6a5c23369d2e236b002dc35038 (patch) | |
tree | 8004f366007d3ee0210bbf099b71491bb412fe88 /resources/libraries/bash | |
parent | f2573eccd38609fbc3d44f1fb9c706d08e50d49c (diff) |
CSIT-748 vnf-agent integration
CSIT-773 Implement RF keywords for k8s
- Implementation of Test Suite Setup for Ligato vnf-agent testing
- Implementation of KubernetesUtil for controlling kubectl
- Yaml templates for L2XC topology with 1cswitch and 1cnf
- Yaml templates for L2BD topology with 1cswitch and 1cnf
- ligato bootstrap script for creating vnf-agent image
Change-Id: Iebefde0eb984a27a0afcdf29fe549ca4edf8a61e
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/bash')
-rwxr-xr-x | resources/libraries/bash/k8s_setup.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/resources/libraries/bash/k8s_setup.sh b/resources/libraries/bash/k8s_setup.sh new file mode 100755 index 0000000000..0649c711c6 --- /dev/null +++ b/resources/libraries/bash/k8s_setup.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Copyright (c) 2017 Cisco and/or its affiliates. +# 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. + +set -xo pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +K8S_CALICO="${SCRIPT_DIR}/../../templates/kubernetes/calico_v2.4.1.yaml" +K8S_CSIT="${SCRIPT_DIR}/../../templates/kubernetes/csit.yaml" + +trap "sudo kubeadm reset && sudo rm -rf $HOME/.kube" ERR + +# Revert any changes made to this host by 'kubeadm init' or 'kubeadm join' +sudo kubeadm reset && sudo rm -rf $HOME/.kube || \ + { echo "Failed to reset kubeadm"; exit 1; } + +# Ret up the Kubernetes master +sudo -E kubeadm init --token-ttl 0 --pod-network-cidr=192.168.0.0/16 || \ + { echo "Failed to init kubeadm"; exit 1; } + +# Make cgroup non-exclusive for CPU and MEM +sudo cgset -r cpuset.cpu_exclusive=0 /kubepods +sudo cgset -r cpuset.mem_exclusive=0 /kubepods + +rm -rf $HOME/.kube +mkdir -p $HOME/.kube +sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config +sudo chown $(id -u):$(id -g) $HOME/.kube/config + +# Apply resources +kubectl apply -f ${K8S_CALICO} || \ + { echo "Failed to apply Calico resources"; exit 1; } +kubectl apply -f ${K8S_CSIT} || \ + { echo "Failed to apply CSIT resource"; exit 1; } + +# Update the taints +kubectl taint nodes --all node-role.kubernetes.io/master- || \ + { echo "Failed to taint nodes"; exit 1; } + +# Dump Kubernetes objects ... +kubectl get all --all-namespaces + +echo Kubernetes is ready |