diff options
Diffstat (limited to 'csit')
-rwxr-xr-x | csit/resources/scripts/get-cluster-info.sh | 26 | ||||
-rwxr-xr-x | csit/run-k8s-csit.sh | 57 | ||||
-rwxr-xr-x | csit/start-s3p-tests.sh | 27 |
3 files changed, 90 insertions, 20 deletions
diff --git a/csit/resources/scripts/get-cluster-info.sh b/csit/resources/scripts/get-cluster-info.sh index efe0f517..272d2965 100755 --- a/csit/resources/scripts/get-cluster-info.sh +++ b/csit/resources/scripts/get-cluster-info.sh @@ -28,7 +28,9 @@ export XACML_PORT=30004 export DROOLS_PORT=30005 export DIST_PORT=30006 export ACM_PORT=30007 -export POLICY_PARTICIPANT_PORT=30008 +export POLICY_PF_PARTICIPANT_PORT=30008 +export POLICY_HTTP_PARTICIPANT_PORT=30009 +export POLICY_K8S_PARTICIPANT_PORT=30010 export DMAAP_PORT=30904 # Retrieve pod names @@ -42,19 +44,23 @@ function get_pod_names() { export DIST_POD=$(get_pod_name distribution) export ACM_POD=$(get_pod_name acm-runtime) export POLICY_PPNT_POD=$(get_pod_name policy-ppnt) + export POLICY_PPNT_POD=$(get_pod_name http-ppnt) + export POLICY_PPNT_POD=$(get_pod_name k8s-ppnt) } # Retrieve service names function get_svc_names() { - export APEX_SVC=$(get_svc_name policy-apex) + export APEX_SVC=$(get_svc_name policy-apex-pdp) export PAP_SVC=$(get_svc_name policy-pap) export API_SVC=$(get_svc_name policy-api) export DMAAP_SVC=$(get_svc_name message-router) export DROOLS_SVC=$(get_svc_name drools-pdp) - export XACML_SVC=$(get_svc_name xacml) - export DIST_SVC=$(get_svc_name distribution) - export ACM_SVC=$(get_svc_name acm-runtime) - export POLICY_PPNT_SVC=$(get_svc_name policy-ppnt) + export XACML_SVC=$(get_svc_name policy-xacml-pdp) + export DIST_SVC=$(get_svc_name policy-distribution) + export ACM_SVC=$(get_svc_name policy-clamp-runtime-acm) + export POLICY_PPNT_SVC=$(get_svc_name policy-clamp-ac-pf-ppnt) + export POLICY_HTTP_SVC=$(get_svc_name policy-clamp-ac-http-ppnt) + export POLICY_K8S_SVC=$(get_svc_name policy-clamp-ac-k8s-ppnt) } # Expose services in order to perform tests from JMeter @@ -66,7 +72,9 @@ function expose_services() { expose_service $DROOLS_SVC expose_service $DIST_SVC expose_service $ACM_SVC - export_service $POLICY_PPNT_SVC + expose_service $POLICY_PPNT_SVC + expose_service POLICY_HTTP_SVC + expose_service POLICY_K8S_SVC setup_message_router_svc sleep 2 @@ -95,7 +103,9 @@ function patch_ports() { patch_port "$API_SVC" $API_PORT patch_port "$PAP_SVC" $PAP_PORT patch_port "$ACM_SVC" $ACM_PORT - patch_port "$POLICY_PPNT_SVC" $POLICY_PARTICIPANT_PORT + patch_port "$POLICY_PPNT_SVC" $POLICY_PF_PARTICIPANT_PORT + patch_port "$HTTP_PPNT_SVC" $POLICY_HTTP_PARTICIPANT_PORT + patch_port "$K8S_PPNT_SVC" $POLICY_K8S_PARTICIPANT_PORT patch_port "$DIST_SVC" $DIST_PORT patch_port "$DROOLS_SVC" $DROOLS_PORT patch_port "$XACML_SVC" $XACML_PORT diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index 248a494f..9fd6159c 100755 --- a/csit/run-k8s-csit.sh +++ b/csit/run-k8s-csit.sh @@ -248,6 +248,10 @@ function set_project_config() { *) echo "Unknown project supplied. Enabling all policy charts for the deployment" + export READINESS_CONTAINERS=($POLICY_APEX_CONTAINER,$POLICY_API_CONTAINER,$POLICY_PAP_CONTAINER, + $POLICY_DISTRIBUTION_CONTAINER,$POLICY_DROOLS_CONTAINER,$POLICY_XACML_CONTAINER, + $POLICY_CLAMP_CONTAINER,$POLICY_PF_PPNT_CONTAINER,$POLICY_K8S_PPNT_CONTAINER, + $POLICY_HTTP_PPNT_CONTAINER) export SET_VALUES="--set $POLICY_APEX_CONTAINER.enabled=true --set $POLICY_XACML_CONTAINER.enabled=true --set $POLICY_DISTRIBUTION_CONTAINER.enabled=true --set $POLICY_POLICY_DROOLS_CONTAINER.enabled=true --set $POLICY_CLAMP_CONTAINER.enabled=true --set $POLICY_PF_PPNT_CONTAINER.enabled=true @@ -279,6 +283,58 @@ function push_acelement_chart() { echo "-------------------------------------------" } +function get_pod_name() { + microk8s kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1 +} + +wait_for_pods_running() { + local namespace="$1" + shift + local timeout_seconds="$1" + shift + + IFS=',' read -ra pod_names <<< "$1" + shift + + local pending_pods=("${pod_names[@]}") + + local start_time + start_time=$(date +%s) + + while [ ${#pending_pods[@]} -gt 0 ]; do + local current_time + current_time=$(date +%s) + local elapsed_time + elapsed_time=$((current_time - start_time)) + + if [ "$elapsed_time" -ge "$timeout_seconds" ]; then + echo "Timed out waiting for all pods to reach 'Running' state." + exit 1 + fi + + local newly_running_pods=() + + for pod_name_prefix in "${pending_pods[@]}"; do + local pod_name=$(get_pod_name "$pod_name_prefix") + local pod_status + pod_status=$(kubectl get pod "$pod_name" -n "$namespace" --no-headers -o custom-columns=STATUS:.status.phase 2>/dev/null) + + if [ "$pod_status" == "Running" ]; then + echo "Pod '$pod_name' in namespace '$namespace' is now in 'Running' state." + else + newly_running_pods+=("$pod_name") + echo "Waiting for pod '$pod_name' in namespace '$namespace' to reach 'Running' state..." + fi + done + + pending_pods=("${newly_running_pods[@]}") + + sleep 5 + done + + echo "All specified pods are in the 'Running' state. Exiting the function." +} + OPERATION="$1" PROJECT="$2" @@ -305,6 +361,7 @@ if [ $OPERATION == "install" ]; then sudo microk8s helm dependency build policy sudo microk8s helm install csit-policy policy ${SET_VALUES} sudo microk8s helm install prometheus prometheus + wait_for_pods_running default 300 $READINESS_CONTAINERS echo "Policy chart installation completed" echo "-------------------------------------------" fi diff --git a/csit/start-s3p-tests.sh b/csit/start-s3p-tests.sh index 1609e4bb..b1bed110 100755 --- a/csit/start-s3p-tests.sh +++ b/csit/start-s3p-tests.sh @@ -40,14 +40,20 @@ function install_jmeter() { sudo apt install -y default-jdk # Install JMeter - curl -O https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.tgz - tar -xvf apache-jmeter-5.3.tgz + curl -O https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.6.2.tgz + tar -xvf apache-jmeter-5.6.2.tgz + mv apache-jmeter-5.6.2 apache-jmeter + + # Define your desired heap size values + echo 'export JVM_ARGS="-Xms2g -Xmx4g"' > apache-jmeter/bin/setenv.sh + echo 'export HEAP="-Xms1G -Xmx2G -XX:MaxMetaspaceSize=512m"' >> apache-jmeter/bin/setenv.sh + # Remove unnecessary files - rm -rf apache-jmeter-5.3/docs apache-jmeter-5.3/printable_docs + rm -rf apache-jmeter/docs apache-jmeter/printable_docs # Install CMD Runner - cd apache-jmeter-5.3/lib + cd apache-jmeter/lib curl -O https://repo1.maven.org/maven2/kg/apc/cmdrunner/2.2.1/cmdrunner-2.2.1.jar # Install Plugin Manager @@ -59,13 +65,11 @@ function install_jmeter() { java -jar cmdrunner-2.2.1.jar --tool org.jmeterplugins.repository.PluginManagerCMD install-all-except jpgc-hadoop,jpgc-oauth,ulp-jmeter-autocorrelator-plugin,ulp-jmeter-videostreaming-plugin,ulp-jmeter-gwt-plugin,tilln-iso8583 # Move JMeter to /opt - sudo cp -r ../../apache-jmeter-5.3 /opt/ + sudo cp -r ../../apache-jmeter /opt/ # Add JMeter Path Variable - nano .profile - JMETER_HOME="/opt/apache-jmeter-5.3" - PATH="$JMETER_HOME/bin:$PATH" - source ~/.profile + export JMETER_HOME="/opt/apache-jmeter" + export PATH="$JMETER_HOME/bin:$PATH" } function on_exit() { @@ -107,7 +111,7 @@ then echo "Executing tests" echo "===========================" cd ${TESTDIR}/automate-performance || exit - nohup apache-jmeter-5.3/bin/jmeter -n -t $2 -l s3pTestResults.jtl + nohup jmeter -n -t $2 -l s3pTestResults.jtl # TODO: Generate report on on_exit() @@ -117,5 +121,4 @@ then teardown else echo "Invalid arguments provided. Usage: $0 [option..] {run | uninstall}" -fi - +fi
\ No newline at end of file |