From: Zhe Huang Date: Wed, 26 Jun 2019 20:54:04 +0000 (+0000) Subject: Merge "Add external service endpoints" X-Git-Tag: 0.0.2~85 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=431ae3c7eab922223215b52f2a347029eb95335b;hp=7907349292a23a3cd138dd64d9d7966edbefbb88;p=it%2Fdep.git Merge "Add external service endpoints" --- diff --git a/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE new file mode 100644 index 00000000..cb494e4b --- /dev/null +++ b/RECIPE_EXAMPLE/RIC_AUX_RECIPE_EXAMPLE @@ -0,0 +1,59 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +############################################################################### + +#------------------------------------------------------------------------- +# Global common setting +#------------------------------------------------------------------------- +global: + # Docker registry from which RIC platform components pull the images + repository: nexus3.o-ran-sc.org:10004 + + # Name of the K8S docker credential that is onboarded by 20-credential + repositoryCred: docker-reg-cred + + # Docker image pull policy + imagePullPolicy: Always + + # Helm repo that will be used by xApp manager + helmRepository: nexus.ricinfra.local + + # Certificate of the helm repo + helmRepositoryCert: xapp-mgr-certs + + # Name of the K8S secret that contains the credential of the helm repo + helmRepositoryCred: xapp-mgr-creds + + # The name of the tiller that xApp helm client talks to + helmRepositoryTiller: tiller-deploy + + # The namespace of the xApp helm tiller + helmRepositoryTillerNamespace: kube-system + + # The port the xApp helm tiller is listening to + helmRepositoryTillerPort: 44134 + + + + +#------------------------------------------------------------------------- +# Auxiliary Functions +#------------------------------------------------------------------------- +dashboard: + image: + name:: ric-dash-be + tag: 1.0.0-SNAPSHOT + diff --git a/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE new file mode 100644 index 00000000..737526d3 --- /dev/null +++ b/RECIPE_EXAMPLE/RIC_INFRA_RECIPE_EXAMPLE @@ -0,0 +1,72 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +############################################################################### + +#------------------------------------------------------------------------- +# Global common setting +#------------------------------------------------------------------------- +global: + # Docker registry from which RIC platform components pull the images + repository: nexus3.o-ran-sc.org:10004 + + # Name of the K8S docker credential that is onboarded by 20-credential + repositoryCred: docker-reg-cred + + # Docker image pull policy + imagePullPolicy: Always + + # Helm repo that will be used by xApp manager + helmRepository: nexus.ricinfra.local + + # Certificate of the helm repo + helmRepositoryCert: xapp-mgr-certs + + # Name of the K8S secret that contains the credential of the helm repo + helmRepositoryCred: xapp-mgr-creds + + # The name of the tiller that xApp helm client talks to + helmRepositoryTiller: tiller-deploy + + # The namespace of the xApp helm tiller + helmRepositoryTillerNamespace: kube-system + + # The port the xApp helm tiller is listening to + helmRepositoryTillerPort: 44134 + +#------------------------------------------------------------------------- +# Infrastructure +#------------------------------------------------------------------------- + +cluster: + deployK8S: false + deployNexus: false + useLocalHelmRepo: false + useLocalDockerRegistry: false + + +repositoryCredential: + user: "docker" + password: "docker" + + +helmrepoCredential: + user: "helm" + password: "docker" + + +adminPassword: admin123 + +datapath: /tmp/nexus3-data/ diff --git a/RECIPE_EXAMPLE/RECIPE_EXAMPLE b/RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE similarity index 83% rename from RECIPE_EXAMPLE/RECIPE_EXAMPLE rename to RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE index e90af68f..7d704757 100644 --- a/RECIPE_EXAMPLE/RECIPE_EXAMPLE +++ b/RECIPE_EXAMPLE/RIC_PLATFORM_RECIPE_EXAMPLE @@ -29,7 +29,7 @@ global: imagePullPolicy: Always # Helm repo that will be used by xApp manager - helmRepository: nexus.ricinfra.local + helmRepository: helm.ricinfra.local # Certificate of the helm repo helmRepositoryCert: xapp-mgr-certs @@ -46,20 +46,6 @@ global: # The port the xApp helm tiller is listening to helmRepositoryTillerPort: 44134 -#------------------------------------------------------------------------- -# Infrastructure -#------------------------------------------------------------------------- - - - - -#------------------------------------------------------------------------- -# Auxiliary Functions -#------------------------------------------------------------------------- -dashboard: - image: - name:: ric-dash-be - tag: 1.0.0-SNAPSHOT #------------------------------------------------------------------------- # Platform Components @@ -67,15 +53,15 @@ dashboard: # xApp Manager appmgr: image: - name: xapp-manager - tag: latest + name: ric-plt-appmgr + tag: 0.1.3 # DBAAS dbaas: backend: image: - name: redis-standalone - tag: latest + name: ric-plt-dbaas + tag: 0.1.0 # E2 Manager e2mgr: diff --git a/bin/deploy-ric-infra b/bin/deploy-ric-infra new file mode 100755 index 00000000..508bcbdf --- /dev/null +++ b/bin/deploy-ric-infra @@ -0,0 +1,104 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +# This script deploys RIC auxiliary function components automatically + +OVERRIDEYAML=$1 + + + + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +source $DIR/../etc/ric-infra.conf + +export RICINFRA_RELEASE_NAME=$ric_infra_helm_release_name + +export RICINFRA_NAMESPACE=$ric_infra_namespace + +export DEPLOY_K8S=$deployK8S + +export DEPLOY_NEXUS=$deployNexus + +export USE_LOCAL_HELM_REPO=$useLocalHelmRepo + +export USE_LOCAL_DOCKER_REGISTRY=$useLocalDockerRegistry + + + + + +source $DIR/../etc/ric-platform.conf + +export RICPLT_RELEASE_NAME=$ric_platform_helm_release_name + +export RICPLT_NAMESPACE=$ric_platform_namespace + + + + +if [ -z "$OVERRIDEYAML" ];then + echo "****************************************************************************************************************" + echo " WARNING " + echo "****************************************************************************************************************" + echo "Deploying RIC infrastructure components without deployment recipe. Default configurations are used." + echo "****************************************************************************************************************" + +else + + export DEPLOY_K8S=$(cat $OVERRIDEYAML | grep deployK8S | awk '{print $2}') + export DEPLOY_NEXUS=$(cat $OVERRIDEYAML | grep deployNexus | awk '{print $2}') + export USE_LOCAL_HELM_REPO=$(cat $OVERRIDEYAML | grep useLocalHelmRepo | awk '{print $2}') + export USE_LOCAL_DOCKER_REGISTRY=$(cat $OVERRIDEYAML | grep useLocalDockerRegistry | awk '{print $2}') +fi + + + +if $USE_LOCAL_HELM_REPO && [ "$DEPLOY_NEXUS" != "true" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "Local helm repo cannot be used if Nexus is not installed. Please change your configurations in the deployment recipe." + echo "****************************************************************************************************************" + exit 1 +fi + + +if $USE_LOCAL_DOCKER_REGISTRY && [ "$DEPLOY_NEXUS" != "true" ];then + echo "****************************************************************************************************************" + echo " ERROR " + echo "****************************************************************************************************************" + echo "Local docker registry cannot be used if Nexus is not installed. Please change your configurations in the deployment recipe." + echo "****************************************************************************************************************" + exit 1 +fi + + +if $DEPLOY_K8S; then + echo "Deploying K8S. Please make sure that you configure files in ./ric-infra/00-Kubernetes/etc correctly." + . ../ric-infra/00-Kubernetes/bin/install +fi + + +if $DEPLOY_NEXUS; then + echo "Deploying Nexus." + . ../ric-infra/10-Nexus/bin/install $OVERRIDEYAML +fi + + + diff --git a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/_helpers.tpl b/etc/ric-infra.conf similarity index 55% rename from ric-platform/50-RIC-Platform/helm/e2mgr/templates/_helpers.tpl rename to etc/ric-infra.conf index 567cb589..a5ddb27a 100644 --- a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/_helpers.tpl +++ b/etc/ric-infra.conf @@ -15,35 +15,22 @@ # limitations under the License. # ################################################################################ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "e2mgr.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} +# ------------------- RIC AUX --------------------------------------- -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "e2mgr.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} +# release name helm will use to deploy RIC infrastructure componenets +ric_infra_helm_release_name=r0 -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "e2mgr.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} +# namespace that helm will use to deploy RIC infrastructure componenets +ric_infra_namespace=ricinfra + +# deploy the kubernete cluster +deployK8S=false + +# deploy a nexus repository manager +deployNexus=true + +# use the local helm repo +useLocalHelmRepo=true + +# use the local docker registry +useLocalDockerRegistry=false diff --git a/ric-infra/00-Kubernetes/heat/scripts/k8s_vm_install.sh b/ric-infra/00-Kubernetes/heat/scripts/k8s_vm_install.sh index 54dbc3ec..e3a949b0 100644 --- a/ric-infra/00-Kubernetes/heat/scripts/k8s_vm_install.sh +++ b/ric-infra/00-Kubernetes/heat/scripts/k8s_vm_install.sh @@ -264,9 +264,6 @@ EOF sleep 15 done - # install ingress controller db-less kong - helm install stable/kong --set ingressController.enabled=true --set postgresql.enabled=false --set env.database=off - echo "Starting an NC TCP server on port 29999 to indicate we are ready" nc -l -p 29999 & diff --git a/ric-infra/10-Nexus/bin/change_password b/ric-infra/10-Nexus/bin/change_password new file mode 100755 index 00000000..1a727d3f --- /dev/null +++ b/ric-infra/10-Nexus/bin/change_password @@ -0,0 +1,225 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +OVERRIDEYAML=$1 + + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +source $DIR/../etc/nexus.conf + +if [ -z "$RICINFRA_RELEASE_NAME" ];then + RELEASE_NAME=$helm_release_name +else + RELEASE_NAME=$RICINFRA_RELEASE_NAME +fi +if [ -z "$RICINFRA_NAMESPACE" ];then + NAMESPACE=$namespace +else + NAMESPACE=$RICINFRA_NAMESPACE +fi +if [ -z "$INGRESS_PORT" ];then + INGRESS_PORT_NEXUS=$ingress_port +else + INGRESS_PORT_NEXUS=$INGRESS_PORT +fi + +if [ -z "$DEFAULT_NEXUS_ADMIN_PASSWORD" ];then + NEXUS_ADMIN_PASSWORD=$default_admin_password +else + NEXUS_ADMIN_PASSWORD=$DEFAULT_NEXUS_ADMIN_PASSWORD +fi + + + +HOSTPOSTFIX=$(cat $DIR/../helm/values.yaml | grep hostpostfix | awk '{print $2}') + + + + + + + + + +NEXUS_URL="http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS" + + + + + + +if [ -z $OVERRIDEYAML ]; then + + DOCKERPASSWORD=$(cat $DIR/../../20-Credential/helm/values.yaml | awk '/^.*repositoryCredential:.*/{getline; getline; print substr($2, 2, length($2)-2);}') + HELMPASSWORD=$(cat $DIR/../../20-Credential/helm/values.yaml | awk '/^.*helmrepoCredential:.*/{getline; getline; print substr($2, 2, length($2)-2);}') + ADMINPASSWORD=$(cat $DIR/../helm/values.yaml | awk '/^.*adminPassword:.*/{print $2}') + +else + + + + DOCKERPASSWORD=$(cat $OVERRIDEYAML | awk '/^.*repositoryCredential:.*/{getline; getline; print substr($2, 2, length($2)-2);}') + + + + if [ -z $DOCKERPASSWORD ]; then + DOCKERPASSWORD=$(cat $DIR/../../20-Credential/helm/values.yaml | awk '/^.*repositoryCredential:.*/{getline; getline; print substr($2, 2, length($2)-2);}') + fi + + HELMPASSWORD=$(cat $OVERRIDEYAML | awk '/^.*helmrepoCredential:.*/{getline; getline; print substr($2, 2, length($2)-2);}') + + if [ -z $HELMPASSWORD ]; then + HELMPASSWORD=$(cat $DIR/../../20-Credential/helm/values.yaml | awk '/^.*helmrepoCredential:.*/{getline; getline; print substr($2, 2, length($2)-2);}') + fi + + ADMINPASSWORD=$(cat $OVERRIDEYAML | awk '/^.*adminPassword:.*/{print $2;}') + if [ -z $ADMINPASSWORD ]; then + ADMINPASSWORD=$(cat $DIR/../helm/values.yaml | awk '/^.*adminPassword:.*/{print $2;}') + fi + +fi + + + + +#echo $DOCKERPASSWORD, $HELMPASSWORD, $ADMINPASSWORD + + + + +DOCKERPORT=$(cat $DIR/../helm/templates/deployment.yaml | awk '/.*- name: docker.*/{getline; print $2}') + + +DOCKERREPOSCRIPT="{\"name\":\"docker_changepassword\",\ + \"type\":\"groovy\",\ + \"content\":\"security.securitySystem.changePassword('docker', '$DOCKERPASSWORD')\"}" + + + + +# This line uses the default admin password +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u admin:$NEXUS_ADMIN_PASSWORD -X POST -H "Content-Type: application/json" --data "$DOCKERREPOSCRIPT" http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script) + + +if [ "${STATUS}" != "204" ];then + echo "> script upload failed!" +fi + +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u admin:$NEXUS_ADMIN_PASSWORD -X POST -H 'Content-Type: text/plain' -H 'Accept: application/json' http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/docker_changepassword/run) + + +if [ "${STATUS}" == "200" ];then + echo "> docker password change succeeded!" +else + echo "> docker password change failed!" +fi + + +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE -u admin:$NEXUS_ADMIN_PASSWORD http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/docker_changepassword) + + +if [ "${STATUS}" != "204" ];then + echo "> script deletion failed!" +fi + + + + + + + + + + + + + +HELMREPOSCRIPT="{\"name\":\"helm_changepassword\",\ + \"type\":\"groovy\",\ + \"content\":\"security.securitySystem.changePassword('helm', '$HELMPASSWORD')\"}" + + + +# This line uses the default admin password +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u admin:$NEXUS_ADMIN_PASSWORD -X POST -H "Content-Type: application/json" --data "$HELMREPOSCRIPT" http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script) + + +if [ "${STATUS}" != "204" ];then + echo "> script upload failed!" +fi + +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u admin:$NEXUS_ADMIN_PASSWORD -X POST -H 'Content-Type: text/plain' -H 'Accept: application/json' http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/helm_changepassword/run) + + +if [ "${STATUS}" == "200" ];then + echo "> helm password change succeeded!" +else + echo "> helm password change failed!" +fi + + +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE -u admin:$NEXUS_ADMIN_PASSWORD http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/helm_changepassword) + + +if [ "${STATUS}" != "204" ];then + echo "> script deletion failed!" +fi + + + + + + + + + + + + + +ADMINSCRIPT="{\"name\":\"admin_changepassword\",\ + \"type\":\"groovy\",\ + \"content\":\"security.securitySystem.changePassword('admin', '$ADMINPASSWORD')\"}" + + + +# This line uses the default admin password +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u admin:$NEXUS_ADMIN_PASSWORD -X POST -H "Content-Type: application/json" --data "$ADMINSCRIPT" http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script) + + +if [ "${STATUS}" != "204" ];then + echo "> script upload failed!" +fi + +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -u admin:$NEXUS_ADMIN_PASSWORD -X POST -H 'Content-Type: text/plain' -H 'Accept: application/json' http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/admin_changepassword/run) + + +if [ "${STATUS}" == "200" ];then + echo "> admin password change succeeded!" +else + echo "> admin password change failed!" +fi + +NEXUS_ADMIN_PASSWORD=$ADMINPASSWORD +STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X DELETE -u admin:$NEXUS_ADMIN_PASSWORD http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/admin_changepassword) + + +if [ "${STATUS}" != "204" ];then + echo "> script deletion failed!" +fi + diff --git a/ric-infra/10-Nexus/bin/deploy_nexus_data b/ric-infra/10-Nexus/bin/deploy_nexus_data new file mode 100755 index 00000000..8c630f08 --- /dev/null +++ b/ric-infra/10-Nexus/bin/deploy_nexus_data @@ -0,0 +1,70 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +OVERRIDEYAML=$1 +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + + + + + + +if [ -z $OVERRIDEYAML ]; then + + DATAPATH=$(cat $DIR/../helm/values.yaml | awk '/^.*datapath:.*/{ print $2;}') + +else + + DATAPATH=$(cat $OVERRIDEYAML | awk '/^.*datapath:.*/{ print $2;}') + + + if [ -z $DATAPATH ]; then + DATAPATH=$(cat $DIR/../helm/values.yaml | awk '/^.*datapath:.*/{ print $2;}') + fi + +fi + +if [ -e $DATAPATH ]; then + if [ ! -w $DATAPATH ]; then + echo "Error: you don't have write permission to directory $DATAPATH" + echo "Deployment terminated." + exit 1 + fi + + rm -rf $DATAPATH + + mkdir -p $DATAPATH + + tar -xf $DIR/../etc/conf.tar -C $DATAPATH + + chmod -R a+rwx $DATAPATH +else + mkdir -p $DATAPATH + if [ $? -eq 0 ]; then + tar -xf $DIR/../etc/conf.tar -C $DATAPATH + chmod -R a+rwx $DATAPATH + else + echo "Error: you don't have write permission to directory $DATAPATH" + echo "Deployment terminated." + exit 1 + fi + + +fi + + diff --git a/ric-infra/10-Nexus/bin/install b/ric-infra/10-Nexus/bin/install index c0c5ed04..452924b9 100755 --- a/ric-infra/10-Nexus/bin/install +++ b/ric-infra/10-Nexus/bin/install @@ -57,6 +57,18 @@ echo "You can access this nexus here: http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NE echo "If nexus.$HOSTPOSTFIX is not resolved by your DNS server, please add an entry in your /etc/hosts file." echo "****************************************************************************************************************" +. ./deploy_nexus_data $OVERRIDEYAML + + + +NODENAME=$(kubectl get node | awk 'NR==2{print $1}') +kubectl label --overwrite nodes $NODENAME nexus-node=enable + + + + + + COMMON_CHART_VERSION=$(cat $DIR/../../../ric-platform/50-RIC-Platform/helm/common/Chart.yaml | grep version | awk '{print $2}') helm package -d /tmp $DIR/../../../ric-platform/50-RIC-Platform/helm/common @@ -70,9 +82,10 @@ else helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-nexus" $DIR/../helm fi -NEXUS_POD_NAME=$(kubectl get pod -n $NAMESPACE | grep nexus | grep ContainerCreating | awk '{print $1}') +NEXUS_POD_NAME=$(kubectl get pod -n $NAMESPACE | grep nexus | grep -v "Terminating" | awk '{print $1}') + echo "Waiting Nexus to be ready." echo " " @@ -102,23 +115,7 @@ done echo $IS_NEXUS_READY -DOCKERPORT=$(cat $DIR/../helm/templates/deployment.yaml | awk '/.*- name: docker.*/{getline; print $2}') - - -DOCKERREPOSCRIPT="{\"name\":\"create_docker_repo\",\ - \"type\":\"groovy\",\ - \"content\":\"repository.createDockerHosted('docker.snapshot',\ - $DOCKERPORT, null, 'default', false, true)\"}" - -echo $DOCKERREPOSCRIPT - -# This line uses the default admin password -curl -u admin:admin123 -X POST -H "Content-Type: application/json" --data "$DOCKERREPOSCRIPT" http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script - -curl -u admin:admin123 -X POST -H 'Content-Type: text/plain' -H 'Accept: application/json' http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/create_docker_repo/run - - - +. ./change_password $OVERRIDEYAML diff --git a/ric-infra/10-Nexus/etc/nexus.conf b/ric-infra/10-Nexus/etc/nexus.conf index cd40a738..ce00f724 100644 --- a/ric-infra/10-Nexus/etc/nexus.conf +++ b/ric-infra/10-Nexus/etc/nexus.conf @@ -28,3 +28,6 @@ namespace=ric-infra # ingress port number of the K8S cluster # It will be overrided by INGRESS_PORT ingress_port=30000 + + +default_admin_password=admin123 diff --git a/ric-infra/10-Nexus/helm/templates/deployment.yaml b/ric-infra/10-Nexus/helm/templates/deployment.yaml index 65c5c235..2ba358c2 100644 --- a/ric-infra/10-Nexus/helm/templates/deployment.yaml +++ b/ric-infra/10-Nexus/helm/templates/deployment.yaml @@ -51,6 +51,15 @@ spec: - name: docker containerPort: 10001 protocol: TCP + volumeMounts: + - name: nexus-config + mountPath: /nexus-data + volumes: + - name: nexus-config + persistentVolumeClaim: + claimName: nexus-claim + + # livenessProbe: # httpGet: # path: / diff --git a/ric-infra/10-Nexus/helm/templates/helmingress.yaml b/ric-infra/10-Nexus/helm/templates/helmingress.yaml new file mode 100644 index 00000000..291a1030 --- /dev/null +++ b/ric-infra/10-Nexus/helm/templates/helmingress.yaml @@ -0,0 +1,40 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /repository/helm.local/ + name: {{ include "nexus.fullname" . }}-helm + labels: + app: {{ template "nexus.name" . }} + chart: {{ template "nexus.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + tls: + - hosts: + - helm.{{ .Values.ingress.hostpostfix }} + secretName: {{ include "common.helmrepositorycert" . }} + rules: + - host: helm.{{ .Values.ingress.hostpostfix }} + http: + paths: + - backend: + serviceName: {{ include "nexus.fullname" . }} + servicePort: nexus + path: / diff --git a/ric-infra/10-Nexus/helm/templates/ingress.yaml b/ric-infra/10-Nexus/helm/templates/ingress.yaml index 36090229..d1bbf2af 100644 --- a/ric-infra/10-Nexus/helm/templates/ingress.yaml +++ b/ric-infra/10-Nexus/helm/templates/ingress.yaml @@ -25,9 +25,9 @@ metadata: heritage: {{ .Release.Service }} spec: tls: - - hosts: - - docker.{{ .Values.ingress.hostpostfix }} - secretName: {{ include "common.repositorycert" . }} + - hosts: + - docker.{{ .Values.ingress.hostpostfix }} + secretName: {{ include "common.repositorycert" . }} rules: - host: nexus.{{ .Values.ingress.hostpostfix }} http: diff --git a/ric-infra/10-Nexus/helm/templates/persistentVolume.yaml b/ric-infra/10-Nexus/helm/templates/persistentVolume.yaml new file mode 100644 index 00000000..dfdbd21c --- /dev/null +++ b/ric-infra/10-Nexus/helm/templates/persistentVolume.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: nexus3-configuration +spec: + capacity: + storage: {{ .Values.storagesize }} + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: nexus3-storage + local: + path: {{ .Values.datapath }} + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: nexus-node + operator: In + values: + - enable diff --git a/ric-infra/10-Nexus/helm/templates/persistentVolumeClaim.yaml b/ric-infra/10-Nexus/helm/templates/persistentVolumeClaim.yaml new file mode 100644 index 00000000..b0f29ba4 --- /dev/null +++ b/ric-infra/10-Nexus/helm/templates/persistentVolumeClaim.yaml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: nexus-claim +spec: + accessModes: + - ReadWriteOnce + storageClassName: nexus3-storage + resources: + requests: + storage: {{ .Values.storagesize }} diff --git a/ric-infra/10-Nexus/helm/templates/save-secret-job.yaml b/ric-infra/10-Nexus/helm/templates/save-secret-job.yaml index 44b75ef1..1d0e1be2 100644 --- a/ric-infra/10-Nexus/helm/templates/save-secret-job.yaml +++ b/ric-infra/10-Nexus/helm/templates/save-secret-job.yaml @@ -25,18 +25,24 @@ spec: containers: - name: cert-copy image: alpine - command: ["cp", "-rL", "/var/run/certs/..data/tls.crt", "/var/run/certs-copy/"] + command: [ "/bin/sh","-c","cp -rL /var/run/dockercerts/..data/tls.crt /var/run/certs-copy/dockertls.crt && cp -rL /var/run/helmcerts/..data/tls.crt /var/run/certs-copy/helmtls.crt"] # command: ["tail", "-f", "/dev/null"] volumeMounts: - - name: certs - mountPath: /var/run/certs + - name: dockercerts + mountPath: /var/run/dockercerts + readOnly: true + - name: helmcerts + mountPath: /var/run/helmcerts readOnly: true - name: write-to-volume mountPath: /var/run/certs-copy volumes: - - name: certs + - name: dockercerts secret: secretName: {{ include "common.repositorycert" . }} + - name: helmcerts + secret: + secretName: {{ include "common.helmrepositorycert" . }} - name: write-to-volume hostPath: path: /tmp diff --git a/ric-infra/10-Nexus/helm/templates/secret-helm.yaml b/ric-infra/10-Nexus/helm/templates/secret-helm.yaml new file mode 100644 index 00000000..49e47da6 --- /dev/null +++ b/ric-infra/10-Nexus/helm/templates/secret-helm.yaml @@ -0,0 +1,32 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +apiVersion: v1 +kind: Secret +type: kubernetes.io/tls +metadata: + name: {{ include "common.helmrepositorycert" . }} + labels: + app: {{ template "nexus.name" . }} + chart: {{ template "nexus.chart" . }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: +{{ ( include "common.helmrepository.gen-certs" . ) | indent 2 }} diff --git a/ric-infra/10-Nexus/helm/templates/storageClass.yaml b/ric-infra/10-Nexus/helm/templates/storageClass.yaml new file mode 100644 index 00000000..97ccd0f9 --- /dev/null +++ b/ric-infra/10-Nexus/helm/templates/storageClass.yaml @@ -0,0 +1,6 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: nexus3-storage +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer diff --git a/ric-infra/10-Nexus/helm/values.yaml b/ric-infra/10-Nexus/helm/values.yaml index b35bd0ca..31f8a72c 100644 --- a/ric-infra/10-Nexus/helm/values.yaml +++ b/ric-infra/10-Nexus/helm/values.yaml @@ -26,6 +26,15 @@ replicaCount: 1 # repositoryCertOverride: "" repositoryCert: docker-reg-certs +# This is the name of K8S secret that contains the helm repository cert +# You can override this by using +# helmRepositoryCertOverride: "" +helmRepositoryCert: xapp-mgr-certs + + +# This is the admin password +adminPassword: admin123 + # This is designed to be deployed using local image image: repository: nexus-repository-helm-apt @@ -39,3 +48,6 @@ service: ingress: hostpostfix: ricinfra.local + +storagesize: 20Gi +datapath: /tmp/nexus3-data/ diff --git a/ric-infra/20-Credential/bin/install b/ric-infra/20-Credential/bin/install index a2619900..eb7bf21a 100755 --- a/ric-infra/20-Credential/bin/install +++ b/ric-infra/20-Credential/bin/install @@ -45,8 +45,8 @@ cp /tmp/common-$COMMON_CHART_VERSION.tgz $DIR/../helm/charts/ if [ -z $OVERRIDEYAML ]; then - helm install --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-credential" $DIR/../helm + helm install --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-${NAMESPACE}-credential" $DIR/../helm else - helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-credential" $DIR/../helm + helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-${NAMESPACE}-credential" $DIR/../helm fi diff --git a/ric-infra/20-Credential/bin/uninstall b/ric-infra/20-Credential/bin/uninstall index f93004a6..c820c7f7 100755 --- a/ric-infra/20-Credential/bin/uninstall +++ b/ric-infra/20-Credential/bin/uninstall @@ -36,5 +36,5 @@ else NAMESPACE=$RICPLT_NAMESPACE fi - helm delete --purge "${RELEASE_NAME}-credential" +helm delete --purge "${RELEASE_NAME}-${NAMESPACE}-credential" diff --git a/ric-infra/20-Credential/helm/resources/tls.crt b/ric-infra/20-Credential/helm/resources/tls.crt index 3060f345..984701e9 100644 --- a/ric-infra/20-Credential/helm/resources/tls.crt +++ b/ric-infra/20-Credential/helm/resources/tls.crt @@ -1,19 +1,19 @@ -----BEGIN CERTIFICATE----- -MIIDCTCCAfGgAwIBAgIBATANBgkqhkiG9w0BAQsFADAdMRswGQYDVQQDExJkb2Nr -ZXItcmVnaXN0cnktY2EwHhcNMTkwNTE1MTQ1NzQzWhcNMjAwNTE0MTQ1NzQzWjAQ -MQ4wDAYDVQQDEwVuZXh1czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AKNNbC8/cil64YXmPYpN7mRaT5biVsZrOrFkXfX2AXcJAsLUL7E4t7keK4Ba/VwO -pJKmgdjI4NxlTxe+zoOJVVz3+sMYz77UZTd1h/KDn1eBfozbqHcQ5lQksNDsL46d -yG/JfYpEEzRha/QxEEdaaQLWMyOcf/SjWnscqMQ2cGvTaEiO8F1re2qrwfnrbqQm -JYkIrmBbcGKMdg33edZpl3xbFc9eMfJGWuhaoC+Tk7Hj1EtV/O9KdPrvDYzO+h7P -HVExKXU04h1f9ThAoeU9/o7EN266iuUiCVE6M0zekYSV4BuAkXqbUtmpbnYziAYo -Cq2puiNUSirqXc6Bno12QykCAwEAAaNhMF8wDgYDVR0PAQH/BAQDAgWgMB0GA1Ud -JQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMCAGA1UdEQQZ -MBeCFWRvY2tlci5yaWNpbmZyYS5sb2NhbDANBgkqhkiG9w0BAQsFAAOCAQEAg5aE -yicj1VnG4G3JeCszj2hFFmg2eTnwkPsIlpeIMJY8zI/IZ2aQP5e0KPAM8IaKMnqq -RPPusL2DF7Dl4A+ZBTkvfKtxIzwc7wnQGCfonMyM/MxyoBxXIJw+Qek42CpVbYYt -qVZ3fz6VpCvF/QL6eGmVpMlvLIu15C9pxzEHPcUKpkM1mvKLRcxn2tt5daqjh9ao -EvZHJt8kOh53c/FZHgA2+73I8Gx6BLUZPO0E+E1vC5K1FwtCl+Cmt6nX5jZEw1LK -eNcb3oZhXrVnUoQ72HTJEWuPjydB7w1hxnzB5RYGZalM7XwDmOHwdGHlNxpmMbJa -UZ4yL0N+nAUbLeUS2w== +MIIDFzCCAf+gAwIBAgIRAPqRsyJWFaoXjwzmI+uQ5GkwDQYJKoZIhvcNAQELBQAw +HTEbMBkGA1UEAxMSaGVsbS1yZXBvc2l0b3J5LWNhMB4XDTE5MDYyMjAzMDYxNVoX +DTIwMDYyMTAzMDYxNVowEDEOMAwGA1UEAxMFbmV4dXMwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDBExs2W0HvXyinLL/LOkgM4Dobe1OVVntQzCGB8tqD +xI4ZcXGh8G4b3GMLVe8vs0c0IUUbPhy23AkDxGUT7whLbo1UwGa41htxY51zok4S +20NN706XVs6E0tKqA1L5kzyxLEAKgHE/EefWIf6MHtRt5GfwFVdjdfZP+9L/ZpUL +u1HKmiWw7fv0m/MrcAQA7lILpB4xeaM8rYWtBj8TGeoMlWLOtOcFKGpY9Kuty1n7 +cebHcz++qY+Vsrf8RlG4lGlit2IY06FE+5ihK24Zt9Ttwf3lsTf6xDwAEGmDxOAp +R61gY9wX8ClLO+ns+nkkEiJ90104a4U+qg115tZCGfBBAgMBAAGjXzBdMA4GA1Ud +DwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0T +AQH/BAIwADAeBgNVHREEFzAVghNoZWxtLnJpY2luZnJhLmxvY2FsMA0GCSqGSIb3 +DQEBCwUAA4IBAQA2Mt29tQ/3ACBpmZSKLPj3jTpPulXQKgtH9of9X0XBQ0ZdfqTN +Evyu+K5gY/FF6RhnkaCML4XoOnvJHQQBydwMrK9f6mcC26U8PWZn9+usihw5GJHp +Hu3pc0PDHb87ha+qCeie9ssKitz8pbJarTh6z1Ht8OT9/nktXkgPnIYI9ycAsdwy +uBww45UxDu8OD8TT0/08RzH56ruPpRSYDNRbkcT8FZV8C6KgEKG55e/xNAITQwaD +LD4xYkAZqK7lcPzuIM1kZUQAOJyw72TicMl94r0mL7pZ2NOJUCkkVvkYXo97TUKB +zomEUpolyZnVpdl4HG3v3Lwd2K3bCs2X+HTc -----END CERTIFICATE----- diff --git a/ric-infra/20-Credential/helm/templates/_helper.tpl b/ric-infra/20-Credential/helm/templates/_helper.tpl index 67274f0d..83d49679 100644 --- a/ric-infra/20-Credential/helm/templates/_helper.tpl +++ b/ric-infra/20-Credential/helm/templates/_helper.tpl @@ -59,7 +59,7 @@ Create chart name and version as used by the chart label. */}} {{- define "repository.secret" -}} {{- $repo := include "common.repository" . }} - {{- $cred := .Values.repositoryCred }} + {{- $cred := .Values.repositoryCredential }} {{- $user := default "docker" $cred.user }} {{- $password := default "docker" $cred.password }} {{- $mail := default "@" $cred.mail }} @@ -70,12 +70,12 @@ Create chart name and version as used by the chart label. {{- define "helmrepo.secret.user" -}} - {{- $user := default "helm" .Values.helmrepoCred.user -}} + {{- $user := default "helm" .Values.helmrepoCredential.user -}} {{- printf "%s" $user |b64enc }} {{- end -}} {{- define "helmrepo.secret.password" -}} - {{- $pass := default "helm" .Values.helmrepoCred.password -}} + {{- $pass := default "helm" .Values.helmrepoCredential.password -}} {{- printf "%s" $pass |b64enc }} {{- end -}} diff --git a/ric-infra/20-Credential/helm/values.yaml b/ric-infra/20-Credential/helm/values.yaml index 8f37004a..ad22a1ab 100644 --- a/ric-infra/20-Credential/helm/values.yaml +++ b/ric-infra/20-Credential/helm/values.yaml @@ -18,12 +18,13 @@ # Values for setting up Kubernetes resources for accessing infrastructure such as docker registry # helm repo, etc. +repository: "nexus3.o-ran-sc.org:10004" -repositoryCred: +repositoryCredential: user: "docker" password: "docker" -helmrepoCred: +helmrepoCredential: user: "helm" password: "helm" diff --git a/ric-platform/50-RIC-Platform/bin/install b/ric-platform/50-RIC-Platform/bin/install index 53023f3c..75590bee 100755 --- a/ric-platform/50-RIC-Platform/bin/install +++ b/ric-platform/50-RIC-Platform/bin/install @@ -37,7 +37,8 @@ else fi -RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term" +RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator kong-platform kong-xapp" +#RICPLT_COMPONENTS="kong-platform kong-xapp" echo "Deploying RIC Platform components [$RICPLT_COMPONENTS]" echo "Platform Namespace: $NAMESPACE" @@ -51,6 +52,21 @@ helm package -d /tmp $DIR/../helm/common for component in $RICPLT_COMPONENTS; do echo "Preparing chart for comonent $component" + + if [ $component = "kong-platform" ]; then + helm dep up $DIR/../helm/$component + helm install --namespace ricplt --name "${RELEASE_NAME}-$component" $DIR/../helm/$component --set postgresql.enabled=false --set env.database=off + continue + fi + + if [ $component = "kong-xapp" ]; then + helm dep up $DIR/../helm/$component + helm install --namespace ricxapp --name "${RELEASE_NAME}-$component" $DIR/../helm/$component --set postgresql.enabled=false --set env.database=off + continue + fi + + echo "not kong component" + mkdir -p $DIR/../helm/$component/charts/ cp /tmp/common-$COMMON_CHART_VERSION.tgz $DIR/../helm/$component/charts/ if [ -z $OVERRIDEYAML ]; then diff --git a/ric-platform/50-RIC-Platform/bin/uninstall b/ric-platform/50-RIC-Platform/bin/uninstall index b5937b1d..a5ccd8cd 100755 --- a/ric-platform/50-RIC-Platform/bin/uninstall +++ b/ric-platform/50-RIC-Platform/bin/uninstall @@ -36,7 +36,7 @@ else fi -RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term" +RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator kong-platform kong-xapp" echo "Undeploying RIC Platform components [$RICPLT_COMPONENTS]" echo "Platform Namespace: $NAMESPACE" diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore b/ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore new file mode 100644 index 00000000..d8651e0c --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore @@ -0,0 +1 @@ +NOTES.txt diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore b/ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml new file mode 100644 index 00000000..be6cc65f --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A1 Helm chart for Kubernetes +name: a1mediator +version: 1.0.0 diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json b/ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json new file mode 100644 index 00000000..0fb5f09b --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json @@ -0,0 +1,67 @@ +{ + "controls":[ + { + "name":"admission_control_policy", + "description":"various parameters to control admission of dual connection", + "message_receives_rmr_type":"DC_ADMISSION_INTERVAL_CONTROL", + "message_receives_payload_schema":{ + "$schema":"http://json-schema.org/draft-07/schema#", + "type":"object", + "properties":{ + "enforce":{ + "type":"boolean", + "default":true + }, + "window_length":{ + "type":"integer", + "default":1, + "minimum":1, + "maximum":60, + "description":"Sliding window length (in minutes)" + }, + "blocking_rate":{ + "type":"number", + "default":10, + "minimum":1, + "maximum":100, + "description":"% Connections to block" + }, + "trigger_threshold":{ + "type":"integer", + "default":10, + "minimum":1, + "description":"Minimum number of events in window to trigger blocking" + } + }, + "required":[ + "enforce", + "blocking_rate", + "trigger_threshold", + "window_length" + ], + "additionalProperties":false + }, + "message_sends_rmr_type":"DC_ADMISSION_INTERVAL_CONTROL_ACK", + "message_sends_payload_schema":{ + "$schema":"http://json-schema.org/draft-07/schema#", + "type":"object", + "properties":{ + "status":{ + "type":"string", + "enum":[ + "SUCCESS", + "FAIL" + ] + }, + "message":{ + "type":"string" + } + }, + "required":[ + "status" + ], + "additionalProperties":false + } + } + ] +} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt b/ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt new file mode 100644 index 00000000..f2804adb --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt @@ -0,0 +1,2 @@ +DC_ADMISSION_INTERVAL_CONTROL:20000 +DC_ADMISSION_INTERVAL_CONTROL_ACK:20001 diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl new file mode 100644 index 00000000..fa46babd --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl @@ -0,0 +1,45 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "a1mediator.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "a1mediator.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "a1mediator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "a1mediator.labels" -}} +app.kubernetes.io/name: {{ include "a1mediator.name" . }} +helm.sh/chart: {{ include "a1mediator.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml new file mode 100644 index 00000000..afac492b --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: a1conf +data: + local.rt: | + newrt|start + rte|20000|ADM_CONTROL_GOES_HERE:4563 + rte|20001|{{ .Values.rmrservice.name }}:{{ .Values.rmrservice.port }} + newrt|end + rmr_string_int_mapping.txt: {{ tpl (.Files.Get "files/rmr_string_int_mapping.txt") . | quote }} + ricmanifest.json: {{ tpl (.Files.Get "files/ricmanifest.json") . | quote }} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml new file mode 100644 index 00000000..7669af84 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "a1mediator.fullname" . }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + imagePullSecrets: + - name: {{ include "common.repositoryCred" . }} + containers: + - name: {{ include "common.namespace" . }}-{{ include "common.name" . }} + volumeMounts: + - name: a1conf + mountPath: /opt/ricmanifest.json + subPath: ricmanifest.json + - name: a1conf + mountPath: /opt/rmr_string_int_mapping.txt + subPath: rmr_string_int_mapping.txt + - name: a1conf + mountPath: /opt/route/local.rt + subPath: local.rt + env: + - name: PYTHONUNBUFFERED + value: "0" + - name: RMR_RCV_RETRY_INTERVAL + value: "{{ .Values.rmr_timeout_config.rcv_retry_interval_ms }}" + - name: RMR_RETRY_TIMES + value: "{{ .Values.rmr_timeout_config.rcv_retry_times }}" + image: {{ include "common.repository" . }}/{{ .Values.a1mediator.image.name }}:{{ .Values.a1mediator.image.tag }} + imagePullPolicy: {{ include "common.pullPolicy" . }} + ports: + - name: http + containerPort: {{ .Values.httpservice.port }} + protocol: TCP + + livenessProbe: + httpGet: + path: /ui + port: http + readinessProbe: + httpGet: + path: /ui + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: "a1conf" + configMap: + name: "a1conf" diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml new file mode 100644 index 00000000..8147541a --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml @@ -0,0 +1,12 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress-a1mediator +spec: + rules: + - http: + paths: + - path: /a1mediator + backend: + serviceName: {{ include "a1mediator.fullname" . }} + servicePort: {{ .Values.httpservice.port }} \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml new file mode 100644 index 00000000..9f61e861 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml @@ -0,0 +1,62 @@ +# This is the service for A1's external facing HTTP API +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename.a1mediator" . }} + labels: + app.kubernetes.io/name: {{ include "common.fullname.a1mediator" . }} + helm.sh/chart: {{ include "common.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Chart.AppVersion }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + {{- end }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + +spec: + type: {{ .Values.httpservice.type }} + ports: + - port: {{ .Values.httpservice.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + +--- +# This is the service for rmr between A1 and the xapps +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.rmrservice.name }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} + +spec: + type: {{ .Values.rmrservice.type }} + ports: + - port: {{ .Values.rmrservice.port }} + targetPort: {{ .Values.rmrservice.port }} + protocol: TCP + selector: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + +--- +# This is the service for the "hidden" port 4561 that rmr listens on for route manager +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.rmrrtemgrservice.name }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} + +spec: + type: {{ .Values.rmrrtemgrservice.type }} + ports: + - port: {{ .Values.rmrrtemgrservice.port }} + targetPort: {{ .Values.rmrrtemgrservice.port }} + protocol: TCP + selector: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml new file mode 100644 index 00000000..ca683685 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "a1mediator.fullname" . }}-test-connection" + labels: +{{ include "a1mediator.labels" . | indent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "a1mediator.fullname" . }}:{{ .Values.httpservice.port }}'] + restartPolicy: Never diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml new file mode 100644 index 00000000..d6aed57a --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml @@ -0,0 +1,32 @@ +a1mediator: + replicaCount: 1 + + image: + repository: nexus3.o-ran-sc.org:10004 + name: ric-plt-a1 + tag: 0.8.2 + pullPolicy: IfNotPresent + + +# This is the service for A1's external facing HTTP API +httpservice: + port: 10000 # This is hardcoded in a1, probably dangerous to change + type: ClusterIP + +# This is the service for rmr between A1 and the xapps +rmrservice: + name: rmrservice + port: 4562 # This is hardcoded in a1, probably dangerous to change + type: ClusterIP + +# This is the service for the "hidden" port 4561 that rmr listens on for route manager +rmrrtemgrservice: + name: rmrrtemgrservice + port: 4561 # This is hardcoded in rmr, probably dangerous to change + type: ClusterIP + +# these are ENV variables that A1 takes; see docs +rmr_timeout_config: + rcv_retry_interval_ms: 500 + rcv_retry_times: 20 + diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/resources/appenv.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/resources/appenv.yaml new file mode 100644 index 00000000..733bf073 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/appmgr/resources/appenv.yaml @@ -0,0 +1,5 @@ +NAME: xappmgr +DBAAS_SERVICE_HOST: __DBAAS_SERVICE_HOST__ +DBAAS_SERVICE_PORT: "6379" +DBAAS_PORT_6379_TCP_ADDR: __DBAAS_SERVICE_HOST__ +DBAAS_PORT_6379_TCP_PORT: "6379" diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/resources/appmgr.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/resources/appmgr.yaml new file mode 100644 index 00000000..c7c80863 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/appmgr/resources/appmgr.yaml @@ -0,0 +1,25 @@ +"local": + # Port on which the xapp-manager REST services are provided + "host": __REST_PORT__ +"helm": + # Remote helm repo URL. UPDATE this as required. + "repo": __HELM_REPO__ + + # Repo name referred within the xapp-manager + "repo-name": __REPO_NAME__ + + # Tiller service details in the cluster. UPDATE this as required. + "tiller-service": __TILLER_SERVICE__ + "tiller-namespace": __TILLER_NAMESPACE__ + "tiller-port": __TILLER_PORT__ + # helm username and password files + "helm-username-file": "/opt/ric/secret/helm_repo_username" + "helm-password-file": "/opt/ric/secret/helm_repo_password" + "retry": 1 +"xapp": + #Namespace to install xAPPs + "namespace": "ricxapp" + "tarDir": "/tmp" + "schema": "descriptors/schema.json" + "config": "config/config-file.json" + "tmpConfig": "/tmp/config-file.json" diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/resources/xapp-manager.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/resources/xapp-manager.yaml deleted file mode 100644 index 179bb756..00000000 --- a/ric-platform/50-RIC-Platform/helm/appmgr/resources/xapp-manager.yaml +++ /dev/null @@ -1,14 +0,0 @@ -"local": - # Port on which the xapp-manager REST services are provided - "host": __REST_PORT__ -"helm": - # Remote helm repo URL. UPDATE this as required. - "repo": __HELM_REPO__ - - # Repo name referred within the xapp-manager - "repo-name": __REPO_NAME__ - - # Tiller service details in the cluster. UPDATE this as required. - "tiller-service": __TILLER_SERVICE__ - "tiller-namespace": __TILLER_SERVICE__ - "tiller-port": __TILLER_PORT__ diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/templates/appconfig.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/templates/appconfig.yaml index 0ed87d49..7c6efb89 100644 --- a/ric-platform/50-RIC-Platform/helm/appmgr/templates/appconfig.yaml +++ b/ric-platform/50-RIC-Platform/helm/appmgr/templates/appconfig.yaml @@ -18,12 +18,12 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "appmgr.fullname" . }}-appconfig + name: {{ include "common.configmapname.appmgr" . }}-appconfig data: - {{- $restport := default ":8080" (printf ":%.0f" .Values.appmgr.containerPort) | quote -}} - {{- $helmrepo := include "common.helmrepository" . | quote -}} - {{- $reponame := default "helm-repo" .Values.appmgr.reponame | quote -}} - {{- $tiller := include "common.helmrepositorytiller" . | quote -}} - {{- $tillernamespace := include "common.helmrepositorytillernamespace" . | quote -}} - {{- $tillerport := include "common.helmrepositorytillerport" . | quote -}} - {{- (.Files.Glob "resources/xapp-manager.yaml").AsConfig | replace "__HELM_REPO__" $helmrepo | replace "__REST_PORT__" $restport | replace "__REPO_NAME__" $reponame | replace "__TILLER_SERVICE__" $tiller | replace "__TILLER_NAMESPACE__" $tillernamespace | replace "__TILLER_PORT__" $tillerport | nindent 2 }} + {{- $restport := default ":8080" (printf ":%.0f" .Values.appmgr.containerPort) | quote -}} + {{- $helmrepo := include "common.helmrepository" . | quote -}} + {{- $reponame := default "helm-repo" .Values.appmgr.reponame | quote -}} + {{- $tiller := include "common.helmrepositorytiller" . | quote -}} + {{- $tillernamespace := include "common.helmrepositorytillernamespace" . | quote -}} + {{- $tillerport := include "common.helmrepositorytillerport" . | quote -}} + {{- (.Files.Glob "resources/appmgr.yaml").AsConfig | replace "__HELM_REPO__" $helmrepo | replace "__REST_PORT__" $restport | replace "__REPO_NAME__" $reponame | replace "__TILLER_SERVICE__" $tiller | replace "__TILLER_NAMESPACE__" $tillernamespace | replace "__TILLER_PORT__" $tillerport | nindent 2 }} diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/templates/appenv.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/templates/appenv.yaml index 465f08c5..c0382642 100644 --- a/ric-platform/50-RIC-Platform/helm/appmgr/templates/appenv.yaml +++ b/ric-platform/50-RIC-Platform/helm/appmgr/templates/appenv.yaml @@ -18,8 +18,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "appmgr.fullname" . }}-appenv + name: {{ include "common.configmapname.appmgr" . }}-appenv data: - {{- with .Values.appmgr.appenv }} - {{- toYaml . | nindent 2 }} - {{- end }} + {{- $dbaasservicehost := include "common.servicename.dbaas" . | quote -}} + {{- (.Files.Get "resources/appenv.yaml") | replace "__DBAAS_SERVICE_HOST__" $dbaasservicehost | nindent 2 }} diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/templates/deployment.yaml index b425365a..dbcd3152 100644 --- a/ric-platform/50-RIC-Platform/helm/appmgr/templates/deployment.yaml +++ b/ric-platform/50-RIC-Platform/helm/appmgr/templates/deployment.yaml @@ -18,7 +18,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "appmgr.fullname" . }} + name: {{ include "common.deploymentname.appmgr" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} @@ -31,8 +31,6 @@ spec: matchLabels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} release: {{ .Release.Name }} - #app.kubernetes.io/name: {{ include "appmgr.name" . }} - #app.kubernetes.io/instance: {{ .Release.Name }} template: metadata: labels: @@ -52,14 +50,15 @@ spec: protocol: TCP volumeMounts: - name: config-volume - mountPath: {{ .Values.appmgr.appconfigpath }} + mountPath: {{ .Values.appmgr.appconfigpath }}/appmgr.yaml + subPath: appmgr.yaml - name: secret-volume mountPath: {{ .Values.appmgr.appsecretpath }} - name: cert-volume mountPath: {{ .Values.appmgr.appcertpath }} envFrom: - configMapRef: - name: {{ include "appmgr.fullname" . }}-appenv + name: {{ include "common.configmapname.appmgr" . }}-appenv livenessProbe: #exec: # command: @@ -80,7 +79,7 @@ spec: volumes: - name: config-volume configMap: - name: {{ include "appmgr.fullname" . }}-appconfig + name: {{ include "common.configmapname.appmgr" . }}-appconfig - name: secret-volume secret: secretName: {{ include "common.helmrepositorycred" . }} diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/templates/ingress-appmgr.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/templates/ingress-appmgr.yaml new file mode 100644 index 00000000..d2342a50 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/appmgr/templates/ingress-appmgr.yaml @@ -0,0 +1,12 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress-appmgr +spec: + rules: + - http: + paths: + - path: /appmgr + backend: + serviceName: {{ include "appmgr.fullname" . }} + servicePort: {{ .Values.appmgr.service.port }} \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/templates/service.yaml index f7d73614..6c1241a0 100644 --- a/ric-platform/50-RIC-Platform/helm/appmgr/templates/service.yaml +++ b/ric-platform/50-RIC-Platform/helm/appmgr/templates/service.yaml @@ -18,7 +18,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "appmgr.fullname" . }} + name: {{ include "common.servicename.appmgr" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/values.yaml b/ric-platform/50-RIC-Platform/helm/appmgr/values.yaml index ffe29342..3b20e64b 100644 --- a/ric-platform/50-RIC-Platform/helm/appmgr/values.yaml +++ b/ric-platform/50-RIC-Platform/helm/appmgr/values.yaml @@ -16,15 +16,15 @@ ################################################################################ repository: "nexus3.o-ran-sc.org:10004" +#repositoryOverride: "nexus3.o-ran-sc.org:10004" imagePullPolicy: IfNotPresent repositoryCred: docker-reg-cred - # Helm Repo for xApp # By default a local helm repo is used. The global setting will override # the default value. You can further override using #helmRepositoryOverride: "" -helmRepository: "snapshot.helm.local.ric.org" +helmRepository: "https://helm.ricinfra.local:31000" # Default secret name for Helm Repo credential. .Value.golbal.helmRepositoryCred will # override the default value. You can further override uing @@ -50,7 +50,7 @@ helmRepositoryTillerNamespace: "kube-system" # Helm Tiller port for xApp # The global setting will override this default value # You can further override using helmRepositoryTillerPortOverride: "" -helmRepositoryTillerPort: "44134" +helmRepositoryTillerPort: 44134 # Uncomment the following line to override the docker registry #repositoryOverride: "" @@ -65,8 +65,8 @@ helmRepositoryTillerPort: "44134" appmgr: image: # xAppmanager Docker image name and tag - name: xapp-manager - tag: latest + name: ric-plt-appmgr + tag: 0.1.3 # This section describes xAppManager replicaCount: 1 @@ -75,22 +75,17 @@ appmgr: reponame: "helm-repo" service: - type: NodePort + type: ClusterIP port: 8080 name: appmgr-service protocol: "TCP" - export: 30020 + extport: 30020 # config # Path referred in xapp-manager for retrieving configuration details appconfigpath: /opt/ric/config - # To be provided as env variables - appenv: - NAME: xappmgr - #ENV1: "envvalue1" - #ENV2: "envvalue2" # secret # Path referred in xapp-manager for retrieving helm repo secrets diff --git a/ric-platform/50-RIC-Platform/helm/common/templates/_service.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_chart.tpl similarity index 73% rename from ric-platform/50-RIC-Platform/helm/common/templates/_service.tpl rename to ric-platform/50-RIC-Platform/helm/common/templates/_chart.tpl index 5403effb..1236b4b3 100644 --- a/ric-platform/50-RIC-Platform/helm/common/templates/_service.tpl +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_chart.tpl @@ -15,18 +15,7 @@ # limitations under the License. # ################################################################################ -{{/* - Resolve the name of a chart's service. - The default will be the chart name (or .Values.nameOverride if set). - And the use of .Values.service.name overrides all. - - - .Values.service.name : override default service (ie. chart) name -*/}} -{{/* - Expand the service name for a chart. -*/}} -{{- define "common.servicename" -}} - {{- $name := default .Chart.Name .Values.nameOverride -}} - {{- default $name .Values.service.name | trunc 63 | trimSuffix "-" -}} +{{- define "common.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/ric-platform/50-RIC-Platform/helm/appmgr/templates/_helpers.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_configmapname.tpl similarity index 55% rename from ric-platform/50-RIC-Platform/helm/appmgr/templates/_helpers.tpl rename to ric-platform/50-RIC-Platform/helm/common/templates/_configmapname.tpl index b65d7fa0..671b620a 100644 --- a/ric-platform/50-RIC-Platform/helm/appmgr/templates/_helpers.tpl +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_configmapname.tpl @@ -15,36 +15,40 @@ # limitations under the License. # ################################################################################ -{{/* vim: set filetype=mustache: */}} {{/* -Expand the name of the chart. + Resolve the name of a chart's configmap. + */}} -{{- define "appmgr.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} + + +{{- define "common.configmapname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "appmgr.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- define "common.configmapname.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}}: + +{{- define "common.configmapname.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{- define "common.configmapname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{- define "common.configmapname.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "appmgr.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- define "common.configmapname.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + diff --git a/ric-platform/50-RIC-Platform/helm/rtmgr/templates/_helper.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_deploymentname.tpl similarity index 55% rename from ric-platform/50-RIC-Platform/helm/rtmgr/templates/_helper.tpl rename to ric-platform/50-RIC-Platform/helm/common/templates/_deploymentname.tpl index 46334378..2571a5cb 100644 --- a/ric-platform/50-RIC-Platform/helm/rtmgr/templates/_helper.tpl +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_deploymentname.tpl @@ -15,36 +15,40 @@ # limitations under the License. # ################################################################################ -{{/* vim: set filetype=mustache: */}} {{/* -Expand the name of the chart. + Resolve the name of a chart's deployment. */}} -{{- define "rtmgr.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} + + +{{- define "common.deploymentname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "rtmgr.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- define "common.deploymentname.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{- define "common.deploymentname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{- define "common.deploymentname.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "rtmgr.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- define "common.deploymentname.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + + diff --git a/ric-platform/50-RIC-Platform/helm/common/templates/_helmrepo.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_helmrepo.tpl index 30846dc4..c662cf53 100644 --- a/ric-platform/50-RIC-Platform/helm/common/templates/_helmrepo.tpl +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_helmrepo.tpl @@ -154,16 +154,28 @@ */}} {{- define "common.helmrepositorytillerport" -}} {{- if .Values.helmRepositoryTillerPortOverride -}} - {{- printf "%s" .Values.helmRepositoryTillerPortOverride -}} + {{- printf "%.0f" .Values.helmRepositoryTillerPortOverride -}} {{- else -}} {{- if .Values.global -}} {{- if .Values.global.helmRepositoryTillerPort -}} - {{- printf "%s" .Values.global.helmRepositoryTillerPort -}} + {{- printf "%.0f" .Values.global.helmRepositoryTillerPort -}} {{- else -}} - {{- printf "%s" .Values.helmRepositoryTillerPort -}} + {{- printf "%.0f" .Values.helmRepositoryTillerPort -}} {{- end -}} {{- else -}} - {{- printf "%s" .Values.helmRepositoryTillerPort -}} + {{- printf "%.0f" .Values.helmRepositoryTillerPort -}} {{- end -}} {{- end -}} {{- end -}} + +{{/* +Generate certificates for the helm repo +*/}} +{{- define "common.helmrepository.gen-certs" -}} +{{- $altNames := list ( printf "helm.%s" .Values.ingress.hostpostfix ) -}} +{{- $ca := genCA "helm-repository-ca" 365 -}} +{{- $cert := genSignedCert ( include "nexus.name" . ) nil $altNames 365 $ca -}} +tls.crt: {{ $cert.Cert | b64enc }} +tls.key: {{ $cert.Key | b64enc }} +{{- end -}} + diff --git a/ric-platform/50-RIC-Platform/helm/common/templates/_ingresscontroller.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_ingresscontroller.tpl new file mode 100644 index 00000000..7ebbcd1a --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_ingresscontroller.tpl @@ -0,0 +1,189 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +{{/* + Resolve the ingress controller addresses. +*/}} +{{- define "common.ingressurl.ricplt" -}} + {{- if .Values.kongplatform -}} + {{- if .Values.kongplatform.ingressurlOverride -}} + {{- printf "%s" .Values.kongplatform.ingressurlOverride -}} + {{- else -}} + {{- printf "ricplt-entry" -}} + {{- end -}} + {{- else -}} + {{- printf "ricplt-entry" -}} + {{- end -}} +{{- end -}} + + + +{{- define "common.ingresshttpport.ricplt" -}} + {{- if .Values.kongplatform -}} + {{- if .Values.kongplatform.ingresshttpportOverride -}} + {{- printf "%.0f" .Values.kongplatform.ingresshttpportOverride -}} + {{- else -}} + {{- printf "30080" -}} + {{- end -}} + {{- else -}} + {{- printf "30080" -}} + {{- end -}} +{{- end -}} + + + +{{- define "common.ingresshttpsport.ricplt" -}} + {{- if .Values.kongplatform -}} + {{- if .Values.kongplatform.ingresshttpsportOverride -}} + {{- printf "%.0f" .Values.kongplatform.ingresshttpsportOverride -}} + {{- else -}} + {{- printf "30443" -}} + {{- end -}} + {{- else -}} + {{- printf "30443" -}} + {{- end -}} +{{- end -}} + + + + + + + + + + + + + + + + +{{- define "common.ingressurl.ricxapp" -}} + {{- if .Values.kongxapp -}} + {{- if .Values.kongxapp.ingressurlOverride -}} + {{- printf "%s" .Values.kongxapp.ingressurlOverride -}} + {{- else -}} + {{- printf "ricxapp-entry" -}} + {{- end -}} + {{- else -}} + {{- printf "ricxapp-entry" -}} + {{- end -}} +{{- end -}} + + + +{{- define "common.ingresshttpport.ricxapp" -}} + {{- if .Values.kongxapp -}} + {{- if .Values.kongxapp.ingresshttpportOverride -}} + {{- printf "%.0f" .Values.kongxapp.ingresshttpportOverride -}} + {{- else -}} + {{- printf "31080" -}} + {{- end -}} + {{- else -}} + {{- printf "31080" -}} + {{- end -}} +{{- end -}} + + + +{{- define "common.ingresshttpsport.ricxapp" -}} + {{- if .Values.kongxapp -}} + {{- if .Values.kongxapp.ingresshttpsportOverride -}} + {{- printf "%.0f" .Values.kongxapp.ingresshttpsportOverride -}} + {{- else -}} + {{- printf "31443" -}} + {{- end -}} + {{- else -}} + {{- printf "31443" -}} + {{- end -}} +{{- end -}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{{- define "common.ingressurl.ricaux" -}} + {{- if .Values.kongaux -}} + {{- if .Values.kongaux.ingressurlOverride -}} + {{- printf "%s" .Values.kongaux.ingressurlOverride -}} + {{- else -}} + {{- printf "ricaux-entry" -}} + {{- end -}} + {{- else -}} + {{- printf "ricaux-entry" -}} + {{- end -}} +{{- end -}} + + + + + +{{- define "common.ingresshttpport.ricaux" -}} + {{- if .Values.kongaux -}} + {{- if .Values.kongaux.ingresshttpportOverride -}} + {{- printf "%.0f" .Values.kongaux.ingresshttpportOverride -}} + {{- else -}} + {{- printf "32080" -}} + {{- end -}} + {{- else -}} + {{- printf "32080" -}} + {{- end -}} +{{- end -}} + + + +{{- define "common.ingresshttpsport.ricaux" -}} + {{- if .Values.kongaux -}} + {{- if .Values.kongaux.ingresshttpsportOverride -}} + {{- printf "%.0f" .Values.kongaux.ingresshttpsportOverride -}} + {{- else -}} + {{- printf "32443" -}} + {{- end -}} + {{- else -}} + {{- printf "32443" -}} + {{- end -}} +{{- end -}} + diff --git a/ric-platform/50-RIC-Platform/helm/common/templates/_name.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_name.tpl index 200e9c31..f9a553e0 100644 --- a/ric-platform/50-RIC-Platform/helm/common/templates/_name.tpl +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_name.tpl @@ -16,8 +16,148 @@ ################################################################################ {{/* - Expand the name of a chart. + This is the root file that define the name of each component. Value here will be used to define other K8S resource name. */}} + + + +{{- define "common.name.appmgr" -}} + {{- if .Values.appmgr -}} + {{- if .Values.appmgr.nameOverride -}} + {{- printf "%s" .Values.appmgr.nameOverride -}} + {{- else -}} + {{- printf "appmgr" -}} + {{- end -}} + {{- else -}} + {{- printf "appmgr" -}} + {{- end -}} +{{- end -}} + +{{- define "common.fullname.appmgr" -}} + {{- $name := ( include "common.name.appmgr" . ) -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.name.dbaas" -}} + {{- if .Values.dbaas -}} + {{- if .Values.dbaas.nameOverride -}} + {{- printf "%s" .Values.dbaas.nameOverride -}} + {{- else -}} + {{- printf "dbaas" -}} + {{- end -}} + {{- else -}} + {{- printf "dbaas" -}} + {{- end -}} +{{- end -}} + +{{- define "common.fullname.dbaas" -}} + {{- $name := ( include "common.name.dbaas" . ) -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + + + + + + + + + +{{- define "common.name.e2mgr" -}} + {{- if .Values.e2mgr -}} + {{- if .Values.e2mgr.nameOverride -}} + {{- printf "%s" .Values.e2mgr.nameOverride -}} + {{- else -}} + {{- printf "e2mgr" -}} + {{- end -}} + {{- else -}} + {{- printf "e2mgr" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.fullname.e2mgr" -}} + {{- $name := ( include "common.name.e2mgr" . ) -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.name.e2term" -}} + {{- if .Values.e2term -}} + {{- if .Values.e2term.nameOverride -}} + {{- printf "%s" .Values.e2term.nameOverride -}} + {{- else -}} + {{- printf "e2term" -}} + {{- end -}} + {{- else -}} + {{- printf "e2term" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.fullname.e2term" -}} + {{- $name := ( include "common.name.e2term" . ) -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + + + + + + + +{{- define "common.name.rtmgr" -}} + {{- if .Values.rtmgr -}} + {{- if .Values.rtmgr.nameOverride -}} + {{- printf "%s" .Values.rtmgr.nameOverride -}} + {{- else -}} + {{- printf "rtmgr" -}} + {{- end -}} + {{- else -}} + {{- printf "rtmgr" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.fullname.rtmgr" -}} + {{- $name := ( include "common.name.rtmgr" . ) -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + + + + +{{- define "common.name.a1mediator" -}} + {{- if .Values.a1mediator -}} + {{- if .Values.a1mediator.nameOverride -}} + {{- printf "%s" .Values.a1mediator.nameOverride -}} + {{- else -}} + {{- printf "a1mediator" -}} + {{- end -}} + {{- else -}} + {{- printf "a1mediator" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.fullname.a1mediator" -}} + {{- $name := ( include "common.name.a1mediator" . ) -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + + + + + + {{- define "common.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/ric-platform/50-RIC-Platform/helm/common/templates/_repository.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_repository.tpl index 6058df41..07969988 100644 --- a/ric-platform/50-RIC-Platform/helm/common/templates/_repository.tpl +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_repository.tpl @@ -24,8 +24,23 @@ - .Values.repositoryOverride : override global and default image repository on a per image basis */}} {{- define "common.repository" -}} - {{- if .Values.repositoryOverride -}} - {{- printf "%s" .Values.repositoryOverride -}} + {{- $componentname := .Chart.Name -}} + {{- $firsttier := (index .Values (printf "%s" $componentname)) -}} + {{- if $firsttier -}} + {{- $secondtier := (index .Values (printf "%s" $componentname) (printf "%s" "repositoryOverride")) -}} + {{- if $secondtier -}} + {{- printf "%s" $secondtier -}} + {{- else -}} + {{- if .Values.global -}} + {{- if .Values.global.repository -}} + {{- printf "%s" .Values.global.repository -}} + {{- else -}} + {{- printf "%s" .Values.repository -}} + {{- end -}} + {{- else -}} + {{- printf "%s" .Values.repository -}} + {{- end -}} + {{- end -}} {{- else -}} {{- if .Values.global -}} {{- if .Values.global.repository -}} diff --git a/ric-platform/50-RIC-Platform/helm/common/templates/_servicename.tpl b/ric-platform/50-RIC-Platform/helm/common/templates/_servicename.tpl new file mode 100644 index 00000000..20e381af --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/common/templates/_servicename.tpl @@ -0,0 +1,62 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +{{/* + Resolve the name of a chart's service. + + The default will be the chart name (or .Values.nameOverride if set). + And the use of .Values.service.name overrides all. + + - .Values.service.name : override default service (ie. chart) name +*/}} +{{/* + Expand the service name for a chart. +*/}} + + +{{- define "common.servicename.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + diff --git a/ric-platform/50-RIC-Platform/helm/dbaas/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/dbaas/templates/deployment.yaml index 8d2014fc..135b2c27 100644 --- a/ric-platform/50-RIC-Platform/helm/dbaas/templates/deployment.yaml +++ b/ric-platform/50-RIC-Platform/helm/dbaas/templates/deployment.yaml @@ -18,7 +18,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "dbaas.fullname" . }} + name: {{ include "common.deploymentname.dbaas" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-platform/50-RIC-Platform/helm/dbaas/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/dbaas/templates/service.yaml index 0708b0c9..c87ddf37 100644 --- a/ric-platform/50-RIC-Platform/helm/dbaas/templates/service.yaml +++ b/ric-platform/50-RIC-Platform/helm/dbaas/templates/service.yaml @@ -18,7 +18,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "dbaas.fullname" . }} + name: {{ include "common.servicename.dbaas" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/configmap.yaml b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/configmap.yaml index 7ccc8a66..fcfe9a0c 100644 --- a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/configmap.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/configmap.yaml @@ -19,11 +19,11 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "e2mgr.fullname" . }}-router-configmap + name: {{ include "common.configmapname.e2mgr" . }}-router-configmap namespace: {{ include "common.namespace" . }} data: router.txt: | newrt|start - rte|1001|ric-full-e2term:38000 - rte|2002|{{ include "e2mgr.fullname" .}}:3801 + rte|1001|{{ include "common.servicename.e2term" .}}:38000 + rte|2002|{{ include "common.servicename.e2mgr" .}}:3801 newrt|end diff --git a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/deployment.yaml index f5726a3e..08360458 100644 --- a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/deployment.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/deployment.yaml @@ -18,7 +18,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "e2mgr.fullname" .}} + name: {{ include "common.deploymentname.e2mgr" .}} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} @@ -63,4 +63,4 @@ spec: volumes: - name: local-router-file configMap: - name: {{ include "e2mgr.fullname" . }}-router-configmap + name: {{ include "common.configmapname.e2mgr" . }}-router-configmap diff --git a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/ingress-e2mgr.yaml b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/ingress-e2mgr.yaml new file mode 100644 index 00000000..07229283 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/ingress-e2mgr.yaml @@ -0,0 +1,12 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress-e2mgr +spec: + rules: + - http: + paths: + - path: /e2mgr + backend: + serviceName: {{ include "common.servicename.e2mgr" . }} + servicePort: {{ .Values.e2mgr.service.http.port }} \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/service.yaml index d2a2a80c..2eb580ff 100644 --- a/ric-platform/50-RIC-Platform/helm/e2mgr/templates/service.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2mgr/templates/service.yaml @@ -18,7 +18,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "e2mgr.fullname" . }} + name: {{ include "common.servicename.e2mgr" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-platform/50-RIC-Platform/helm/e2mgr/values.yaml b/ric-platform/50-RIC-Platform/helm/e2mgr/values.yaml index 5f11d215..a0bb1af6 100644 --- a/ric-platform/50-RIC-Platform/helm/e2mgr/values.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2mgr/values.yaml @@ -48,7 +48,7 @@ e2mgr: RMR_RTG_SVC: "ric-full-rtmgr" service: - type: NodePort + type: ClusterIP http: port: 3800 target_port: 3800 diff --git a/ric-platform/50-RIC-Platform/helm/e2term/templates/_helpers.tpl b/ric-platform/50-RIC-Platform/helm/e2term/templates/_helpers.tpl deleted file mode 100644 index c1cd9509..00000000 --- a/ric-platform/50-RIC-Platform/helm/e2term/templates/_helpers.tpl +++ /dev/null @@ -1,48 +0,0 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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. # -################################################################################ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "e2term.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "e2term.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "e2term.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/ric-platform/50-RIC-Platform/helm/e2term/templates/configmap.yaml b/ric-platform/50-RIC-Platform/helm/e2term/templates/configmap.yaml index edd24ed7..832b2635 100644 --- a/ric-platform/50-RIC-Platform/helm/e2term/templates/configmap.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2term/templates/configmap.yaml @@ -19,11 +19,11 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "e2term.fullname" . }}-router-configmap + name: {{ include "common.configmapname.e2term" . }}-router-configmap namespace: {{ include "common.namespace" . }} data: router.txt: | newrt|start - rte|1001|{{ include "e2term.fullname" . }}:38000 - rte|2002|ric-full-e2mgr:3801 + rte|1001|{{ include "common.configmapname.e2term" . }}:38000 + rte|2002|{{ include "common.configmapname.e2mgr" . }}:3801 newrt|end diff --git a/ric-platform/50-RIC-Platform/helm/e2term/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/e2term/templates/deployment.yaml index 82b1b728..c090c364 100644 --- a/ric-platform/50-RIC-Platform/helm/e2term/templates/deployment.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2term/templates/deployment.yaml @@ -18,7 +18,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "e2term.fullname" . }} + name: {{ include "common.deploymentname.e2term" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} @@ -69,4 +69,4 @@ spec: volumes: - name: local-router-file configMap: - name: {{ include "e2term.fullname" . }}-router-configmap + name: {{ include "common.configmapname.e2term" . }}-router-configmap diff --git a/ric-platform/50-RIC-Platform/helm/e2term/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/e2term/templates/service.yaml index b46de3d0..c3332f13 100644 --- a/ric-platform/50-RIC-Platform/helm/e2term/templates/service.yaml +++ b/ric-platform/50-RIC-Platform/helm/e2term/templates/service.yaml @@ -18,7 +18,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "e2term.fullname" . }} + name: {{ include "common.servicename.e2term" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-platform/50-RIC-Platform/helm/kong-platform/.helmignore b/ric-platform/50-RIC-Platform/helm/kong-platform/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-platform/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/ric-platform/50-RIC-Platform/helm/kong-platform/Chart.yaml b/ric-platform/50-RIC-Platform/helm/kong-platform/Chart.yaml new file mode 100644 index 00000000..4bd2e363 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-platform/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: kong_platform +version: 1.0.0 diff --git a/ric-platform/50-RIC-Platform/helm/kong-platform/requirements.yaml b/ric-platform/50-RIC-Platform/helm/kong-platform/requirements.yaml new file mode 100644 index 00000000..2587ea7e --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-platform/requirements.yaml @@ -0,0 +1,21 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: kong + repository: '@stable' + version: ~0.12.2 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/kong-platform/values.yaml b/ric-platform/50-RIC-Platform/helm/kong-platform/values.yaml new file mode 100644 index 00000000..0a2a6292 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-platform/values.yaml @@ -0,0 +1,19 @@ +# Default values for kong_platform. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +kong: + ingressController: + enabled: true + + postgresql: + enabled: false + + env: + database: "off" + + proxy: + http: + nodePort: 30080 + tls: + nodePort: 30443 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/kong-xapp/.helmignore b/ric-platform/50-RIC-Platform/helm/kong-xapp/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-xapp/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/ric-platform/50-RIC-Platform/helm/kong-xapp/Chart.yaml b/ric-platform/50-RIC-Platform/helm/kong-xapp/Chart.yaml new file mode 100644 index 00000000..25b4aad7 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-xapp/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: kong_xapp +version: 1.0.0 diff --git a/ric-platform/50-RIC-Platform/helm/kong-xapp/requirements.yaml b/ric-platform/50-RIC-Platform/helm/kong-xapp/requirements.yaml new file mode 100644 index 00000000..2587ea7e --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-xapp/requirements.yaml @@ -0,0 +1,21 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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: kong + repository: '@stable' + version: ~0.12.2 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/kong-xapp/templates/ingress-xapp.yaml b/ric-platform/50-RIC-Platform/helm/kong-xapp/templates/ingress-xapp.yaml new file mode 100644 index 00000000..54d7abf7 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-xapp/templates/ingress-xapp.yaml @@ -0,0 +1,12 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress-xapp +spec: + rules: + - http: + paths: + - path: /anr + backend: + serviceName: r0-xapp-anr + servicePort: 9999 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/kong-xapp/values.yaml b/ric-platform/50-RIC-Platform/helm/kong-xapp/values.yaml new file mode 100644 index 00000000..1cf2ab61 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/kong-xapp/values.yaml @@ -0,0 +1,22 @@ +# Default values for kong_platform. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +kong: + ingressController: + enabled: true + installCRDs: false + + postgresql: + enabled: false + + env: + database: "off" + + proxy: + http: + nodePort: 31080 + tls: + nodePort: 31443 + + diff --git a/ric-platform/50-RIC-Platform/helm/rtmgr/templates/rtmgr-dep.yaml b/ric-platform/50-RIC-Platform/helm/rtmgr/templates/deployment.yaml similarity index 98% rename from ric-platform/50-RIC-Platform/helm/rtmgr/templates/rtmgr-dep.yaml rename to ric-platform/50-RIC-Platform/helm/rtmgr/templates/deployment.yaml index 7c1ad885..afeff191 100644 --- a/ric-platform/50-RIC-Platform/helm/rtmgr/templates/rtmgr-dep.yaml +++ b/ric-platform/50-RIC-Platform/helm/rtmgr/templates/deployment.yaml @@ -18,7 +18,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "rtmgr.fullname" . }} + name: {{ include "common.deploymentname.rtmgr" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-platform/50-RIC-Platform/helm/rtmgr/templates/rtmgr-svc.yaml b/ric-platform/50-RIC-Platform/helm/rtmgr/templates/service.yaml similarity index 97% rename from ric-platform/50-RIC-Platform/helm/rtmgr/templates/rtmgr-svc.yaml rename to ric-platform/50-RIC-Platform/helm/rtmgr/templates/service.yaml index b1080674..3f0dc98a 100644 --- a/ric-platform/50-RIC-Platform/helm/rtmgr/templates/rtmgr-svc.yaml +++ b/ric-platform/50-RIC-Platform/helm/rtmgr/templates/service.yaml @@ -18,7 +18,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "rtmgr.fullname" . }} + name: {{ include "common.servicename.rtmgr" . }} namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.namespace" . }}-{{ include "common.name" . }} diff --git a/ric-xapps/90-xApps/helm/xapp-std/config/config-file.json b/ric-xapps/90-xApps/helm/xapp-std/config/config-file.json new file mode 100755 index 00000000..33c5f207 --- /dev/null +++ b/ric-xapps/90-xApps/helm/xapp-std/config/config-file.json @@ -0,0 +1,20 @@ +{ + "local": { + "host": ":8080" + }, + "logger": { + "level": 3 + }, + "rmr": { + "protPort": "tcp:4560", + "maxSize": 2072, + "numWorkers": 1, + "txMessages": ["RIC_X2_LOAD_INFORMATION"], + "rxMessages": ["RIC_X2_LOAD_INFORMATION"] + }, + "db": { + "namespace": "ricxapp", + "host": "dbaas", + "port": 6379 + } +} diff --git a/ric-xapps/90-xApps/helm/xapp-std/descriptors/schema.json b/ric-xapps/90-xApps/helm/xapp-std/descriptors/schema.json new file mode 100755 index 00000000..5fd3b23c --- /dev/null +++ b/ric-xapps/90-xApps/helm/xapp-std/descriptors/schema.json @@ -0,0 +1,147 @@ +{ + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://example.com/root.json", + "type": "object", + "title": "The Root Schema", + "required": [ + "local", + "logger", + "rmr", + "db" + ], + "properties": { + "local": { + "$id": "#/properties/local", + "type": "object", + "title": "The Local Schema", + "required": [ + "host" + ], + "properties": { + "host": { + "$id": "#/properties/local/properties/host", + "type": "string", + "title": "The Host Schema", + "default": "", + "examples": [ + ":8080" + ], + "pattern": "^(.*)$" + } + } + }, + "logger": { + "$id": "#/properties/logger", + "type": "object", + "title": "The Logger Schema", + "required": [ + "level" + ], + "properties": { + "level": { + "$id": "#/properties/logger/properties/level", + "type": "integer", + "title": "The Level Schema", + "default": 0, + "examples": [ + 3 + ] + } + } + }, + "rmr": { + "$id": "#/properties/rmr", + "type": "object", + "title": "The Rmr Schema", + "required": [ + "protPort", + "maxSize", + "numWorkers", + "txMessages", + "rxMessages" + ], + "properties": { + "protPort": { + "$id": "#/properties/rmr/properties/protPort", + "type": "string", + "title": "The Protport Schema", + "default": "", + "examples": [ + "tcp:4560" + ], + "pattern": "^(.*)$" + }, + "maxSize": { + "$id": "#/properties/rmr/properties/maxSize", + "type": "integer", + "title": "The Maxsize Schema", + "default": 0, + "examples": [ + 2072 + ] + }, + "numWorkers": { + "$id": "#/properties/rmr/properties/numWorkers", + "type": "integer", + "title": "The Numworkers Schema", + "default": 0, + "examples": [ + 1 + ] + }, + "txMessages": { + "$id": "#/properties/rmr/properties/txMessages", + "type": "array", + "title": "The Txmessages Schema" + }, + "rxMessages": { + "$id": "#/properties/rmr/properties/rxMessages", + "type": "array", + "title": "The Rxmessages Schema" + } + } + }, + "db": { + "$id": "#/properties/db", + "type": "object", + "title": "The Db Schema", + "required": [ + "host", + "namespace", + "port" + ], + "properties": { + "host": { + "$id": "#/properties/db/properties/host", + "type": "string", + "title": "The Host Schema", + "default": "", + "examples": [ + "dbaas" + ], + "pattern": "^(.*)$" + }, + "namespace": { + "$id": "#/properties/db/properties/namespace", + "type": "string", + "title": "The Namespace Schema", + "default": "", + "examples": [ + "ricxapp" + ], + "pattern": "^(.*)$" + }, + "port": { + "$id": "#/properties/db/properties/port", + "type": "integer", + "title": "The Port Schema", + "default": 0, + "examples": [ + 6379 + ] + } + } + } + } +} \ No newline at end of file diff --git a/ric-xapps/90-xApps/helm/xapp-std/templates/appconfig.yaml b/ric-xapps/90-xApps/helm/xapp-std/templates/appconfig.yaml index ce0dc0a6..fc6e6229 100644 --- a/ric-xapps/90-xApps/helm/xapp-std/templates/appconfig.yaml +++ b/ric-xapps/90-xApps/helm/xapp-std/templates/appconfig.yaml @@ -1,25 +1,14 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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. # -################################################################################ +# +# ================================================================================== +# Copyright (c) 2019 Nokia +# ================================================================================== +# + +{{ if (eq .Values.ricapp.appconfig.override "") }} apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-appconfig + name: {{ if .Values.ricapp.appconfig.override }}{{ .Values.ricapp.appconfig.override }}{{ else }}{{ .Release.Name }}-appconfig{{ end }} data: - {{- with .Values.ricapp.appconfig }} - {{- toYaml . | nindent 2 }} - {{- end }} - +{{ (.Files.Glob "config/*").AsConfig | indent 2 }} +{{ end }} diff --git a/ric-xapps/90-xApps/helm/xapp-std/templates/deployment.yaml b/ric-xapps/90-xApps/helm/xapp-std/templates/deployment.yaml index 295747ba..1e82e942 100644 --- a/ric-xapps/90-xApps/helm/xapp-std/templates/deployment.yaml +++ b/ric-xapps/90-xApps/helm/xapp-std/templates/deployment.yaml @@ -1,19 +1,9 @@ -################################################################################ -# Copyright (c) 2019 AT&T Intellectual Property. # -# Copyright (c) 2019 Nokia. # -# # -# 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. # -################################################################################ +# +# ================================================================================== +# Copyright (c) 2019 Nokia +# ================================================================================== +# + apiVersion: apps/v1 kind: Deployment metadata: @@ -35,57 +25,51 @@ spec: app.kubernetes.io/name: {{ include "ricapp.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} spec: - imagePullSecrets: - - name: {{ .Release.Name }}-docker-registry-key + hostname: {{ .Values.ricapp.hostname }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.global.repository }}/{{ .Values.ricapp.image.name }}:{{ .Values.ricapp.image.tag }}" imagePullPolicy: {{ .Values.global.image.pullPolicy }} - # enable the next two elements if wanting to test pod bypassing its own entrypoint - #command: ["sh"] - #args: - # - -c - # - "while sleep 2; do echo thinking; done" ports: - name: http - containerPort: 8080 + containerPort: {{ .Values.ricapp.service.port }} + protocol: TCP + - name: rmr + containerPort: {{ .Values.ricapp.service.rmrPort }} protocol: TCP volumeMounts: - name: config-volume - mountPath: {{ .Values.ricapp.appconfigpath }} - - name: secret-volume - mountPath: {{ .Values.ricapp.appsecretpath }} - envFrom: - - configMapRef: - name: {{ .Release.Name }}-appenv + mountPath: {{ .Values.ricapp.appconfig.path }} + - name: cert-volume + mountPath: {{ .Values.ricapp.cert.path }} livenessProbe: - exec: - command: - - /bin/bash - - -c - - ps -ef | grep {{ .Values.ricapp.livenessprocessname }}| grep -v "grep" - initialDelaySeconds: 120 - periodSeconds: 30 + httpGet: + path: {{ .Values.ricapp.probes.healthAliveCheckEndpoint }} + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 15 readinessProbe: httpGet: - path: / - port: http + path: {{ .Values.ricapp.probes.healthReadyCheckEndpoint }} + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 15 restartPolicy: Always resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.ricapp.resources | nindent 12 }} securityContext: # ubuntu - runAsUser: 1000 - allowPrivilegeEscalation: false - {{- with .Values.nodeSelector }} + #runAsUser: 1000 + #allowPrivilegeEscalation: false + {{- with .Values.ricapp.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} + {{- with .Values.ricapp.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.tolerations }} + {{- with .Values.ricapp.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} @@ -93,7 +77,6 @@ spec: volumes: - name: config-volume configMap: - name: {{ .Release.Name }}-appconfig - - name: secret-volume - secret: - secretName: {{ .Release.Name }}-appsecret + name: {{ if .Values.ricapp.appconfig.override }}{{ .Values.ricapp.appconfig.override }}{{ else }}{{ .Release.Name }}-appconfig{{ end }} + - name: cert-volume + emptyDir: {} diff --git a/ric-xapps/90-xApps/helm/xapp-std/templates/service.yaml b/ric-xapps/90-xApps/helm/xapp-std/templates/service.yaml index a76c9749..5e8c15fb 100644 --- a/ric-xapps/90-xApps/helm/xapp-std/templates/service.yaml +++ b/ric-xapps/90-xApps/helm/xapp-std/templates/service.yaml @@ -15,11 +15,11 @@ # limitations under the License. # ################################################################################ -{{- if .Values.ricapp.enabled }} +{{ if .Values.ricapp.service.enabled }} apiVersion: v1 kind: Service metadata: - name: {{ include "ricapp.fullname" . }} + name: {{ include "ricapp.name" . }} labels: app.kubernetes.io/name: {{ include "ricapp.name" . }} helm.sh/chart: {{ include "ricapp.chart" . }} @@ -35,4 +35,4 @@ spec: selector: app.kubernetes.io/name: {{ include "ricapp.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} -{{ end }} +{{ end }} \ No newline at end of file diff --git a/ric-xapps/90-xApps/helm/xapp-std/values.yaml b/ric-xapps/90-xApps/helm/xapp-std/values.yaml index 59541947..4d95ef1a 100644 --- a/ric-xapps/90-xApps/helm/xapp-std/values.yaml +++ b/ric-xapps/90-xApps/helm/xapp-std/values.yaml @@ -19,67 +19,53 @@ global: # modify this section to point to your local testing settings - repository: "snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001" + repository: "${__RUNRICENV_DOCKER_HOST__}:${__RUNRICENV_DOCKER_PORT__}" repositoryCred: - user: docker - password: docker + user: "${__RUNRICENV_DOCKER_USER__}" + password: "${__RUNRICENV_DOCKER_PASS__}" image: pullPolicy: IfNotPresent ricplt: # This section is reserved for values imported from RIC Platform charts - ricapp: - # This section is for xapp. Templates to be resolved from xApp descriptor + # This section is for xapp. Templates to be resolved from xApp descriptor replicaCount: 1 - xappname: &anchor-xappname xapp-std + name: xapp-std + fullname: xapp-std + nameOverride: "" + fullnameOverride: "" - # the name of the process that indicates the liveness of the component - liveness-process-name: xapp-std + # The name of the process that indicates the liveness of the component + livenessprocessname: xapp-std image: - name: whoami - tag: 0.0.1 - - nameOverride: "" - fullnameOverride: "" + name: xapp-std + tag: latest service: - enabled: false + enabled: true + type: ClusterIP + name: xapp-std-service + port: 8080 + rmrPort: 4560 + probes: + healthAliveCheckEndpoint: ric/v1/health/alive + healthReadyCheckEndpoint: ric/v1/health/ready - # to be provided as property file - appconfigpath: /opt/etc/xapp appconfig: - # to be present as file propfile1 under appconfigpath - propfile1: | - prop1.v1="propvalue1.1" - prop1.v2="propvalue1.2" - # to be present as file propfile2 under appconfigpath - propfile2: "prop2" + path: /opt/ric/config + override: "" - # to be provided as env variables - appenv: - NAME: *anchor-xappname - ENV1: "envvalue1" - ENV2: "envvalue2" + cert: + path: /opt/ric/certificates + object: {} - # secret - appsecretpath: /opt/etc/kube - appsecret: - # to be present as files under path appsecretpath - username: myusername - password: mypassword - + hostname: xapp-std resources: {} - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi nodeSelector: {} diff --git a/ric-xapps/90-xApps/scripts/localize.sh b/ric-xapps/90-xApps/scripts/localize.sh new file mode 100755 index 00000000..90f90384 --- /dev/null +++ b/ric-xapps/90-xApps/scripts/localize.sh @@ -0,0 +1,46 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + +if (( $# != 1 )); then + echo "Missing parameters: " + exit +fi + +source ./scripts/ric_env.sh +if [ -z $__RICENV_SET__ ]; then + echo "Edit your ric_env.sh for first!" + exit +fi + +# Update the local values +RESULT_DIR=./generated +rm -rf $RESULT_DIR && mkdir -p $RESULT_DIR && cp -rf ./helm $RESULT_DIR + +FILELIST=$(find ./helm \( -name "*.tpl" -o -name "*.yaml" \)) +for f in $FILELIST; do + envsubst '${__RUNRICENV_DOCKER_HOST__} ${__RUNRICENV_DOCKER_PORT__}' < $f > "$RESULT_DIR/$f"; +done + +# Rename the helm chart folder +mv $RESULT_DIR/helm/xapp-std $RESULT_DIR/helm/$1 +find $RESULT_DIR/helm/$1 -type f | xargs sed -i -e "s/xapp-std/$1/g" + +# Push to helm chart repo +helm package generated/helm/$1 | awk '{ print $NF }' | xargs mv -t $__RUNRICENV_HELMREPO_DIR__ +helm repo index $__RUNRICENV_HELMREPO_DIR__ +helm repo update diff --git a/ric-xapps/90-xApps/scripts/ric_env.sh b/ric-xapps/90-xApps/scripts/ric_env.sh new file mode 100755 index 00000000..ea960c19 --- /dev/null +++ b/ric-xapps/90-xApps/scripts/ric_env.sh @@ -0,0 +1,24 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# 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. # +################################################################################ + + +# customize the following repo info to local environment +export __RICENV_SET__='true' +export __RUNRICENV_DOCKER_HOST__='192.168.0.6' +export __RUNRICENV_DOCKER_PORT__='5000' +export __RUNRICENV_HELMREPO_DIR__='/var/www/html/charts/' \ No newline at end of file