Add scripts for building and destroying localtesting env 73/15273/2
authorAshish Jain <jain.ashish@samsung.com>
Sun, 16 Nov 2025 17:32:26 +0000 (17:32 +0000)
committerAshish Jain <jain.ashish@samsung.com>
Fri, 21 Nov 2025 06:00:27 +0000 (06:00 +0000)
Adding the following scripts:
1. setup_local_testing_env.sh: Which Deploys kind cluster,
   cassandra-secret, dataextraction componenet for local-testing.
2. teardown_local_testing_env.sh: It uninstalls the mme component and
   deletes the kind-cluster.

Issue-Id: AIMLFW-314

Change-Id: I24779f1723709baf18354c780830777c446e5d5d
Signed-off-by: ashishj1729 <jain.ashish@samsung.com>
component-testing/local-testing/kind.yaml [new file with mode: 0644]
component-testing/local-testing/setup_local_testing_env.sh [new file with mode: 0644]
component-testing/local-testing/teardown_local_testing_env.sh [new file with mode: 0644]

diff --git a/component-testing/local-testing/kind.yaml b/component-testing/local-testing/kind.yaml
new file mode 100644 (file)
index 0000000..e7fc0f9
--- /dev/null
@@ -0,0 +1,22 @@
+# ==================================================================================
+#
+#       Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+  - role: control-plane
+    image: kindest/node:v1.32.0
\ No newline at end of file
diff --git a/component-testing/local-testing/setup_local_testing_env.sh b/component-testing/local-testing/setup_local_testing_env.sh
new file mode 100644 (file)
index 0000000..905ac5e
--- /dev/null
@@ -0,0 +1,56 @@
+# ==================================================================================
+#
+#       Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
+echo -e "The following script will setup the local testing environment which includes: \nCreating kind Cluster, deploying dataextraction component & mocks"
+# Prerequisties
+# 1. Docker
+
+CLUSTER_NAME="testing"
+
+echo "Step-1: Installing & Creating Kind Cluster"
+# For AMD64 / x86_64
+[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-linux-amd64
+# For ARM64
+[ $(uname -m) = aarch64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.30.0/kind-linux-arm64
+chmod +x ./kind
+sudo mv ./kind /usr/local/bin/kind
+
+kind create cluster --config kind.yaml --name ${CLUSTER_NAME}
+kubectl wait --for=condition=Ready nodes --all --timeout=120s --context kind-${CLUSTER_NAME}
+
+echo "Step-2: Building Components-Image"
+docker build -t data-extraction:latest ../../.
+kind load docker-image data-extraction:latest --name ${CLUSTER_NAME}
+
+echo "Step-3: Deploying Patches, Hacks and mocks"
+kubectl create namespace traininghost
+kubectl create secret generic cassandra -n  traininghost\
+          --from-literal=cassandra-password='cassandra-pwd'
+
+
+echo "Step-4: Setup Helm & Deploy dataextraction component"
+PREV_WORK_DIR=$(pwd)
+cd /tmp/
+git clone https://github.com/o-ran-sc/aiml-fw-aimlfw-dep.git
+cd aiml-fw-aimlfw-dep
+./bin/install_common_templates_to_helm.sh
+
+helm dep up helm/data-extraction
+helm install data-extraction helm/data-extraction -f RECIPE_EXAMPLE/example_recipe_local_images_oran_latest.yaml --kube-context kind-${CLUSTER_NAME}
+
+cd $PREV_WORK_DIR
\ No newline at end of file
diff --git a/component-testing/local-testing/teardown_local_testing_env.sh b/component-testing/local-testing/teardown_local_testing_env.sh
new file mode 100644 (file)
index 0000000..b012128
--- /dev/null
@@ -0,0 +1,27 @@
+# ==================================================================================
+#
+#       Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
+echo -e "The following script will destroy the local testing environment which includes: \nDeleting kind Cluster, undeploying dataextraction component & mocks"
+
+CLUSTER_NAME="testing"
+
+echo "Step-1: Uninstall dataextraction component"
+helm uninstall data-extraction --kube-context kind-${CLUSTER_NAME}
+
+echo "Step-2: Delete kind cluster"
+kind delete cluster --name ${CLUSTER_NAME}
\ No newline at end of file