From be7a5e84618c149418e9ee0913f8412cecf95efb Mon Sep 17 00:00:00 2001 From: maelk Date: Wed, 14 Aug 2019 16:40:16 +0300 Subject: [PATCH] add doc and test for running operators locally - add code documentation for environment variables - add test to check that the operators are running locally - add user example --- 03_launch_mgmt_cluster.sh | 14 ++++++++++++++ 04_verify.sh | 8 ++++++++ config_example.sh | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/03_launch_mgmt_cluster.sh b/03_launch_mgmt_cluster.sh index 78100caa2..f1a53adb9 100755 --- a/03_launch_mgmt_cluster.sh +++ b/03_launch_mgmt_cluster.sh @@ -9,6 +9,20 @@ source lib/common.sh eval "$(go env)" export GOPATH +# Environment variables +# M3PATH : Path to clone the metal3 dev env repo +# BMOPATH : Path to clone the baremetal operator repo +# CAPBMPATH: Path to clone the CAPI operator repo +# +# BMOREPO : Baremetal operator repository URL +# BMOBRANCH : Baremetal operator repository branch to checkout +# CAPBMREPO : CAPI operator repository URL +# CAPBMBRANCH : CAPI repository branch to checkout +# FORCE_REPO_UPDATE : discard existing directories +# +# BMO_RUN_LOCAL : run the baremetal operator locally (not in Kubernetes cluster) +# CAPBM_RUN_LOCAL : run the CAPI operator locally + M3PATH="${GOPATH}/src/github.com/metal3-io" BMOPATH="${M3PATH}/baremetal-operator" CAPBMPATH="${M3PATH}/cluster-api-provider-baremetal" diff --git a/04_verify.sh b/04_verify.sh index 5299c9f64..25089d3ce 100755 --- a/04_verify.sh +++ b/04_verify.sh @@ -194,6 +194,14 @@ FAILS=$(check_k8s_entity deployments "${EXPTD_DEPLOYMENTS}") # Verify the Operators, Replica sets FAILS=$(check_k8s_rs "${EXPTD_DEPLOYMENTS}") +if [[ "${BMO_RUN_LOCAL}" == true ]]; then + pgrep "operator-sdk" > /dev/null 2> /dev/null + FAILS=$(process_status $? "Baremetal operator locally running") +fi +if [[ "${CAPBM_RUN_LOCAL}" == true ]]; then + pgrep -f "go run ./cmd/manager/main.go" > /dev/null 2> /dev/null + FAILS=$(process_status $? "CAPI operator locally running") +fi #Verify Ironic containers are running for name in ironic ironic-inspector dnsmasq httpd mariadb; do diff --git a/config_example.sh b/config_example.sh index 6a9bd880c..80a692719 100644 --- a/config_example.sh +++ b/config_example.sh @@ -46,3 +46,13 @@ # Force deletion of the BMO and CAPBM repositories before cloning them again # #export FORCE_REPO_UPDATE="${FORCE_REPO_UPDATE:-false}" + +# +# Run a local baremetal operator instead of deploying in Kubernetes +# +#export BMO_RUN_LOCAL=true + +# +# Run a local CAPI operator instead of deploying in Kubernetes +# +#export CAPBM_RUN_LOCAL=true