Policy types and type definitions are stored persistently to survive a restart of PMS.
Some fixes in the install script
Change-Id: Id636498baa7bdc7e86cc9ac5b76c4c565f17fc04
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Issue-ID: NONRTRIC-478
# This script deploys NonRtRic components automatically
+
+
if [ "$#" -eq 1 ]; then
OVERRIDEYAML=$1
else
-f) OVERRIDEYAML=$2
shift
- ;;
+ ;;
*) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
esac
ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+echo "** $ROOT_DIR"
+rm $ROOT_DIR/../nonrtric/helm/*/charts/*.tgz
+
+
#Check for helm3
IS_HELM3=$(helm version -c --short|grep -e "^v3")
fi
-$ROOT_DIR/prepare-common-templates
-
-COMPONENTS=${LIST_OF_COMPONENTS:-"controlpanel a1controller a1simulator policymanagementservice enrichmentservice rappcatalogueservice nonrtricgateway"}
-echo "Packaging NONRTRIC components [$COMPONENTS]"
# Package common templates and serve it using Helm local repo
HELM_LOCAL_REPO=""
if [ $IS_HELM3 ]
HELM_LOCAL_REPO="${HELM_HOME}/repository/local/"
fi
+
+rm $HELM_LOCAL_REPO/*
+
+helm repo remove local
+$ROOT_DIR/prepare-common-templates
+
+COMPONENTS="controlpanel a1controller a1simulator policymanagementservice enrichmentservice rappcatalogueservice nonrtricgateway"
for component in $COMPONENTS; do
+ echo "Packaging NONRTRIC component [$component]"
helm dep up $ROOT_DIR/../nonrtric/helm/$component
VERSION=$(cat $ROOT_DIR/../nonrtric/helm/$component/Chart.yaml | grep version | awk '{print $2}')
helm package -d /tmp $ROOT_DIR/../nonrtric/helm/$component
cp /tmp/$component-$VERSION.tgz ${HELM_LOCAL_REPO}
done
+helm dep up $ROOT_DIR/../nonrtric/helm/nonrtric
+
helm repo index ${HELM_LOCAL_REPO}
# Make sure that helm local repo is added
-helm repo remove local
-helm repo add local http://127.0.0.1:8879/charts
+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
# Change the namespaces using the following options
namespace:
nonrtric: nonrtric
-
+# 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.
readiness:
initialDelaySeconds: 20
periodSeconds: 10
+ persistence:
+ volumeReclaimPolicy: Retain
+ accessMode: ReadWriteOnce
+ size: 2Gi
+ mountPath: /dockerdata-nfs
+ mountSubPath: nonrtric/policymanagementservice
enrichmentservice:
enrichmentservice:
periodSeconds: 10
readiness:
initialDelaySeconds: 20
- periodSeconds: 10
\ No newline at end of file
+ periodSeconds: 10
-f) OVERRIDEYAML=$2
shift
- ;;
- -c) LIST_OF_COMPONENTS=$2
- shift
- ;;
+ ;;
*) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
esac
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}')
-COMPONENTS=${LIST_OF_COMPONENTS:-"controlpanel a1controller a1simulator policymanagementservice enrichmentservice nonrtric rappcatalogueservice nonrtricgateway"}
echo "Chart name- $PARENT_CHART"
if ! kubectl get ns ${NONRTRIC_NAMESPACE:-nonrtric}> /dev/null 2>&1; then
kubectl create configmap -n ${NONRTRIC_NAMESPACE:-nonrtric} nonrtric-recipe --from-file=recipe=$OVERRIDEYAML
-echo "Deploying NONRTRIC components [$COMPONENTS]"
-
-echo "Updating the Parent Chart [$PARENT_CHART]"
-helm dep up $DIR/../helm/$PARENT_CHART
+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}"
# The HTTP proxy (if configured) will only be used for accessing NearRT RIC:s
http.proxy-host:
http.proxy-port: 0
+ # path where the service can store data
+ vardata-directory: /var/policy-management-service
initialDelaySeconds: {{ .Values.policymanagementservice.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.policymanagementservice.liveness.periodSeconds }}
volumeMounts:
+ - name: {{ include "common.name.policymanagementservice" . }}-vardata
+ mountPath: "/var/policy-management-service/database"
- name: {{ include "common.name.policymanagementservice" . }}-policy-config
mountPath: /opt/app/policy-agent/config
- name: {{ include "common.name.policymanagementservice" . }}-policy-data
- mountPath: /opt/app/policy-agent/data
+ mountPath: /opt/app/policy-agent/data
volumes:
- name: {{ include "common.name.policymanagementservice" . }}-policy-config
configMap:
name: {{ include "common.name.policymanagementservice" . }}-configmap-config
- name: {{ include "common.name.policymanagementservice" . }}-policy-data
configMap:
- name: {{ include "common.name.policymanagementservice" . }}-configmap-data
\ No newline at end of file
+ name: {{ include "common.name.policymanagementservice" . }}-configmap-data
+ - name: {{ include "common.name.policymanagementservice" . }}-vardata
+ persistentVolumeClaim:
+ claimName: {{ include "common.name.policymanagementservice" . }}-vardata-pvc
--- /dev/null
+################################################################################
+# 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. #
+################################################################################
+
+
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+ name: {{ include "common.name.policymanagementservice" . }}
+ namespace: {{ include "common.namespace.nonrtric" . }}
+ labels:
+ app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.policymanagementservice" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+ name: {{ include "common.name.policymanagementservice" . }}
+spec:
+ capacity:
+ storage: {{ .Values.policymanagementservice.persistence.size}}
+ accessModes:
+ - {{ .Values.policymanagementservice.persistence.accessMode }}
+ persistentVolumeReclaimPolicy: {{ .Values.policymanagementservice.persistence.volumeReclaimPolicy }}
+ hostPath:
+ path: {{ .Values.policymanagementservice.persistence.mountPath }}/{{ .Values.policymanagementservice.persistence.mountSubPath }}
+ storageClassName: "{{ .Values.policymanagementservice.persistence.storageClass }}"
+
--- /dev/null
+################################################################################
+# Copyright (c) 2021 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. #
+################################################################################
+
+
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: {{ include "common.name.policymanagementservice" . }}-vardata-pvc
+ namespace: {{ include "common.namespace.nonrtric" . }}
+ labels:
+ app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.policymanagementservice" . }}
+ chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: "{{ .Values.policymanagementservice.persistence.size }}"
+ storageClassName: "{{ .Values.policymanagementservice.persistence.storageClass }}"
+
periodSeconds: 10
readiness:
initialDelaySeconds: 20
- periodSeconds: 10
\ No newline at end of file
+ periodSeconds: 10
+ persistence:
+ volumeReclaimPolicy: Retain
+ accessMode: ReadWriteOnce
+ size: 2Gi
+ mountPath: /dockerdata-nfs
+ mountSubPath: nonrtric/policymanagementservice
+ storageClass: "manual"
+ enabled: true
+ #existingClaim: