Adaptations to execute in multi-node kube cluster 81/5881/1
authorBjornMagnussonXA <bjorn.magnusson@est.tech>
Wed, 7 Apr 2021 23:35:24 +0000 (01:35 +0200)
committerBjornMagnussonXA <bjorn.magnusson@est.tech>
Tue, 13 Apr 2021 08:58:45 +0000 (10:58 +0200)
Issue-ID: NONRTRIC-480

Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: If0df0a9ab83811f1373f50dc154ad90d830e1321

37 files changed:
test/common/README.md
test/common/agent_api_functions.sh
test/common/api_curl.sh
test/common/consul_cbs_functions.sh
test/common/control_panel_api_functions.sh
test/common/controller_api_functions.sh
test/common/cr_api_functions.sh
test/common/ecs_api_functions.sh
test/common/gateway_api_functions.sh
test/common/http_proxy_api_functions.sh
test/common/kube_proxy_api_functions.sh
test/common/mr_api_functions.sh
test/common/prodstub_api_functions.sh
test/common/rapp_catalogue_api_functions.sh
test/common/ricsimulator_api_functions.sh
test/common/test_env-onap-guilin.sh
test/common/test_env-onap-honolulu.sh
test/common/test_env-oran-cherry.sh
test/common/test_env-oran-dawn.sh
test/common/testcase_common.sh
test/simulator-group/control_panel/app.yaml
test/simulator-group/control_panel/nginx.conf
test/simulator-group/control_panel/svc.yaml
test/simulator-group/cr/app.yaml
test/simulator-group/dmaapmr/app.yaml
test/simulator-group/ecs/app.yaml
test/simulator-group/httpproxy/app.yaml
test/simulator-group/kubeproxy/app.yaml
test/simulator-group/kubeproxy/svc.yaml
test/simulator-group/mrstub/app.yaml
test/simulator-group/ngw/app.yaml
test/simulator-group/policy_agent/app.yaml
test/simulator-group/prodstub/app.yaml
test/simulator-group/rapp_catalogue/app.yaml
test/simulator-group/ric/app.yaml
test/simulator-group/sdnc/app.yaml
test/simulator-group/sdnc/app2.yaml

index a6c09e2..99ee015 100644 (file)
@@ -129,7 +129,7 @@ The script can be started with these arguments
 
 | arg list |
 |--|
-| `remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+]` |
+| `remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+] [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--image-repo <repo-address]` |
 
 | parameter | description |
 |-|-|
@@ -146,6 +146,8 @@ The script can be started with these arguments
 | `--use-snapshot-image` | The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names |
 | `--use-staging-image` | The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names |
 | `--use-release-image` | The script will use images from the nexus release repo for the supplied apps, space separated list of app short names |
+| `--image-repo` |  Url to image repo. Only required in when running in multi-node kube cluster, otherwise optional. All used images will be re-tagged and pushed to this repo
+
 | `help` | Print this info along with the test script description and the list of app short names supported |
 
 ## Function: setup_testenvironment
index 11cc145..0c2e48a 100644 (file)
@@ -34,7 +34,7 @@ __PA_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __PA_imagepull() {
-       __check_and_pull_image $1 "$POLICY_AGENT_DISPLAY_NAME" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
+       __check_and_pull_image $1 "$POLICY_AGENT_DISPLAY_NAME" $POLICY_AGENT_APP_NAME POLICY_AGENT_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -45,9 +45,13 @@ __PA_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __PA_image_data() {
        echo -e "$POLICY_AGENT_DISPLAY_NAME\t$(docker images --format $1 $POLICY_AGENT_IMAGE)" >>   $2
+       if [ ! -z "$POLICY_AGENT_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $POLICY_AGENT_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
@@ -928,8 +932,8 @@ api_put_policy_parallel() {
 
        httpproxy="NOPROXY"
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       httpproxy="http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       httpproxy=$KUBE_PROXY_PATH
                fi
        fi
 
@@ -1123,8 +1127,8 @@ api_delete_policy_parallel() {
 
        httpproxy="NOPROXY"
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       httpproxy="http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       httpproxy=$KUBE_PROXY_PATH
                fi
        fi
 
index daa2c29..4ebac80 100644 (file)
@@ -30,8 +30,8 @@ __do_curl_to_api() {
     echo " (${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG
        proxyflag=""
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       proxyflag=" --proxy http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       proxyflag=" --proxy $KUBE_PROXY_PATH"
                fi
        fi
        paramError=0
index c783a61..1b5c8a8 100644 (file)
@@ -43,7 +43,7 @@ __CBS_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __CONSUL_imagepull() {
-       __check_and_pull_image $2 "$CONSUL_DISPLAY_NAME" $CONSUL_APP_NAME $CONSUL_IMAGE
+       __check_and_pull_image $2 "$CONSUL_DISPLAY_NAME" $CONSUL_APP_NAME CONSUL_IMAGE
 }
 
 # Pull image from remote repo or use locally built image
@@ -52,7 +52,7 @@ __CONSUL_imagepull() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __CBS_imagepull() {
-       __check_and_pull_image $2 "$CBS_DISPLAY_NAME" $CBS_APP_NAME $CBS_IMAGE
+       __check_and_pull_image $2 "$CBS_DISPLAY_NAME" $CBS_APP_NAME CBS_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -70,15 +70,23 @@ __CBS_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __CONSUL_image_data() {
        echo -e "$CONSUL_DISPLAY_NAME\t$(docker images --format $1 $CONSUL_IMAGE)" >>   $2
+       if [ ! -z "$CONSUL_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $CONSUL_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __CBS_image_data() {
        echo -e "$CBS_DISPLAY_NAME\t$(docker images --format $1 $CBS_IMAGE)" >>   $2
+       if [ ! -z "$CBS_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $CBS_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index 7620667..df8a4ad 100644 (file)
@@ -35,7 +35,7 @@ __CP_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __CP_imagepull() {
-       __check_and_pull_image $1 "$CONTROL_PANEL_DISPLAY_NAME" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
+       __check_and_pull_image $1 "$CONTROL_PANEL_DISPLAY_NAME" $CONTROL_PANEL_APP_NAME CONTROL_PANEL_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -46,9 +46,13 @@ __CP_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __CP_image_data() {
        echo -e "$CONTROL_PANEL_DISPLAY_NAME\t$(docker images --format $1 $CONTROL_PANEL_IMAGE)" >>   $2
+       if [ ! -z "$CONTROL_PANEL_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $CONTROL_PANEL_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
@@ -164,10 +168,13 @@ start_control_panel() {
                        export CONTROL_PANEL_CONFIG_MOUNT_PATH
                        export CONTROL_PANEL_CONFIG_FILE
                        export CP_CONFIG_CONFIGMAP_NAME=$CONTROL_PANEL_APP_NAME"-config"
+                       export CP_PROXY_CONFIGMAP_NAME=$CONTROL_PANEL_APP_NAME"-proxy"
 
-                       export NGW_DOMAIN_NAME=$NRT_GATEWAY_APP_NAME.$KUBE_NONRTRIC_NAMESPACE
+                       export NGW_DOMAIN_NAME=$NRT_GATEWAY_APP_NAME.$KUBE_NONRTRIC_NAMESPACE.svc.cluster.local  # suffix needed for nginx name resolution
                        export NRT_GATEWAY_EXTERNAL_PORT
 
+                       export CP_NGINX_RESOLVER=$CONTROL_PANEL_NGINX_KUBE_RESOLVER
+
                        #Check if nonrtric namespace exists, if not create it
                        __kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
 
@@ -245,10 +252,11 @@ start_control_panel() {
                export CONTROL_PANEL_DISPLAY_NAME
                export NGW_DOMAIN_NAME=$NRT_GATEWAY_APP_NAME
 
+               export CP_NGINX_RESOLVER=$CONTROL_PANEL_NGINX_DOCKER_RESOLVER
+
                dest_file=$SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_HOST_MNT_DIR/$CONTROL_PANEL_CONFIG_FILE
 
-               envsubst '${NGW_DOMAIN_NAME},${NRT_GATEWAY_EXTERNAL_PORT},${POLICY_AGENT_EXTERNAL_SECURE_PORT},${ECS_EXTERNAL_SECURE_PORT},${POLICY_AGENT_DOMAIN_NAME},${ECS_DOMAIN_NAME}' < $1 > $dest_file
-               #envsubst  < $1 > $dest_file
+               envsubst '${NGW_DOMAIN_NAME},${CP_NGINX_RESOLVER},${NRT_GATEWAY_EXTERNAL_PORT},${POLICY_AGENT_EXTERNAL_SECURE_PORT},${ECS_EXTERNAL_SECURE_PORT},${POLICY_AGENT_DOMAIN_NAME},${ECS_DOMAIN_NAME}' < $1 > $dest_file
 
                __start_container $CONTROL_PANEL_COMPOSE_DIR "" NODOCKERARGS 1 $CONTROL_PANEL_APP_NAME
 
index d405501..7bca91c 100644 (file)
@@ -44,8 +44,8 @@ __SDNC_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __SDNC_imagepull() {
-       __check_and_pull_image $1 "$SDNC_DISPLAY_NAME" $SDNC_APP_NAME $SDNC_A1_CONTROLLER_IMAGE
-       __check_and_pull_image $2 "SDNC DB" $SDNC_APP_NAME $SDNC_DB_IMAGE
+       __check_and_pull_image $1 "$SDNC_DISPLAY_NAME" $SDNC_APP_NAME SDNC_A1_CONTROLLER_IMAGE
+       __check_and_pull_image $2 "SDNC DB" $SDNC_APP_NAME SDNC_DB_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -56,10 +56,17 @@ __SDNC_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __SDNC_image_data() {
        echo -e "$SDNC_DISPLAY_NAME\t$(docker images --format $1 $SDNC_A1_CONTROLLER_IMAGE)" >>   $2
+       if [ ! -z "$SDNC_A1_CONTROLLER_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $SDNC_A1_CONTROLLER_IMAGE_SOURCE)" >>   $2
+       fi
        echo -e "SDNC DB\t$(docker images --format $1 $SDNC_DB_IMAGE)" >>   $2
+       if [ ! -z "$SDNC_DB_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $SDNC_DB_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
@@ -299,8 +306,8 @@ __do_curl_to_controller() {
     echo "  FILE ($payload) : $json"  >> $HTTPLOG
        proxyflag=""
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       proxyflag=" --proxy http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       proxyflag=" --proxy KUBE_PROXY_PATH"
                fi
        fi
     curlString="curl -skw %{http_code} $proxyflag -X POST $SDNC_API_PATH$1 -H accept:application/json -H Content-Type:application/json --data-binary @$payload"
index d587c0c..437b207 100644 (file)
@@ -46,9 +46,13 @@ __CR_imagebuild() {
        echo " Building CR - $CR_DISPLAY_NAME - image: $CR_IMAGE"
        docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $CR_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
-               echo -e  $GREEN" Build Ok"$EGREEN
+               echo -e  $GREEN"  Build Ok"$EGREEN
+               __retag_and_push_image CR_IMAGE
+               if [ $? -ne 0 ]; then
+                       exit 1
+               fi
        else
-               echo -e $RED" Build Failed"$ERED
+               echo -e $RED"  Build Failed"$ERED
                ((RES_CONF_FAIL++))
                cat .dockererr
                echo -e $RED"Exiting...."$ERED
@@ -57,9 +61,13 @@ __CR_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __CR_image_data() {
        echo -e "$CR_DISPLAY_NAME\t$(docker images --format $1 $CR_IMAGE)" >>   $2
+       if [ ! -z "$CR_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $CR_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index d55f439..525ac8b 100644 (file)
@@ -34,7 +34,7 @@ __ECS_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __ECS_imagepull() {
-       __check_and_pull_image $1 "$ECS_DISPLAY_NAME" $ECS_APP_NAME $ECS_IMAGE
+       __check_and_pull_image $1 "$ECS_DISPLAY_NAME" $ECS_APP_NAME ECS_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -45,9 +45,13 @@ __ECS_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __ECS_image_data() {
        echo -e "$ECS_DISPLAY_NAME\t$(docker images --format $1 $ECS_IMAGE)" >>   $2
+       if [ ! -z "$ECS_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $ECS_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index d8f2cf1..fbeaddf 100644 (file)
@@ -35,7 +35,7 @@ __NGW_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __NGW_imagepull() {
-       __check_and_pull_image $1 "$NRT_GATEWAY_DISPLAY_NAME" $NRT_GATEWAY_APP_NAME $NRT_GATEWAY_IMAGE
+       __check_and_pull_image $1 "$NRT_GATEWAY_DISPLAY_NAME" $NRT_GATEWAY_APP_NAME NRT_GATEWAY_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -46,9 +46,13 @@ __NGW_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __NGW_image_data() {
        echo -e "$NRT_GATEWAY_DISPLAY_NAME\t$(docker images --format $1 $NRT_GATEWAY_IMAGE)" >>   $2
+       if [ ! -z "$NRT_GATEWAY_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $NRT_GATEWAY_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index 02ccb92..3e58a7e 100644 (file)
@@ -34,7 +34,7 @@ __HTTPPROXY_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __HTTPPROXY_imagepull() {
-       __check_and_pull_image $2 "$HTTP_PROXY_DISPLAY_NAME" $HTTP_PROXY_APP_NAME $HTTP_PROXY_IMAGE
+       __check_and_pull_image $2 "$HTTP_PROXY_DISPLAY_NAME" $HTTP_PROXY_APP_NAME HTTP_PROXY_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -45,9 +45,13 @@ __HTTPPROXY_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __HTTPPROXY_image_data() {
        echo -e "$HTTP_PROXY_DISPLAY_NAME\t$(docker images --format $1 $HTTP_PROXY_IMAGE)" >>   $2
+       if [ ! -z "$HTTP_PROXY_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $HTTP_PROXY_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index fc9764d..374f3ec 100644 (file)
@@ -35,7 +35,7 @@ __KUBEPROXY_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __KUBEPROXY_imagepull() {
-       __check_and_pull_image $2 "$KUBE_PROXY_DISPLAY_NAME" $KUBE_PROXY_APP_NAME $KUBE_PROXY_IMAGE
+       __check_and_pull_image $2 "$KUBE_PROXY_DISPLAY_NAME" $KUBE_PROXY_APP_NAME KUBE_PROXY_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -46,9 +46,13 @@ __KUBEPROXY_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __KUBEPROXY_image_data() {
        echo -e "$KUBE_PROXY_DISPLAY_NAME\t$(docker images --format $1 $KUBE_PROXY_IMAGE)" >>   $2
+       if [ ! -z "$KUBE_PROXY_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $KUBE_PROXY_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
@@ -83,9 +87,9 @@ __KUBEPROXY_store_docker_logs() {
 ## Access to Kube Http Proxy
 # Host name may be changed if app started by kube
 # Direct access from script
-KUBE_PROXY_HTTPX="http"
-KUBE_PROXY_HOST_NAME=$LOCALHOST_NAME
-KUBE_PROXY_PATH=$KUBE_PROXY_HTTPX"://"$KUBE_PROXY_HOST_NAME":"$KUBE_PROXY_WEB_EXTERNAL_PORT
+#BMXX  KUBE_PROXY_HTTPX="http"
+#BMXX KUBE_PROXY_HOST_NAME=$LOCALHOST_NAME
+#BMXX KUBE_PROXY_PATH=$KUBE_PROXY_HTTPX"://"$KUBE_PROXY_HOST_NAME":"$KUBE_PROXY_WEB_EXTERNAL_PORT
 
 #########################
 ### Http Proxy functions
@@ -151,27 +155,25 @@ start_kube_proxy() {
                fi
 
                echo " Retrieving host and ports for service..."
-               KUBE_PROXY_HOST_NAME=$(__kube_get_service_host $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE)
-               KUBE_PROXY_WEB_EXTERNAL_PORT=$(__kube_get_service_port $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web")
-               KUBE_PROXY_EXTERNAL_PORT=$(__kube_get_service_port $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http")
-
-
-               minikube status > /dev/null
-               if [ $? -eq 0 ]; then
-                       echo -e $GREEN" Running minikube inside a kubernetes cluster. No proxy needed for the test script to access services"$EGREEN
-                       export CLUSTER_KUBE_PROXY_NODEPORT=""
-               else
-                       echo -e $YELLOW" Running outside the kubernetes cluster. Proxy is setup to access services from the test script"$EYELLOW
-                       export CLUSTER_KUBE_PROXY_NODEPORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http")
+
+               CLUSTER_KUBE_PROXY="http"
+               CLUSTER_KUBE_PROXY_HOST=$(kubectl config view -o jsonpath={.clusters[0].cluster.server} | awk -F[/:] '{print $4}')
+               if [[ $CLUSTER_KUBE_PROXY_HOST == *"kubernetes"* ]]; then
+                       echo -e $YELLOW" The cluster host is: $CLUSTER_KUBE_PROXY_HOST. The proxy (mitmproxy) used by test script requires an ip so the ip is assumed and set to 127.0.0.1"
+                       CLUSTER_KUBE_PROXY_HOST="127.0.0.1"
                fi
+               CLUSTER_KUBE_PROXY_NODEPORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "http")  # port for proxy access
+               KUBE_PROXY_WEB_NODEPORT=$(__kube_get_service_nodeport $KUBE_PROXY_APP_NAME $KUBE_SIM_NAMESPACE "web")  # web port, only for alive test
+
+               KUBE_PROXY_WEB_PATH=$CLUSTER_KUBE_PROXY"://"$CLUSTER_KUBE_PROXY_HOST":"$KUBE_PROXY_WEB_NODEPORT
 
-               KUBE_PROXY_PATH=$KUBE_PROXY_HTTPX"://"$KUBE_PROXY_HOST_NAME":"$KUBE_PROXY_WEB_EXTERNAL_PORT
-               KUBE_PROXY_CONFIG_PORT=$KUBE_PROXY_EXTERNAL_PORT
-               KUBE_PROXY_CONFIG_HOST_NAME=$KUBE_PROXY_APP_NAME"."$KUBE_SIM_NAMESPACE
+               echo " Cluster ip/host, cluster http nodeport cluster web nodeport: $CLUSTER_KUBE_PROXY_HOST $CLUSTER_KUBE_PROXY_NODEPORT $KUBE_PROXY_WEB_NODEPORT"
 
-               echo " Host IP, http port, cluster http nodeport (may be empty): $KUBE_PROXY_HOST_NAME $KUBE_PROXY_WEB_EXTERNAL_PORT $CLUSTER_KUBE_PROXY_NODEPORT"
+               export KUBE_PROXY_PATH=  # Make sure proxy is empty when checking the proxy itself
+               __check_service_start $KUBE_PROXY_APP_NAME $KUBE_PROXY_WEB_PATH$KUBE_PROXY_ALIVE_URL
 
-               __check_service_start $KUBE_PROXY_APP_NAME $KUBE_PROXY_PATH$KUBE_PROXY_ALIVE_URL
+               # Set proxy for all subsequent calls for all services etc
+               export KUBE_PROXY_PATH=$CLUSTER_KUBE_PROXY"://"$CLUSTER_KUBE_PROXY_HOST":"$CLUSTER_KUBE_PROXY_NODEPORT
 
        else
                echo $YELLOW" Kube http proxy not needed in docker test. App not started"
index 0d44bdf..1c2f155 100644 (file)
@@ -53,9 +53,9 @@ __MR_imagepull() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __DMAAPMR_imagepull() {
-       __check_and_pull_image $2 "DMAAP Message Router" $MR_DMAAP_APP_NAME $ONAP_DMAAPMR_IMAGE
-       __check_and_pull_image $2 "ZooKeeper" $MR_ZOOKEEPER_APP_NAME $ONAP_ZOOKEEPER_IMAGE
-       __check_and_pull_image $2 "Kafka" $MR_KAFKA_APP_NAME $ONAP_KAFKA_IMAGE
+       __check_and_pull_image $2 "DMAAP Message Router" $MR_DMAAP_APP_NAME ONAP_DMAAPMR_IMAGE
+       __check_and_pull_image $2 "ZooKeeper" $MR_ZOOKEEPER_APP_NAME ONAP_ZOOKEEPER_IMAGE
+       __check_and_pull_image $2 "Kafka" $MR_KAFKA_APP_NAME ONAP_KAFKA_IMAGE
 }
 
 # Build image (only for simulator or interfaces stubs owned by the test environment)
@@ -66,9 +66,13 @@ __MR_imagebuild() {
        echo " Building MR - $MR_STUB_DISPLAY_NAME - image: $MRSTUB_IMAGE"
        docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $MRSTUB_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
-               echo -e  $GREEN" Build Ok"$EGREEN
+               echo -e  $GREEN"  Build Ok"$EGREEN
+               __retag_and_push_image MRSTUB_IMAGE
+               if [ $? -ne 0 ]; then
+                       exit 1
+               fi
        else
-               echo -e $RED" Build Failed"$ERED
+               echo -e $RED"  Build Failed"$ERED
                ((RES_CONF_FAIL++))
                cat .dockererr
                echo -e $RED"Exiting...."$ERED
@@ -84,17 +88,31 @@ __DMAAPMR_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __MR_image_data() {
        echo -e "$MR_STUB_DISPLAY_NAME\t$(docker images --format $1 $MRSTUB_IMAGE)" >>   $2
+       if [ ! -z "$MRSTUB_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $MRSTUB_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __DMAAPMR_image_data() {
        echo -e "DMAAP Message Router\t$(docker images --format $1 $ONAP_DMAAPMR_IMAGE)" >>   $2
+       if [ ! -z "$ONAP_DMAAPMR_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $ONAP_DMAAPMR_IMAGE_SOURCE)" >>   $2
+       fi
        echo -e "ZooKeeper\t$(docker images --format $1 $ONAP_ZOOKEEPER_IMAGE)" >>   $2
+       if [ ! -z "$ONAP_ZOOKEEPER_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $ONAP_ZOOKEEPER_IMAGE_SOURCE)" >>   $2
+       fi
        echo -e "Kafka\t$(docker images --format $1 $ONAP_KAFKA_IMAGE)" >>   $2
+       if [ ! -z "$ONAP_KAFKA_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $ONAP_KAFKA_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index 4d88659..ae3f193 100644 (file)
@@ -46,9 +46,13 @@ __PRODSTUB_imagebuild() {
        echo " Building PRODSTUB - $PROD_STUB_DISPLAY_NAME - image: $PROD_STUB_IMAGE"
        docker build  --build-arg NEXUS_PROXY_REPO=$NEXUS_PROXY_REPO -t $PROD_STUB_IMAGE . &> .dockererr
        if [ $? -eq 0 ]; then
-               echo -e  $GREEN" Build Ok"$EGREEN
+               echo -e  $GREEN"  Build Ok"$EGREEN
+               __retag_and_push_image PROD_STUB_IMAGE
+               if [ $? -ne 0 ]; then
+                       exit 1
+               fi
        else
-               echo -e $RED" Build Failed"$ERED
+               echo -e $RED"  Build Failed"$ERED
                ((RES_CONF_FAIL++))
                cat .dockererr
                echo -e $RED"Exiting...."$ERED
@@ -57,9 +61,13 @@ __PRODSTUB_imagebuild() {
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __PRODSTUB_image_data() {
        echo -e "$PROD_STUB_DISPLAY_NAME\t$(docker images --format $1 $PROD_STUB_IMAGE)" >>   $2
+       if [ ! -z "$PROD_STUB_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $PROD_STUB_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
@@ -261,8 +269,8 @@ __execute_curl_to_prodstub() {
     echo "(${BASH_LINENO[0]}) - ${TIMESTAMP}: ${FUNCNAME[0]}" $@ >> $HTTPLOG
        proxyflag=""
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       proxyflag=" --proxy http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       proxyflag=" --proxy $KUBE_PROXY_PATH"
                fi
        fi
        echo " CMD: $3 $proxyflag" >> $HTTPLOG
index 10f64e6..254883e 100644 (file)
@@ -34,13 +34,17 @@ __RC_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both arg var may contain: 'remote', 'remote-remove' or 'local'
 __RC_imagepull() {
-       __check_and_pull_image $1 "$c" $RAPP_CAT_APP_NAME $RAPP_CAT_IMAGE
+       __check_and_pull_image $1 "$c" $RAPP_CAT_APP_NAME RAPP_CAT_IMAGE
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __RC_image_data() {
        echo -e "$RAPP_CAT_DISPLAY_NAME\t$(docker images --format $1 $RAPP_CAT_IMAGE)" >>   $2
+       if [ ! -z "$RAPP_CAT_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $RAPP_CAT_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
index c82be76..bf30310 100644 (file)
@@ -34,13 +34,17 @@ __RICSIM_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both var may contain: 'remote', 'remote-remove' or 'local'
 __RICSIM_imagepull() {
-       __check_and_pull_image $1 "$RIC_SIM_DISPLAY_NAME" $RIC_SIM_PREFIX"_"$RIC_SIM_BASE $RIC_SIM_IMAGE
+       __check_and_pull_image $1 "$RIC_SIM_DISPLAY_NAME" $RIC_SIM_PREFIX"_"$RIC_SIM_BASE RIC_SIM_IMAGE
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
+# If a custom image repo is used then also the source image from the local repo is listed
 # arg: <docker-images-format-string> <file-to-append>
 __RICSIM_image_data() {
        echo -e "$RIC_SIM_DISPLAY_NAME\t$(docker images --format $1 $RIC_SIM_IMAGE)" >>   $2
+       if [ ! -z "$RIC_SIM_IMAGE_SOURCE" ]; then
+               echo -e "-- source image --\t$(docker images --format $1 $RIC_SIM_IMAGE_SOURCE)" >>   $2
+       fi
 }
 
 # Scale kubernetes resources to zero
@@ -346,8 +350,8 @@ __execute_curl_to_sim() {
        echo ${FUNCNAME[1]} "line: "${BASH_LINENO[1]} >> $HTTPLOG
        proxyflag=""
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       proxyflag=" --proxy http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       proxyflag=" --proxy $KUBE_PROXY_PATH"
                fi
        fi
        echo " CMD: $2 $proxyflag" >> $HTTPLOG
index 809e1f7..f5cf837 100644 (file)
@@ -294,8 +294,7 @@ KUBE_PROXY_EXTERNAL_PORT=8730                            # Kube Http Proxy conta
 KUBE_PROXY_INTERNAL_PORT=8080                            # Kube Http Proxy container internal port (container -> container)
 KUBE_PROXY_WEB_EXTERNAL_PORT=8731                        # Kube Http Proxy container external port (host -> container)
 KUBE_PROXY_WEB_INTERNAL_PORT=8081                        # Kube Http Proxy container internal port (container -> container)
-KUBE_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
-KUBE_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+KUBE_PROXY_PATH=""                                       # Proxy url path, will be set if proxy is started
 KUBE_PROXY_ALIVE_URL="/"                                 # Base path for alive check
 KUBE_PROXY_COMPOSE_DIR="kubeproxy"                       # Dir in simulator_group for docker-compose
 
index 559dab2..8ab85f0 100644 (file)
@@ -359,8 +359,7 @@ KUBE_PROXY_EXTERNAL_PORT=8730                            # Kube Http Proxy conta
 KUBE_PROXY_INTERNAL_PORT=8080                            # Kube Http Proxy container internal port (container -> container)
 KUBE_PROXY_WEB_EXTERNAL_PORT=8731                        # Kube Http Proxy container external port (host -> container)
 KUBE_PROXY_WEB_INTERNAL_PORT=8081                        # Kube Http Proxy container internal port (container -> container)
-KUBE_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
-KUBE_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+KUBE_PROXY_PATH=""                                       # Proxy url path, will be set if proxy is started
 KUBE_PROXY_ALIVE_URL="/"                                 # Base path for alive check
 KUBE_PROXY_COMPOSE_DIR="kubeproxy"                       # Dir in simulator_group for docker-compose
 
index 15b5854..a59c0e0 100755 (executable)
@@ -360,8 +360,7 @@ KUBE_PROXY_EXTERNAL_PORT=8730                            # Kube Http Proxy conta
 KUBE_PROXY_INTERNAL_PORT=8080                            # Kube Http Proxy container internal port (container -> container)
 KUBE_PROXY_WEB_EXTERNAL_PORT=8731                        # Kube Http Proxy container external port (host -> container)
 KUBE_PROXY_WEB_INTERNAL_PORT=8081                        # Kube Http Proxy container internal port (container -> container)
-KUBE_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
-KUBE_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+KUBE_PROXY_PATH=""                                       # Proxy url path, will be set if proxy is started
 KUBE_PROXY_ALIVE_URL="/"                                 # Base path for alive check
 KUBE_PROXY_COMPOSE_DIR="kubeproxy"                       # Dir in simulator_group for docker-compose
 
index 96a4186..1890b71 100755 (executable)
@@ -218,7 +218,7 @@ POLICY_AGENT_HOST_MNT_DIR="./mnt"                        # Mounted dir, relative
 POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
 POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container"     # Alias name, name used by the control panel
 POLICY_AGENT_CONFIG_KEY="policy-agent"                   # Key for consul config
-POLICY_AGENT_PKG_NAME="org.oransc.policyagent"           # Java base package name
+POLICY_AGENT_PKG_NAME="org.onap.ccsdk.oran.a1policymanagementservice"  # Java base package name
 POLICY_AGENT_ACTUATOR="/actuator/loggers/$POLICY_AGENT_PKG_NAME" # Url for trace/debug
 POLICY_AGENT_ALIVE_URL="$PMS_API_PREFIX/v2/status"       # Base path for alive check
 POLICY_AGENT_COMPOSE_DIR="policy_agent"                  # Dir in simulator_group for docker-compose
@@ -383,8 +383,10 @@ CONTROL_PANEL_COMPOSE_DIR="control_panel"                # Dir in simulator_grou
 CONTROL_PANEL_CONFIG_FILE=nginx.conf                     # Config file name
 CONTROL_PANEL_HOST_MNT_DIR="./mnt"                       # Mounted dir, relative to compose file, on the host
 CONTROL_PANEL_CONFIG_MOUNT_PATH=/etc/nginx               # Container internal path for config
+CONTROL_PANEL_NGINX_KUBE_RESOLVER="kube-dns.kube-system.svc.cluster.local valid=5s"  #nginx resolver for kube
+CONTROL_PANEL_NGINX_DOCKER_RESOLVER="127.0.0.11"         # nginx resolver for docker
 
-NRT_GATEWAY_APP_NAME="nonrtricgateway"                  # Name of the Gateway container
+NRT_GATEWAY_APP_NAME="nonrtricgateway"                   # Name of the Gateway container
 NRT_GATEWAY_DISPLAY_NAME="NonRT-RIC Gateway"
 NRT_GATEWAY_EXTERNAL_PORT=9090                           # Gateway container external port (host -> container)
 NRT_GATEWAY_INTERNAL_PORT=9090                           # Gateway container internal port (container -> container)
@@ -416,8 +418,7 @@ KUBE_PROXY_EXTERNAL_PORT=8730                            # Kube Http Proxy conta
 KUBE_PROXY_INTERNAL_PORT=8080                            # Kube Http Proxy container internal port (container -> container)
 KUBE_PROXY_WEB_EXTERNAL_PORT=8731                        # Kube Http Proxy container external port (host -> container)
 KUBE_PROXY_WEB_INTERNAL_PORT=8081                        # Kube Http Proxy container internal port (container -> container)
-KUBE_PROXY_CONFIG_PORT=0                                 # Port number for proxy config, will be set if proxy is started
-KUBE_PROXY_CONFIG_HOST_NAME=""                           # Proxy host, will be set if proxy is started
+KUBE_PROXY_PATH=""                                       # Proxy url path, will be set if proxy is started
 KUBE_PROXY_ALIVE_URL="/"                                 # Base path for alive check
 KUBE_PROXY_COMPOSE_DIR="kubeproxy"                       # Dir in simulator_group for docker-compose
 
index d969245..b232577 100755 (executable)
@@ -26,7 +26,7 @@
 __print_args() {
        echo "Args: remote|remote-remove docker|kube --env-file <environment-filename> [release] [auto-clean] [--stop-at-error] "
        echo "      [--ricsim-prefix <prefix> ] [--use-local-image <app-nam>+]  [--use-snapshot-image <app-nam>+]"
-       echo "      [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+]"
+       echo "      [--use-staging-image <app-nam>+] [--use-release-image <app-nam>+] [--image-repo <repo-address]"
 }
 
 if [ $# -eq 1 ] && [ "$1" == "help" ]; then
@@ -51,6 +51,7 @@ if [ $# -eq 1 ] && [ "$1" == "help" ]; then
        echo "--use-snapshot-image  -  The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names"
        echo "--use-staging-image   -  The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names"
        echo "--use-release-image   -  The script will use images from the nexus release repo for the supplied apps, space separated list of app short names"
+       echo "--image-repo          -  Url to image repo. Only required in when running in multi-node kube cluster, otherwise optional. All used images will be re-tagged and pushed to this repo"
        echo ""
        echo "List of app short names supported: "$APP_SHORT_NAMES
        exit 0
@@ -300,6 +301,9 @@ TCTEST_START=$SECONDS
 TIMER_MEASUREMENTS=".timer_measurement.txt"
 echo -e "Activity \t Duration" > $TIMER_MEASUREMENTS
 
+# If this is set, all used images will be re-tagged and pushed to this repo before any
+IMAGE_REPO_ADR=""
+
 
 echo "-------------------------------------------------------------------------------------------------"
 echo "-----------------------------------      Test case: "$ATC
@@ -503,6 +507,22 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do
                        fi
                fi
        fi
+       if [ $paramerror -eq 0 ]; then
+               if [ "$1" == "--image-repo" ]; then
+                       shift;
+                       IMAGE_REPO_ADR=$1
+                       if [ -z "$1" ]; then
+                               paramerror=1
+                               if [ -z "$paramerror_str" ]; then
+                                       paramerror_str="No image repo url found for : '--image-repo'"
+                               fi
+                       else
+                               echo "Option set - Image repo url: "$1
+                               shift;
+                               foundparm=0
+                       fi
+               fi
+       fi
 done
 echo ""
 
@@ -612,6 +632,7 @@ echo -e "Application\tApp short name\tImage\ttag\ttag-switch" > $image_list_file
 # Check if image env var is set and if so export the env var with image to use (used by docker compose files)
 # arg: <app-short-name> <target-variable-name> <image-variable-name> <image-tag-variable-name> <tag-suffix> <image name>
 __check_and_create_image_var() {
+
        if [ $# -ne 6 ]; then
                echo "Expected arg: <app-short-name> <target-variable-name> <image-variable-name> <image-tag-variable-name> <tag-suffix> <image name>"
                ((IMAGE_ERR++))
@@ -630,6 +651,8 @@ __check_and_create_image_var() {
        tmptag=$4"_"$5
        tag="${!tmptag}"
 
+       optional_image_repo_target=""
+
        if [ -z $image ]; then
                __check_ignore_image $1
                if [ $? -eq 0 ]; then
@@ -647,6 +670,9 @@ __check_and_create_image_var() {
                echo ""
                tmp=$tmp"<no-image>\t"
        else
+
+               optional_image_repo_target=$image
+
                #Add repo depending on image type
                if [ "$5" == "REMOTE_RELEASE" ]; then
                        image=$NEXUS_RELEASE_REPO$image
@@ -680,7 +706,14 @@ __check_and_create_image_var() {
        tmp=$tmp"\t"$5
        echo -e "$tmp" >> $image_list_file
        #Export the env var
-       export "${2}"=$image":"$tag
+       export "${2}"=$image":"$tag  #Note, this var may be set to the value of the target value below in __check_and_pull_image
+       if [ ! -z "$IMAGE_REPO_ADR" ]; then
+               export "${2}_SOURCE"=$image":"$tag  #Var to keep the actual source image
+               export "${2}_TARGET"=$IMAGE_REPO_ADR"/"$optional_image_repo_target":"$tag  #Create image + tag for optional image repo - pushed later if needed
+       else
+               export "${2}_SOURCE"=""
+               export "${2}_TARGET"=""
+       fi
 }
 
 # Check if app uses image included in this test run
@@ -830,21 +863,58 @@ __check_image_override() {
        return 0
 }
 
+# Function to re-tag and image and push to another image repo
+__retag_and_push_image() {
+       if [ ! -z "$IMAGE_REPO_ADR" ]; then
+               source_image="${!1}"
+               trg_var_name=$1_"TARGET" # This var is created in func __check_and_create_image_var
+               target_image="${!trg_var_name}"
+               echo -ne "  Attempt to re-tag image to: ${BOLD}${target_image}${EBOLD}${SAMELINE}"
+               tmp=$(docker image tag $source_image ${target_image} )
+               if [ $? -ne 0 ]; then
+                       docker stop $tmp &> ./tmp/.dockererr
+                       ((IMAGE_ERR++))
+                       echo ""
+                       echo -e "  Attempt to re-tag image to: ${BOLD}${target_image}${EBOLD} - ${RED}Failed${ERED}"
+                       cat ./tmp/.dockererr
+                       return 1
+               else
+                       echo -e "  Attempt to re-tag image to: ${BOLD}${target_image}${EBOLD} - ${GREEN}OK${EGREEN}"
+               fi
+               echo -ne "  Attempt to push re-tagged image: ${BOLD}${target_image}${EBOLD}${SAMELINE}"
+               tmp=$(docker push ${target_image} )
+               if [ $? -ne 0 ]; then
+                       docker stop $tmp &> ./tmp/.dockererr
+                       ((IMAGE_ERR++))
+                       echo ""
+                       echo -e "  Attempt to push re-tagged image: ${BOLD}${target_image}${EBOLD} - ${RED}Failed${ERED}"
+                       cat ./tmp/.dockererr
+                       return 1
+               else
+                       echo -e "  Attempt to push re-tagged image: ${BOLD}${target_image}${EBOLD} - ${GREEN}OK${EGREEN}"
+               fi
+               export "${1}"=$target_image
+       fi
+       return 0
+}
+
 #Function to check if image exist and stop+remove the container+pull new images as needed
-#args <script-start-arg> <descriptive-image-name> <container-base-name> <image-with-tag>
+#args <script-start-arg> <descriptive-image-name> <container-base-name> <image-with-tag-var-name>
 __check_and_pull_image() {
 
-       echo -e " Checking $BOLD$2$EBOLD container(s) with basename: $BOLD$3$EBOLD using image: $BOLD$4$EBOLD"
+       source_image="${!4}"
+
+       echo -e " Checking $BOLD$2$EBOLD container(s) with basename: $BOLD$3$EBOLD using image: $BOLD$source_image$EBOLD"
        format_string="\"{{.Repository}}\\t{{.Tag}}\\t{{.CreatedSince}}\\t{{.Size}}\""
-       tmp_im=$(docker images --format $format_string ${4})
+       tmp_im=$(docker images --format $format_string $source_image)
 
        if [ $1 == "local" ]; then
                if [ -z "$tmp_im" ]; then
-                       echo -e "  "$2" (local image): \033[1m"$4"\033[0m $RED does not exist in local registry, need to be built (or manually pulled)"$ERED
+                       echo -e "  "$2" (local image): \033[1m"$source_image"\033[0m $RED does not exist in local registry, need to be built (or manually pulled)"$ERED
                        ((IMAGE_ERR++))
                        return 1
                else
-                       echo -e "  "$2" (local image): \033[1m"$4"\033[0m "$GREEN"OK"$EGREEN
+                       echo -e "  "$2" (local image): \033[1m"$source_image"\033[0m "$GREEN"OK"$EGREEN
                fi
        elif [ $1 == "remote" ] || [ $1 == "remote-remove" ]; then
                if [ $1 == "remote-remove" ]; then
@@ -881,7 +951,7 @@ __check_and_pull_image() {
                fi
                if [ -z "$tmp_im" ]; then
                        echo -ne "  Pulling image${SAMELINE}"
-                       out=$(docker pull $4)
+                       out=$(docker pull $source_image)
                        if [ $? -ne 0 ]; then
                                echo ""
                                echo -e "  Pulling image -$RED could not be pulled"$ERED
@@ -902,7 +972,10 @@ __check_and_pull_image() {
                        echo -e "  Pulling image -$GREEN OK $EGREEN(exists in local repository)"
                fi
        fi
-       return 0
+
+       __retag_and_push_image $4
+
+       return $?
 }
 
 setup_testenvironment() {
@@ -1078,6 +1151,30 @@ setup_testenvironment() {
        column -t -s $'\t' $docker_tmp_file | indent1
 
        echo ""
+       if [ $RUNMODE == "KUBE" ]; then
+
+               echo "================================================================================="
+               echo "================================================================================="
+
+               CLUSTER_IP=$(kubectl config view -o jsonpath={.clusters[0].cluster.server} | awk -F[/:] '{print $4}')
+               if [[ $CLUSTER_IP != *"kubernetes"* ]]; then
+                       echo -e $YELLOW" The cluster ip is: $CLUSTER_IP. This kubernetes is likely a multi-node cluster."$EYELLOW
+                       echo -e $YELLOW" The image pull policy is set to 'Never'."$EYELLOW
+                       export KUBE_IMAGE_PULL_POLICY="Never"
+                       if [ -z "$IMAGE_REPO_ADR" ]; then
+                               echo -e $RED" The flag --image-repo need to be provided to the cmd with the path to a custom image repo'."$ERED
+                               exit 1
+                       fi
+               else
+                       echo -e $YELLOW" The cluster ip is: $CLUSTER_IP. This kubernetes is likely a single-node cluster on a local machine."$EYELLOW
+                       echo -e $YELLOW" The image pull policy is set to 'Never'."$EYELLOW
+                       export KUBE_IMAGE_PULL_POLICY="Never"
+               fi
+
+               echo "================================================================================="
+               echo "================================================================================="
+               echo ""
+       fi
 
        echo -e $BOLD"======================================================="$EBOLD
        echo -e $BOLD"== Common test setup completed -  test script begins =="$EBOLD
@@ -2091,12 +2188,13 @@ store_logs() {
 # returns: The return code is 0 for ok and 1 for not ok
 __do_curl() {
        echo ${FUNCNAME[1]} "line: "${BASH_LINENO[1]} >> $HTTPLOG
-       curlString="curl -skw %{http_code} $@"
+       proxyflag=""
        if [ $RUNMODE == "KUBE" ]; then
-               if [ ! -z "$CLUSTER_KUBE_PROXY_NODEPORT" ]; then
-                       curlString="curl -skw %{http_code} --proxy http://localhost:$CLUSTER_KUBE_PROXY_NODEPORT $@"
+               if [ ! -z "$KUBE_PROXY_PATH" ]; then
+                       proxyflag=" --proxy $KUBE_PROXY_PATH"
                fi
        fi
+       curlString="curl -skw %{http_code} $proxyflag $@"
        echo " CMD: $curlString" >> $HTTPLOG
        res=$($curlString)
        echo " RESP: $res" >> $HTTPLOG
index a962f3d..2b2b84b 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $CONTROL_PANEL_APP_NAME
         image: $CONTROL_PANEL_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $CONTROL_PANEL_INTERNAL_PORT
index 0014ffb..5b1e895 100644 (file)
@@ -18,7 +18,9 @@ events{}
 
 http {
     include /etc/nginx/mime.types;
-    resolver 127.0.0.11;
+
+    resolver ${CP_NGINX_RESOLVER};
+
     server {
         listen 8080;
         server_name localhost;
index 85a4682..61dc5de 100644 (file)
@@ -7,15 +7,17 @@ metadata:
     run: $CONTROL_PANEL_APP_NAME
     autotest: CP
 spec:
-  type: ClusterIP
+  type: NodePort
   ports:
   - port: $CONTROL_PANEL_EXTERNAL_PORT
     targetPort: $CONTROL_PANEL_INTERNAL_PORT
     protocol: TCP
     name: http
+    nodePort:
   - port: $CONTROL_PANEL_EXTERNAL_SECURE_PORT
     targetPort: $CONTROL_PANEL_INTERNAL_SECURE_PORT
     protocol: TCP
     name: https
+    nodePort:
   selector:
     run: $CONTROL_PANEL_APP_NAME
\ No newline at end of file
index 3497b88..0cb36d2 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $CR_APP_NAME
         image: $CR_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $CR_INTERNAL_PORT
index 50e6943..39756bb 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $MR_DMAAP_KUBE_APP_NAME
         image: $ONAP_DMAAPMR_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $MR_INTERNAL_PORT
@@ -77,7 +77,7 @@ spec:
       containers:
       - name: $MR_KAFKA_BWDS_NAME
         image: $ONAP_KAFKA_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: 9092
@@ -142,7 +142,7 @@ spec:
       containers:
       - name: $MR_ZOOKEEPER_APP_NAME
         image: $ONAP_ZOOKEEPER_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: 2181
index 640b61d..bc1bad9 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $ECS_APP_NAME
         image: $ECS_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $ECS_INTERNAL_PORT
index 3e0c8ac..266eb19 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $HTTP_PROXY_APP_NAME
         image: $HTTP_PROXY_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $HTTP_PROXY_INTERNAL_PORT
index 08241a3..3e6636b 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $KUBE_PROXY_APP_NAME
         image: $KUBE_PROXY_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $KUBE_PROXY_INTERNAL_PORT
index 1a11fc4..ea04483 100644 (file)
@@ -18,5 +18,6 @@ spec:
     targetPort: $KUBE_PROXY_WEB_INTERNAL_PORT
     protocol: TCP
     name: web
+    nodePort:
   selector:
     run: $KUBE_PROXY_APP_NAME
index f29db93..0cf0f51 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $MR_STUB_APP_NAME
         image: $MRSTUB_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $MR_INTERNAL_PORT
index c38de9f..9070603 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $NRT_GATEWAY_APP_NAME
         image: $NRT_GATEWAY_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $NRT_GATEWAY_INTERNAL_PORT
index ddbae37..bbe8fae 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $POLICY_AGENT_APP_NAME
         image: $POLICY_AGENT_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $POLICY_AGENT_INTERNAL_PORT
index 9fb5ad5..b8f27e2 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $PROD_STUB_APP_NAME
         image: $PROD_STUB_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $PROD_STUB_INTERNAL_PORT
index 0c0a26c..65a9f80 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $RAPP_CAT_APP_NAME
         image: $RAPP_CAT_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $RAPP_CAT_INTERNAL_PORT
index df5d982..a404039 100644 (file)
@@ -28,7 +28,7 @@ spec:
           value: "1"
         - name: ALLOW_HTTP
           value: "true"
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $RIC_SIM_INTERNAL_PORT
index 75e30d4..13d4739 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $SDNC_APP_NAME
         image: $SDNC_A1_CONTROLLER_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $SDNC_INTERNAL_PORT
@@ -64,7 +64,7 @@ spec:
       containers:
         - name: $SDNC_DB_APP_NAME
           image: $SDNC_DB_IMAGE
-          imagePullPolicy: Never
+          imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
           ports:
           - name: http
             containerPort: 3306
index 3a0f597..48aeaf9 100644 (file)
@@ -20,7 +20,7 @@ spec:
       containers:
       - name: $SDNC_APP_NAME
         image: $SDNC_A1_CONTROLLER_IMAGE
-        imagePullPolicy: Never
+        imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
         ports:
         - name: http
           containerPort: $SDNC_INTERNAL_PORT
@@ -80,7 +80,7 @@ spec:
       containers:
         - name: $SDNC_DB_APP_NAME
           image: $SDNC_DB_IMAGE
-          imagePullPolicy: Never
+          imagePullPolicy: $KUBE_IMAGE_PULL_POLICY
           ports:
           - name: http
             containerPort: 3306