NONRTRIC - Selection of which components to include 42/6142/4
authorPatrikBuhr <patrik.buhr@est.tech>
Wed, 26 May 2021 07:26:09 +0000 (09:26 +0200)
committerPatrikBuhr <patrik.buhr@est.tech>
Thu, 27 May 2021 05:26:46 +0000 (07:26 +0200)
Making it possible to freely include or exclude each component.
Simplified the install and unistall scripts some.

Change-Id: I708f5adcdb410f768af3218994919c2079b79ab3
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-478

bin/deploy-nonrtric
bin/undeploy-nonrtric
nonrtric/RECIPE_EXAMPLE/example_recipe.yaml
nonrtric/bin/install [deleted file]
nonrtric/bin/uninstall [deleted file]
nonrtric/helm/nonrtric/Chart.yaml
nonrtric/helm/nonrtric/requirements.yaml [deleted file]
nonrtric/helm/nonrtric/values.yaml

index 887c04e..0643f4b 100755 (executable)
@@ -125,4 +125,29 @@ helm repo add local http://127.0.0.1:8879/charts --force-update
 echo "Finished Packaging NONRTRIC components [$COMPONENTS]"
 
 
-$ROOT_DIR/../nonrtric/bin/install -f $OVERRIDEYAML
+
+COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
+NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^  namespace:/{getline; while ($0 ~ /^    .*|^ *$/) {print $0; if (getline == 0) {break}}}')
+NONRTRIC_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *nonrtric:/{print $2}')
+RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
+
+if ! kubectl get ns ${NONRTRIC_NAMESPACE:-nonrtric}> /dev/null 2>&1; then
+    kubectl create ns ${NONRTRIC_NAMESPACE:-nonrtric}
+fi
+if ! kubectl get ns onap > /dev/null 2>&1; then
+    kubectl create ns onap
+fi
+
+kubectl create configmap -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe --from-file=recipe=$OVERRIDEYAML
+
+echo "Deploying NONRTRIC"
+
+HELM_NAME_OPT=""
+if [ -z $IS_HELM3 ];then
+   HELM_NAME_OPT="--name"
+fi
+
+echo "helm install -f $OVERRIDEYAML --namespace ${NONRTRIC_NAMESPACE:-nonrtric} ${HELM_NAME_OPT} ${RELEASE_PREFIX} $ROOT_DIR/../nonrtric/helm/nonrtric"
+helm install -f $OVERRIDEYAML --namespace "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT} "${RELEASE_PREFIX}" "$ROOT_DIR/../nonrtric/helm/nonrtric"
+
+
index 2a6c3fd..9e3c0cb 100755 (executable)
 
 # This script to undeploy the NONRTRIC
 
-ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-$ROOT_DIR/../nonrtric/bin/uninstall
+
+COMPONENTS="controlpanel a1controller a1simulator policymanagementservice enrichmentservice rappcatalogueservice nonrtricgateway"
+RECIPE_NAMESPACE=$(kubectl get cm --all-namespaces | grep nonrtric-recipe | awk '{print $1}')
+kubectl get configmap  -n $RECIPE_NAMESPACE nonrtric-recipe  -o jsonpath='{.data.recipe}' > /tmp/recipe.yaml
+
+if [ ! -s /tmp/recipe.yaml ]; then
+    echo "NONRTRIC recipe is not found. Are you sure it's deployed successfully?"
+    exit 0
+fi
+
+COMMON_BLOCK=$(cat /tmp/recipe.yaml | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
+NAMESPACE_BLOCK=$(cat /tmp/recipe.yaml | awk '/^  namespace:/{getline; while ($0 ~ /^    .*|^ *$/) {print $0; if (getline == 0) {break}}}')
+NONRTRIC_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *nonrtric:/{print $2}')
+RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
+
+echo "Undeploying NONRTRIC components [$COMPONENTS]"
+
+IS_HELM3=$(helm version -c --short|grep -e "^v3")
+HELM_FLAG=''
+if [ $IS_HELM3 ]
+then
+  HELM_FLAG=' -n '${NONRTRIC_NAMESPACE:-nonrtric}
+else
+  HELM_FLAG='--purge'
+fi
+
+helm delete ${HELM_FLAG} ${RELEASE_PREFIX}
+
+kubectl delete cm -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe
+
+kubectl delete ns ${NONRTRIC_NAMESPACE:-nonrtric}
index 07d0689..f9595d8 100644 (file)
 # Global common setting
 #-------------------------------------------------------------------------
 
+
+# Here you can enable inclusion or exclusion of each component. A not installd component will not be installed.
+nonrtric:
+  installPms: true
+  installA1controller: false
+  installA1simulator: false
+  installControlpanel: false
+  installEnrichmentservice: true
+  installRappcatalogueservice: false
+  installNonrtricgateway: false
+
 common:
   releasePrefix: r2-dev-nonrtric
 # Change the namespaces using the following options
   namespace:
     nonrtric: nonrtric
   ingressClassName: kong
-# any nonrtric chart can be installed: nonrtric (all components), controlpanel, a1controller, a1simulator, policymanagementservice, 
-# enrichmentservice, rappcatalogueservice, nonrtricgateway
-component: nonrtric
+
 
 # A1 Conttroller may take few more minutes to start. Increase the initialDelaySeconds in liveness to avoid container restart.
 a1controller:
diff --git a/nonrtric/bin/install b/nonrtric/bin/install
deleted file mode 100755 (executable)
index 8b14da0..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-################################################################################
-#   Copyright (c) 2020 Nordix Foundation.                                      #
-#                                                                              #
-#   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.                                             #
-################################################################################
-
-IS_HELM3=$(helm version -c --short|grep -e "^v3")
-while [ -n "$1" ]; do # while loop starts
-
-    case "$1" in
-
-    -f) OVERRIDEYAML=$2
-        shift
-        ;; 
-    *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
-
-    esac
-
-    shift
-
-done
-
-
-if [ -z "$OVERRIDEYAML" ];then
-    echo "****************************************************************************************************************"
-    echo "                                                     ERROR                                                      "
-    echo "****************************************************************************************************************"
-    echo "RIC deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option."
-    echo "****************************************************************************************************************"
-    exit 1
-fi
-
-
-DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
-
-COMMON_BLOCK=$(cat $OVERRIDEYAML | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
-NAMESPACE_BLOCK=$(cat $OVERRIDEYAML | awk '/^  namespace:/{getline; while ($0 ~ /^    .*|^ *$/) {print $0; if (getline == 0) {break}}}')
-NONRTRIC_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *nonrtric:/{print $2}')
-RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
-PARENT_CHART=$(cat $OVERRIDEYAML | awk '/^ *component:/{print $2}')
-echo "Chart name- $PARENT_CHART"
-
-if ! kubectl get ns ${NONRTRIC_NAMESPACE:-nonrtric}> /dev/null 2>&1; then
-    kubectl create ns ${NONRTRIC_NAMESPACE:-nonrtric}
-fi
-if ! kubectl get ns onap > /dev/null 2>&1; then
-    kubectl create ns onap
-fi
-
-kubectl create configmap -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe --from-file=recipe=$OVERRIDEYAML
-
-echo "Deploying NONRTRIC [$PARENT_CHART]"
-
-HELM_NAME_OPT=""
-if [ -z $IS_HELM3 ];then
-   HELM_NAME_OPT="--name"
-fi
-
-echo "helm install -f $OVERRIDEYAML --namespace ${NONRTRIC_NAMESPACE:-nonrtric} ${HELM_NAME_OPT} ${RELEASE_PREFIX} $DIR/../helm/${PARENT_CHART}"
-helm install -f $OVERRIDEYAML --namespace "${NONRTRIC_NAMESPACE:-nonrtric}" ${HELM_NAME_OPT} "${RELEASE_PREFIX}" $DIR/../helm/"${PARENT_CHART}"
-
diff --git a/nonrtric/bin/uninstall b/nonrtric/bin/uninstall
deleted file mode 100755 (executable)
index d0549f5..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-################################################################################
-#   Copyright (c) 2020 Nordix Foundation.                                      #
-#                                                                              #
-#   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.                                             #
-################################################################################
-
-
-COMPONENTS="controlpanel a1controller a1simulator policymanagementservice enrichmentservice rappcatalogueservice nonrtricgateway"
-RECIPE_NAMESPACE=$(kubectl get cm --all-namespaces | grep nonrtric-recipe | awk '{print $1}')
-kubectl get configmap  -n $RECIPE_NAMESPACE nonrtric-recipe  -o jsonpath='{.data.recipe}' > /tmp/recipe.yaml
-
-if [ ! -s /tmp/recipe.yaml ]; then
-    echo "NONRTRIC recipe is not found. Are you sure it's deployed successfully?"
-    exit 0
-fi
-
-COMMON_BLOCK=$(cat /tmp/recipe.yaml | awk '/^common:/{getline; while ($0 ~ /^ +.*|^ *$/) {print $0; if (getline == 0) {break}}}')
-NAMESPACE_BLOCK=$(cat /tmp/recipe.yaml | awk '/^  namespace:/{getline; while ($0 ~ /^    .*|^ *$/) {print $0; if (getline == 0) {break}}}')
-NONRTRIC_NAMESPACE=$(echo "$NAMESPACE_BLOCK" | awk '/^ *nonrtric:/{print $2}')
-RELEASE_PREFIX=$(echo "$COMMON_BLOCK" | awk '/^ *releasePrefix:/{print $2}')
-
-echo "Undeploying NONRTRIC components [$COMPONENTS]"
-
-IS_HELM3=$(helm version -c --short|grep -e "^v3")
-HELM_FLAG=''
-if [ $IS_HELM3 ]
-then
-  HELM_FLAG=' -n '${NONRTRIC_NAMESPACE:-nonrtric}
-else
-  HELM_FLAG='--purge'
-fi
-
-helm delete ${HELM_FLAG} ${RELEASE_PREFIX}
-
-kubectl delete cm -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe
-
-kubectl delete ns ${NONRTRIC_NAMESPACE:-nonrtric}
index 7b92e5c..9fb66d0 100644 (file)
@@ -18,3 +18,44 @@ apiVersion: v1
 description: NonRealTime RAN Intelligent Controller
 name: nonrtric
 version: 2.0.0
+
+dependencies:
+  - name: a1controller
+    version: ~2.0.0
+    repository: "@local"
+    condition: nonrtric.installA1controller
+
+  - name: a1simulator
+    version: ~2.0.0
+    repository: "@local"
+    condition: nonrtric.installA1simulator
+
+  - name: controlpanel
+    version: ~2.0.0
+    repository: "@local"
+    condition: nonrtric.installControlpanel
+
+  - name: policymanagementservice
+    version: ~2.0.0
+    repository: "@local"
+    condition: nonrtric.installPms
+
+  - name: enrichmentservice
+    version: ~1.0.0
+    repository: "@local"
+    condition: nonrtric.installEnrichmentservice
+
+  - name: nonrtric-common
+    version: ^2.0.0
+    repository: "@local"
+    condition: true
+
+  - name: rappcatalogueservice
+    version: ~1.0.0
+    repository: "@local"
+    condition: nonrtric.installRappcatalogueservice
+
+  - name: nonrtricgateway
+    version: ~1.0.0
+    repository: "@local"
+    condition: nonrtric.installA1controller
diff --git a/nonrtric/helm/nonrtric/requirements.yaml b/nonrtric/helm/nonrtric/requirements.yaml
deleted file mode 100644 (file)
index bc6a3b0..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-################################################################################
-#   Copyright (c) 2020 Nordix Foundation.                                      #
-#                                                                              #
-#   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.                                             #
-################################################################################
-
-dependencies:
-  - name: a1controller
-    version: ~2.0.0
-    repository: "@local"
-  - name: a1simulator
-    version: ~2.0.0
-    repository: "@local"
-  - name: controlpanel
-    version: ~2.0.0
-    repository: "@local"
-  - name: policymanagementservice
-    version: ~2.0.0
-    repository: "@local"
-  - name: enrichmentservice
-    version: ~1.0.0
-    repository: "@local"
-  - name: nonrtric-common
-    version: ^2.0.0
-    repository: "@local"
-  - name: rappcatalogueservice
-    version: ~1.0.0
-    repository: "@local"
-  - name: nonrtricgateway
-    version: ~1.0.0
-    repository: "@local"
\ No newline at end of file
index adf2fa5..b4728c5 100644 (file)
 ################################################################################
 
 
-    
+
+nonrtric:
+  installPms: true
+  installA1controller: true
+  installA1simulator: true
+  installControlpanel: true
+  installEnrichmentservice: true
+  installRappcatalogueservice: true
+  installNonrtricgateway: true