diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2019-02-11 11:04:59 +0000 |
---|---|---|
committer | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2019-03-29 15:04:14 +0100 |
commit | 7a31d776d4bdf122d4c4c8f732304cc83621bdd6 (patch) | |
tree | 20acf2b9278434be4c94b3fa93d186386c1be1cb /mcp/config/states/akraino_iec | |
parent | d7f96d14441eafda776d3c6475b8b0d93d91de39 (diff) |
[akraino] Add IEC K8-calico scenarios
- bump Pharos git submodule to allow PODs with fewer nodes;
- add `k8-calico-iec-noha` scenario definition for Akraino
IEC basic configuration;
- add `k8-calico-iec-vcp-noha` scenario definition for Akraino
IEC nested (virtualized control plane) configuration;
- add `akraino_iec` state, which will leverage the Akraino IEC
bootstrap scripts from [1];
- replace system.reboot salt call with cmd.run 'reboot' as it's more
reliable;
- use kernel 4.15 for AArch64 K8 IEC scenarios;
NOTE: These scenarios will not be released in OPNFV since don't rely
on Salt formulas but instead of Akraino IEC scripts to install K8s.
[1] https://gerrit.akraino.org/r/#/q/project:iec
Change-Id: I4e538e0563d724cd3fd5c4d462ddc22d0c739402
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp/config/states/akraino_iec')
-rwxr-xr-x | mcp/config/states/akraino_iec | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/mcp/config/states/akraino_iec b/mcp/config/states/akraino_iec new file mode 100755 index 000000000..6cc010b05 --- /dev/null +++ b/mcp/config/states/akraino_iec @@ -0,0 +1,49 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2019 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x + +# shellcheck disable=SC1090 +source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" + +IEC_REPO_URI='https://gerrit.akraino.org/r/iec' +IEC_USER='ubuntu' +# shellcheck disable=SC2016 +IEC_REPO_PATH=$(su - "${IEC_USER}" -c 'echo ${HOME}/iec') +IEC_SCRIPTS_PATH="${IEC_REPO_PATH}/src/foundation/scripts" + +POD_NETWORK_CIDR='100.100.0.0/16' # Avoid overlapping Fuel's PXE/admin net + +[ -e "${IEC_REPO_PATH}" ] || su - "${IEC_USER}" -c \ + "git clone '${IEC_REPO_URI}' '${IEC_REPO_PATH}'" +# shellcheck disable=SC2086 +wait_for 3.0 "! salt-cp 'iec*' -C '${IEC_SCRIPTS_PATH}/' \ + '$(dirname ${IEC_SCRIPTS_PATH})' | grep -e False" +salt -C 'iec*' cmd.run "chown -R ${IEC_USER}:${IEC_USER} ${IEC_REPO_PATH}" + +salt -C 'iec*' cmd.run runas="${IEC_USER}" "${IEC_SCRIPTS_PATH}/k8s_common.sh" + +IEC_MASTER_IP=$(salt --out txt -C 'iec* and *01*' pillar.get \ + _param:single_address | cut -d ' ' -f2) +salt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" \ + "${IEC_SCRIPTS_PATH}/k8s_master.sh ${IEC_MASTER_IP} ${POD_NETWORK_CIDR}" + +KUBE_NODE_CNT=$(salt --out txt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" \ + 'kubectl get nodes | grep -c -e "^iec"' | cut -d ' ' -f2) +if [ "${KUBE_NODE_CNT}" != "$(salt-key | grep -c -e '^iec')" ]; then + KUBE_JOIN_CMD=$(salt --out txt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" \ + 'kubeadm token create --print-join-command' | cut -d ' ' -f2-) + salt -C 'iec* and not *01*' cmd.run "${KUBE_JOIN_CMD}" +fi +salt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" 'kubectl get nodes' + +salt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" \ + "${IEC_SCRIPTS_PATH}/setup-cni.sh '' ${POD_NETWORK_CIDR}" +salt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" "${IEC_SCRIPTS_PATH}/nginx.sh" +salt -C 'iec* and *01*' cmd.run runas="${IEC_USER}" "${IEC_SCRIPTS_PATH}/helm.sh" |