[CORD-2466]
Create a multi-node k8s-compatible scenario
Change-Id: I618a66323672d646847e438f1e0c320962e75642
diff --git a/Makefile b/Makefile
index c3c3038..77cebbc 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,7 @@
BUILD ?= .
CORD ?= ..
PI ?= $(BUILD)/platform-install
+KUBESPRAY ?= $(BUILD)/kubespray
MAAS ?= $(BUILD)/maas
ONOS_APPS ?= $(CORD)/onos-apps
@@ -20,14 +21,11 @@
endif
PROFILE_D ?= $(CORD)/orchestration/profiles/$(USECASE)
-
-PODCONFIG_D ?= $(PROFILE_D)/podconfig
-PODCONFIG_PATH ?= $(PODCONFIG_D)/$(PODCONFIG)
+PODCONFIG_PATH ?= $(PROFILE_D)/podconfig/$(PODCONFIG)
SCENARIOS_D ?= $(BUILD)/scenarios
GENCONFIG_D ?= $(BUILD)/genconfig
-
CONFIG_CORD_PROFILE_DIR ?= $(CORD)/../cord_profile
# Milestones/logs paths
@@ -35,13 +33,14 @@
LOGS ?= $(BUILD)/logs
PREP_MS ?= $(M)/prereqs-check $(M)/build-local-bootstrap $(M)/ciab-ovs $(M)/vagrant-up $(M)/vagrant-ssh-install $(M)/copy-cord $(M)/cord-config $(M)/copy-config $(M)/prep-buildnode $(M)/prep-headnode $(M)/deploy-elasticstack $(M)/prep-computenode
+KS_MS ?= $(M)/prep-kubespray $(M)/deploy-kubespray
MAAS_MS ?= $(M)/build-maas-images $(M)/maas-prime $(M)/publish-maas-images $(M)/deploy-maas
OPENSTACK_MS ?= $(M)/glance-images $(M)/deploy-openstack $(M)/deploy-computenode $(M)/onboard-openstack
XOS_MS ?= $(M)/docker-images $(M)/core-image $(M)/publish-docker-images $(M)/start-xos $(M)/onboard-profile
ONOS_MS ?= $(M)/build-onos-apps $(M)/publish-onos-apps $(M)/deploy-onos $(M)/deploy-mavenrepo
POST_INSTALL_MS ?= $(M)/setup-automation $(M)/setup-ciab-pcu $(M)/compute1-up $(M)/compute2-up $(M)/compute3-up
LOCAL_MILESTONES ?= $(M)/local-cord-config $(M)/local-docker-images $(M)/local-core-image $(M)/local-start-xos $(M)/local-onboard-profile
-ALL_MILESTONES ?= $(PREP_MS) $(MAAS_MS) $(OPENSTACK_MS) $(XOS_MS) $(ONOS_MS) $(POST_INSTALL_MS) $(LOCAL_MILESTONES)
+ALL_MILESTONES ?= $(PREP_MS) $(KS_MS) $(MAAS_MS) $(OPENSTACK_MS) $(XOS_MS) $(ONOS_MS) $(POST_INSTALL_MS) $(LOCAL_MILESTONES)
# Configuration files
MASTER_CONFIG ?= $(GENCONFIG_D)/config.yml
@@ -80,10 +79,11 @@
VAGRANT ?= VAGRANT_CWD=$(VAGRANT_CWD) vagrant
ANSIBLE ?= ansible -i $(INVENTORY)
ANSIBLE_PB ?= ansible-playbook $(ANSIBLE_ARGS) -i $(INVENTORY) --extra-vars @$(MASTER_CONFIG)
+ANSIBLE_PB_KS ?= ANSIBLE_CONFIG=../ansible.cfg ansible-playbook $(ANSIBLE_ARGS) -b -i inventory/inventory.cord --extra-vars @../$(MASTER_CONFIG)
ANSIBLE_PB_LOCAL ?= ansible-playbook $(ANSIBLE_ARGS) -i $(PI)/inventory/head-localhost $(EXTRA_VARS)
ANSIBLE_PB_MAAS ?= ansible-playbook $(ANSIBLE_ARGS) -i /etc/maas/ansible/pod-inventory $(EXTRA_VARS)
IMAGEBUILDER ?= python $(BUILD)/scripts/imagebuilder.py
-LOGCMD ?= 2>&1 | tee -a $(LOGS)/$(TS)_$(@F)
+LOGCMD ?= 2>&1 | tee -a $(abspath $(LOGS)/$(TS)_$(@F))
SSH_HEAD ?= ssh $(HEADNODE)
SSH_BUILD ?= ssh $(BUILDNODE)
@@ -140,6 +140,10 @@
$(SSH_HEAD) "/opt/cord/build/platform-install/scripts/clean_openstack.sh" $(LOGCMD)
rm -f $(M)/onboard-openstack
+clean-kubespray:
+ rm -f $(KS_MS)
+ rm -rf $(KUBESPRAY)
+
collect-diag:
$(ANSIBLE_PB) $(PI)/collect-diag-playbook.yml $(LOGCMD)
@@ -184,6 +188,7 @@
CONFIG_SSH_KEY_PREREQS ?=
PREP_BUILDNODE_PREREQS ?=
PREP_HEADNODE_PREREQS ?=
+PREP_KUBESPRAY_PREREQS ?=
DOCKER_IMAGES_PREREQS ?=
START_XOS_PREREQS ?=
BUILD_ONOS_APPS_PREREQS ?=
@@ -254,6 +259,16 @@
touch $@
+# kubespray targets
+$(M)/prep-kubespray: | $(M)/vagrant-ssh-install $(PREP_KUBESPRAY_PREREQS)
+ $(ANSIBLE_PB) $(BUILD)/ansible/prep-kubespray.yml $(LOGCMD)
+ touch $@
+
+$(M)/deploy-kubespray: | $(M)/prep-kubespray
+ cd $(KUBESPRAY); $(ANSIBLE_PB_KS) cluster.yml $(LOGCMD)
+ touch $@
+
+
# MaaS targets
$(M)/build-maas-images: | $(M)/prep-buildnode $(BUILD_MAAS_IMAGES_PREREQS)
$(SSH_BUILD) "cd $(BUILD_CORD_DIR)/build/maas; rm -f consul.image; make MAKE_CONFIG=../$(MAKEFILE_CONFIG) build" $(LOGCMD)