From: czichy Date: Mon, 23 May 2022 09:05:07 +0000 (+0300) Subject: deploying RIC X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=cd6dd98c1cbcdac0d7c1167ee38b02534f8e248f;p=ric-plt%2Fric-dep.git deploying RIC added a file based on source code from it/dep that allow installing k8s, cni, docker and helm onto a plain ubuntu installation adding a file that installs ric-common templates into a helm chartmuseum adding the ric-common templates from it/dep Issue-ID: RIC-815 Signed-off-by: czichy Change-Id: Ib2f97bb4db31419564ff32d005dbb8d8cca8c691 Signed-off-by: czichy --- diff --git a/bin/install_common_templates_to_helm.sh b/bin/install_common_templates_to_helm.sh new file mode 100755 index 0000000..39f30b8 --- /dev/null +++ b/bin/install_common_templates_to_helm.sh @@ -0,0 +1,49 @@ +#!/bin/bash +################################################################################ +# Copyright (c) 2022 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. # +################################################################################ + +echo "Installing servecm (Chart Manager) and common templates to helm3" + +helm plugin install https://github.com/jdolitsky/helm-servecm +eval $(helm env |grep HELM_REPOSITORY_CACHE) +echo ${HELM_REPOSITORY_CACHE} + +nohup helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ < -d -e -c " 1>&2; + + echo "k: kubernetes version" 1>&2; + echo "c: kubernetes CNI version" 1>&2; + echo "d: docker version" 1>&2; + echo "e: helm version" 1>&2; + exit 1; +} + + +wait_for_pods_running () { + NS="$2" + CMD="kubectl get pods --all-namespaces " + if [ "$NS" != "all-namespaces" ]; then + CMD="kubectl get pods -n $2 " + fi + KEYWORD="Running" + if [ "$#" == "3" ]; then + KEYWORD="${3}.*Running" + fi + + CMD2="$CMD | grep \"$KEYWORD\" | wc -l" + NUMPODS=$(eval "$CMD2") + echo "waiting for $NUMPODS/$1 pods running in namespace [$NS] with keyword [$KEYWORD]" + while [ $NUMPODS -lt $1 ]; do + sleep 5 + NUMPODS=$(eval "$CMD2") + echo "> waiting for $NUMPODS/$1 pods running in namespace [$NS] with keyword [$KEYWORD]" + done +} + + +start_ipv6_if () { + IPv6IF="$1" + if ifconfig -a $IPv6IF; then + echo "" >> /etc/network/interfaces.d/50-cloud-init.cfg + echo "allow-hotplug ${IPv6IF}" >> /etc/network/interfaces.d/50-cloud-init.cfg + echo "iface ${IPv6IF} inet6 auto" >> /etc/network/interfaces.d/50-cloud-init.cfg + ifconfig ${IPv6IF} up + fi +} + +KUBEV="1.16.0" +KUBECNIV="0.7.5" +HELMV="3.5.4" +DOCKERV="20.10.12" + +echo running ${0} +while getopts ":k:d:e:n:c" o; do + case "${o}" in + e) + HELMV=${OPTARG} + ;; + d) + DOCKERV=${OPTARG} + ;; + k) + KUBEV=${OPTARG} + ;; + c) + KUBECNIV=${OPTARG} + ;; + *) + usage + ;; + esac +done + +if [[ ${HELMV} == 2.* ]]; then + echo "helm 2 ("${HELMV}")not supported anymore" + exit -1 +fi + +set -x +export DEBIAN_FRONTEND=noninteractive +echo "$(hostname -I) $(hostname)" >> /etc/hosts +printenv + +IPV6IF="" + +rm -rf /opt/config +mkdir -p /opt/config +echo "" > /opt/config/docker_version.txt +echo "1.16.0" > /opt/config/k8s_version.txt +echo "0.7.5" > /opt/config/k8s_cni_version.txt +echo "3.5.4" > /opt/config/helm_version.txt +echo "$(hostname -I)" > /opt/config/host_private_ip_addr.txt +echo "$(curl ifconfig.co)" > /opt/config/k8s_mst_floating_ip_addr.txt +echo "$(hostname -I)" > /opt/config/k8s_mst_private_ip_addr.txt +echo "__mtu__" > /opt/config/mtu.txt +echo "__cinder_volume_id__" > /opt/config/cinder_volume_id.txt +echo "$(hostname)" > /opt/config/stack_name.txt + +ISAUX='false' +if [[ $(cat /opt/config/stack_name.txt) == *aux* ]]; then + ISAUX='true' +fi + +modprobe -- ip_vs +modprobe -- ip_vs_rr +modprobe -- ip_vs_wrr +modprobe -- ip_vs_sh +modprobe -- nf_conntrack_ipv4 +modprobe -- nf_conntrack_ipv6 +modprobe -- nf_conntrack_proto_sctp + +if [ ! -z "$IPV6IF" ]; then + start_ipv6_if $IPV6IF +fi + +SWAPFILES=$(grep swap /etc/fstab | sed '/^[ \t]*#/ d' | sed 's/[\t ]/ /g' | tr -s " " | cut -f1 -d' ') +if [ ! -z $SWAPFILES ]; then + for SWAPFILE in $SWAPFILES + do + if [ ! -z $SWAPFILE ]; then + echo "disabling swap file $SWAPFILE" + if [[ $SWAPFILE == UUID* ]]; then + UUID=$(echo $SWAPFILE | cut -f2 -d'=') + swapoff -U $UUID + else + swapoff $SWAPFILE + fi + sed -i "\%$SWAPFILE%d" /etc/fstab + fi + done +fi + + +echo "### Docker version = "${DOCKERV} +echo "### k8s version = "${KUBEV} +echo "### helm version = "${HELMV} +echo "### k8s cni version = "${KUBECNIV} + +KUBEVERSION="${KUBEV}-00" +CNIVERSION="${KUBECNIV}-00" +DOCKERVERSION="${DOCKERV}" + +UBUNTU_RELEASE=$(lsb_release -r | sed 's/^[a-zA-Z:\t ]\+//g') +if [[ ${UBUNTU_RELEASE} == 16.* ]]; then + echo "Installing on Ubuntu $UBUNTU_RELEASE (Xenial Xerus) host" + if [ ! -z "${DOCKERV}" ]; then + DOCKERVERSION="${DOCKERV}-0ubuntu1~16.04.5" + fi +elif [[ ${UBUNTU_RELEASE} == 18.* ]]; then + echo "Installing on Ubuntu $UBUNTU_RELEASE (Bionic Beaver)" + if [ ! -z "${DOCKERV}" ]; then + DOCKERVERSION="${DOCKERV}-0ubuntu1~18.04.4" + fi +elif [[ ${UBUNTU_RELEASE} == 20.* ]]; then + echo "Installing on Ubuntu $UBUNTU_RELEASE (Focal Fossal)" + if [ ! -z "${DOCKERV}" ]; then + DOCKERVERSION="${DOCKERV}-0ubuntu2~20.04.1" # 20.10.12-0ubuntu2~20.04.1 + fi +else + echo "Unsupported Ubuntu release ($UBUNTU_RELEASE) detected. Exit." +fi + +echo "docker version to use = "${DOCKERVERSION} + +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +echo 'deb http://apt.kubernetes.io/ kubernetes-xenial main' > /etc/apt/sources.list.d/kubernetes.list + +mkdir -p /etc/apt/apt.conf.d +echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries + +apt-get update +RES=$(apt-get install -y curl jq netcat make ipset moreutils 2>&1) +if [[ $RES == */var/lib/dpkg/lock* ]]; then + echo "Fail to get dpkg lock. Wait for any other package installation" + echo "process to finish, then rerun this script" + exit -1 +fi + +APTOPTS="--allow-downgrades --allow-change-held-packages --allow-unauthenticated --ignore-hold " + +for PKG in kubeadm docker.io; do + INSTALLED_VERSION=$(dpkg --list |grep ${PKG} |tr -s " " |cut -f3 -d ' ') + if [ ! -z ${INSTALLED_VERSION} ]; then + if [ "${PKG}" == "kubeadm" ]; then + kubeadm reset -f + rm -rf ~/.kube + apt-get -y $APTOPTS remove kubeadm kubelet kubectl kubernetes-cni + else + apt-get -y $APTOPTS remove "${PKG}" + fi + fi +done +apt-get -y autoremove + +if [ -z ${DOCKERVERSION} ]; then + apt-get install -y $APTOPTS docker.io +else + apt-get install -y $APTOPTS docker.io=${DOCKERVERSION} +fi +cat > /etc/docker/daemon.json </root/config.yaml +apiVersion: kubeadm.k8s.io/v1alpha3 +kubernetesVersion: v${KUBEV} +kind: ClusterConfiguration +apiServerExtraArgs: + feature-gates: SCTPSupport=true +networking: + dnsDomain: cluster.local + podSubnet: 10.244.0.0/16 + serviceSubnet: 10.96.0.0/12 +--- +apiVersion: kubeproxy.config.k8s.io/v1alpha1 +kind: KubeProxyConfiguration +mode: ipvs +EOF + + elif [[ ${KUBEV} == 1.14.* ]]; then + cat </root/config.yaml +apiVersion: kubeadm.k8s.io/v1beta1 +kubernetesVersion: v${KUBEV} +kind: ClusterConfiguration +apiServerExtraArgs: + feature-gates: SCTPSupport=true +networking: + dnsDomain: cluster.local + podSubnet: 10.244.0.0/16 + serviceSubnet: 10.96.0.0/12 +--- +apiVersion: kubeproxy.config.k8s.io/v1alpha1 +kind: KubeProxyConfiguration +mode: ipvs +EOF + elif [[ ${KUBEV} == 1.15.* ]] || [[ ${KUBEV} == 1.16.* ]] || [[ ${KUBEV} == 1.18.* ]]; then + cat </root/config.yaml +apiVersion: kubeadm.k8s.io/v1beta2 +kubernetesVersion: v${KUBEV} +kind: ClusterConfiguration +apiServer: + extraArgs: + feature-gates: SCTPSupport=true +networking: + dnsDomain: cluster.local + podSubnet: 10.244.0.0/16 + serviceSubnet: 10.96.0.0/12 +--- +apiVersion: kubeproxy.config.k8s.io/v1alpha1 +kind: KubeProxyConfiguration +mode: ipvs +EOF + else + echo "Unsupported Kubernetes version requested. Bail." + exit + fi + + cat < /root/rbac-config.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: tiller + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: tiller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: + - kind: ServiceAccount + name: tiller + namespace: kube-system +EOF + + + kubeadm init --config /root/config.yaml + + cd /root + rm -rf .kube + mkdir -p .kube + cp -i /etc/kubernetes/admin.conf /root/.kube/config + chown root:root /root/.kube/config + export KUBECONFIG=/root/.kube/config + echo "KUBECONFIG=${KUBECONFIG}" >> /etc/environment + + kubectl get pods --all-namespaces + + kubectl apply -f "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml" + + wait_for_pods_running 8 kube-system + + kubectl taint nodes --all node-role.kubernetes.io/master- + + HELMV=$(cat /opt/config/helm_version.txt) + HELMVERSION=${HELMV} + if [ ! -e helm-v${HELMVERSION}-linux-amd64.tar.gz ]; then + wget https://get.helm.sh/helm-v${HELMVERSION}-linux-amd64.tar.gz + fi + cd /root && rm -rf Helm && mkdir Helm && cd Helm + tar -xvf ../helm-v${HELMVERSION}-linux-amd64.tar.gz + mv linux-amd64/helm /usr/local/bin/helm + + cd /root + + rm -rf /root/.helm +# if [[ ${KUBEV} == 1.16.* ]]; then +# if [[ ${HELMVERSION} == 2.* ]]; then +# helm init --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml > /tmp/helm-init.yaml +# sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' /tmp/helm-init.yaml > /tmp/helm-init-patched.yaml +# kubectl apply -f /tmp/helm-init-patched.yaml +# fi +# else +# if [[ ${HELMVERSION} == 2.* ]]; then +# helm init --service-account tiller +# fi +# fi +# if [[ ${HELMVERSION} == 2.* ]]; then +# helm init -c +# export HELM_HOME="$(pwd)/.helm" +# echo "HELM_HOME=${HELM_HOME}" >> /etc/environment +# fi + + while ! helm version; do + echo "Waiting for Helm to be ready" + sleep 15 + done + + echo "Preparing a master node (lower ID) for using local FS for PV" + PV_NODE_NAME=$(kubectl get nodes |grep master | cut -f1 -d' ' | sort | head -1) + kubectl label --overwrite nodes $PV_NODE_NAME local-storage=enable + if [ "$PV_NODE_NAME" == "$(hostname)" ]; then + mkdir -p /opt/data/dashboard-data + fi + + echo "Done with master node setup" +fi + + +if [[ ! -z "" && ! -z "" ]]; then + echo " " >> /etc/hosts +fi +if [[ ! -z "" && ! -z "" ]]; then + echo " " >> /etc/hosts +fi +if [[ ! -z "" && ! -z "helm.ricinfra.local" ]]; then + echo " helm.ricinfra.local" >> /etc/hosts +fi + +if [[ "1" -gt "100" ]]; then + cat </etc/ca-certificates/update.d/helm.crt + +EOF +fi + +if [[ "1" -gt "100" ]]; then + mkdir -p /etc/docker/certs.d/: + cat </etc/docker/ca.crt + +EOF + cp /etc/docker/ca.crt /etc/docker/certs.d/:/ca.crt + + service docker restart + systemctl enable docker.service + docker login -u -p : + docker pull :/whoami:0.0.1 +fi diff --git a/docs/installation-rediscluster.rst b/docs/installation-rediscluster.rst index 1d5a06b..6c8fd75 100644 --- a/docs/installation-rediscluster.rst +++ b/docs/installation-rediscluster.rst @@ -36,7 +36,6 @@ The set up was tested with kubernetes v1.19 cluster with #. Pod topology spread constraint enabled Reference: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints #. CEPH as the Cluster Storage Solution. - Reference: https://github.com/rook/rook.github.io/blob/master/docs/rook/v1.4/ceph-filesystem.md #. Three worker nodes in the kubernet cluster Execution diff --git a/docs/installation-ric.rst b/docs/installation-ric.rst index 3e6c57d..8336c36 100644 --- a/docs/installation-ric.rst +++ b/docs/installation-ric.rst @@ -30,6 +30,29 @@ Clone the ric-plt/dep git repository that has deployment scripts and support fil git clone "https://gerrit.o-ran-sc.org/r/ric-plt/ric-dep" +Deploying the Infrastructure and Platform Groups +------------------------------------------------ + +Use the scripts below to install kubernetes, kubernetes-CNI, helm and docker on a fresh +Ubuntu 20.04 installation. Note that since May 2022 there's no need for anything form the repo it/dep +anymore. + +.. code:: bash + + # install kubernetes, kubernetes-CNI, helm and docker + cd ric-dep/bin + ./install_k8s_and_helm.sh + + # install chartmuseum into helm and add ric-common templates + ./install_common_templates_to_helm.sh + +After the recipes are edited and helm started, the Near Realtime RIC platform is ready to be deployed. + +.. code:: bash + + cd ric-dep/bin + ./install -f ../RECIPE_EXAMPLE/PLATFORM/example_recipe_latest_stable.yaml + Modify the deployment recipe ---------------------------- @@ -62,31 +85,6 @@ points to the latest example file that is under current development. For more advanced recipe configuration options, please refer to the recipe configuration guideline. -Deploying the Infrastructure and Platform Groups ------------------------------------------------- - -Copy the ric-common helm charts for it/dep, configure the helm repo and start local helm server - -.. code:: bash - - git clone "https://gerrit.o-ran-sc.org/r/it/dep" - HELM_HOME=$(helm home) - COMMON_CHART_VERSION=$(cat dep/ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}') - helm package -d /tmp dep/ric-common/Common-Template/helm/ric-common - cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $HELM_HOME/repository/local/ - helm repo index $HELM_HOME/repository/local/ - helm serve >& /dev/null & - helm repo remove local - helm repo add local http://127.0.0.1:8879/charts - - -After the recipes are edited and helm started, the Near Realtime RIC platform is ready to be deployed. - -.. code:: bash - - cd ric-dep/bin - ./install -f ../RECIPE_EXAMPLE/PLATFORM/example_recipe_latest_stable.yaml - Checking the Deployment Status ------------------------------ diff --git a/ric-common/Common-Template/helm/aux-common/Chart.yaml b/ric-common/Common-Template/helm/aux-common/Chart.yaml new file mode 100644 index 0000000..379771c --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/Chart.yaml @@ -0,0 +1,20 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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 +description: Common templates for inclusion in other charts +name: aux-common +version: 3.0.0 diff --git a/ric-common/Common-Template/helm/aux-common/templates/_createPassword.tpl b/ric-common/Common-Template/helm/aux-common/templates/_createPassword.tpl new file mode 100644 index 0000000..938b0ee --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_createPassword.tpl @@ -0,0 +1,62 @@ +{{/* +# Copyright © 2019 Samsung Electronics +# +# 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 master password to be used to derive other passwords. The value of + .Values.masterPassword is used by default, unless either override mechanism is + used: + + - .Values.global.masterPassword : override default master password for all charts + - .Values.masterPasswordOverride : override global and default masterPassword on a per chart basis +*/}} +{{- define "common.masterPassword" -}} + {{ if .Values.masterPasswordOverride }} + {{- printf "%d" .Values.masterPasswordOverride -}} + {{ else if .Values.global.masterPassword }} + {{- printf "%d" .Values.global.masterPassword -}} + {{ else if .Values.masterPassword }} + {{- printf "%d" .Values.masterPassword -}} + {{ else }} + {{ fail "masterPassword not provided" }} + {{ end }} +{{- end -}} + +{{/* + Generate a new password based on masterPassword. The new password is not + random, it is derived from masterPassword, fully qualified chart name and + additional uid provided by the user. This ensures that every time when we + run this function from the same place, with the same password and uid we + get the same results. This allows to avoid password changes while you are + doing upgrade. + + The function can take from one to three arguments (inside a dictionary): + - .dot : environment (.) + - .uid : unique identifier of password to be generated within this particular chart. Use only when you create more than a single password within one chart + - .strength : complexity of derived password. See derivePassword documentation for more details + + Example calls: + + {{ include "common.createPassword" . }} + {{ include "common.createPassword" (dict "dot" . "uid" "mysqlRootPasswd") }} + +*/}} +{{- define "common.createPassword" -}} + {{- $dot := default . .dot -}} + {{- $uid := default "onap" .uid -}} + {{- $strength := default "long" .strength -}} + {{- $mp := include "common.masterPassword" $dot -}} + {{- derivePassword 1 $strength $mp (include "common.fullname" $dot) $uid -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_ingress.tpl b/ric-common/Common-Template/helm/aux-common/templates/_ingress.tpl new file mode 100644 index 0000000..b4afe63 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_ingress.tpl @@ -0,0 +1,84 @@ +{{- define "ingress.config.port" -}} +{{- if .Values.ingress -}} +{{- if or (not .Values.global.ingress.virtualhost) (not .Values.global.ingress.virtualhost.enabled) -}} + - http: + paths: +{{- range .Values.ingress.service }} + - path: {{ printf "/%s" (required "baseaddr" .baseaddr) }} + backend: + serviceName: {{ .name }} + servicePort: {{ .port }} +{{- end -}} +{{- else if .Values.ingress.service -}} +{{- $burl := (required "baseurl" .Values.global.ingress.virtualhost.baseurl) -}} +{{ range .Values.ingress.service }} + - host: {{ printf "%s.%s" (required "baseaddr" .baseaddr) $burl }} + http: + paths: + - backend: + serviceName: {{ .name }} + servicePort: {{ .port }} +{{- end -}} +{{- else -}} + - path: {{ printf "/%s" .Chart.Name }} + backend: + serviceName: {{ .Chart.Name }} + servicePort: {{ .Values.service.externalPort }} +{{- end -}} +{{- end -}} +{{- end -}} + + +{{- define "ingress.config.annotations.ssl" -}} +{{- if .Values.ingress.config -}} +{{- if .Values.ingress.config.ssl -}} +{{- if eq .Values.ingress.config.ssl "redirect" -}} +kubernetes.io/ingress.class: nginx +nginx.ingress.kubernetes.io/ssl-passthrough: "true" +nginx.ingress.kubernetes.io/ssl-redirect: "true" +{{- else if eq .Values.ingress.config.ssl "native" -}} +nginx.ingress.kubernetes.io/ssl-redirect: "true" +{{- else if eq .Values.ingress.config.ssl "none" -}} +nginx.ingress.kubernetes.io/ssl-redirect: "false" +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} + + +{{- define "ingress.config.annotations" -}} +{{- if .Values.ingress -}} +{{- if .Values.ingress.annotations -}} +{{ toYaml .Values.ingress.annotations | indent 4 | trim }} +{{- end -}} +{{- end -}} +{{ include "ingress.config.annotations.ssl" . | indent 4 | trim }} +{{- end -}} + + +{{- define "common.ingress" -}} +{{- if .Values.ingress -}} +{{- if .Values.global.ingress -}} +{{- if and .Values.ingress.enabled .Values.global.ingress.enabled -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ include "common.fullname" . }}-ingress + annotations: + {{ include "ingress.config.annotations" . }} + labels: + app: {{ .Chart.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + rules: + {{ include "ingress.config.port" . | trim }} +{{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} +{{- end -}} \ No newline at end of file diff --git a/ric-common/Common-Template/helm/aux-common/templates/_mariadb.tpl b/ric-common/Common-Template/helm/aux-common/templates/_mariadb.tpl new file mode 100644 index 0000000..15fb5a4 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_mariadb.tpl @@ -0,0 +1,59 @@ +{{/* +# Copyright © 2019 Orange +# +# 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. +*/}} + +{{/* + Choose the name of the mariadb service to use. +*/}} +{{- define "common.mariadbService" -}} + {{- if .Values.global.mariadbGalera.localCluster -}} + {{- index .Values "mariadb-galera" "service" "name" -}} + {{- else -}} + {{- .Values.global.mariadbGalera.service -}} + {{- end -}} +{{- end -}} + +{{/* + Choose the value of mariadb port to use. +*/}} +{{- define "common.mariadbPort" -}} + {{- if .Values.global.mariadbGalera.localCluster -}} + {{- index .Values "mariadb-galera" "service" "internalPort" -}} + {{- else -}} + {{- .Values.global.mariadbGalera.internalPort -}} + {{- end -}} +{{- end -}} + +{{/* + Choose the value of secret to retrieve user value. +*/}} +{{- define "common.mariadbSecret" -}} + {{- if .Values.global.mariadbGalera.localCluster -}} + {{ printf "%s-%s-db-user-credentials" (include "common.fullname" .) (index .Values "mariadb-galera" "nameOverride") -}} + {{- else -}} + {{ printf "%s-%s" (.Release.Name) (index .Values "mariadb-init" "nameOverride") -}} + {{- end -}} +{{- end -}} + +{{/* + Choose the value of secret param to retrieve user value. +*/}} +{{- define "common.mariadbSecretParam" -}} + {{- if .Values.global.mariadbGalera.localCluster -}} + {{ printf "password" -}} + {{- else -}} + {{ printf "db-user-password" -}} + {{- end -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_name.tpl b/ric-common/Common-Template/helm/aux-common/templates/_name.tpl new file mode 100644 index 0000000..f84ca21 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_name.tpl @@ -0,0 +1,41 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# 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. +*/}} + +{{/* + Expand the name of a chart. +*/}} +{{- define "common.name" -}} + {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* + Create a default fully qualified application name. + Truncated at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "common.fullname" -}} + {{- $name := default .Chart.Name .Values.nameOverride -}} + {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* + Retrieve the "original" release from the component release: + if ONAP is deploy with "helm deploy --name toto", then cassandra components + will have "toto-cassandra" as release name. + this function would answer back "toto". +*/}} +{{- define "common.release" -}} + {{- regexReplaceAll "-[a-zA-Z0-9]*$" .Release.Name "" }} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_namespace.tpl b/ric-common/Common-Template/helm/aux-common/templates/_namespace.tpl new file mode 100644 index 0000000..94c9ee7 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_namespace.tpl @@ -0,0 +1,26 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# 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 namespace to apply to a chart. The default namespace suffix + is the name of the chart. This can be overridden if necessary (eg. for subcharts) + using the following value: + + - .Values.nsPrefix : override namespace prefix +*/}} +{{- define "common.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_repository.tpl b/ric-common/Common-Template/helm/aux-common/templates/_repository.tpl new file mode 100644 index 0000000..272db42 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_repository.tpl @@ -0,0 +1,49 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# 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 the common image repository. + The value for .Values.repository is used by default, + unless either override mechanism is used. + + - .Values.global.repository : override default image repository for all images + - .Values.repositoryOverride : override global and default image repository on a per image basis +*/}} +{{- define "common.repository" -}} + {{if .Values.repositoryOverride }} + {{- printf "%s" .Values.repositoryOverride -}} + {{else}} + {{- default .Values.repository .Values.global.repository -}} + {{end}} +{{- end -}} + + +{{/* + Resolve the image repository secret token. + The value for .Values.global.repositoryCred is used: + repositoryCred: + user: user + password: password + mail: email (optional) +*/}} +{{- define "common.repository.secret" -}} + {{- $repo := include "common.repository" . }} + {{- $repo := default "nexus3.onap.org:10001" $repo }} + {{- $cred := .Values.global.repositoryCred }} + {{- $mail := default "@" $cred.mail }} + {{- $auth := printf "%s:%s" $cred.user $cred.password | b64enc }} + {{- printf "{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}" $repo $cred.user $cred.password $mail $auth | b64enc -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_resources.tpl b/ric-common/Common-Template/helm/aux-common/templates/_resources.tpl new file mode 100644 index 0000000..fae7743 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_resources.tpl @@ -0,0 +1,59 @@ +{{- /* +# Copyright © 2018 Amdocs, Bell Canada +# +# 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 the common resource limit/request flavor. + The value for .Values.flavor is used by default, + unless either override mechanism is used. + + - .Values.global.flavor : override default flavor for all charts + - .Values.flavorOverride : override global and default flavor on a per chart basis +*/ -}} +{{- define "common.flavor" -}} + {{if .Values.flavorOverride }} + {{- printf "%s" .Values.flavorOverride -}} + {{else}} + {{- default .Values.flavor .Values.global.flavor -}} + {{end}} +{{- end -}} + +{{- /* + Resolve the resource limit/request flavor using the desired flavor value. + + - .Values.resources : YAML definition of resource limits. The flavor key + is computed based on the common.flavor template and + is used as the selected resource limit through the pluck + e.g: resources: + small: + limits: + cpu: 200m + memory: 4Gi + requests: + cpu: 100m + memory: 1Gi + large: + limits: + cpu: 400m + memory: 8Gi + requests: + cpu: 200m + memory: 2Gi + unlimited: {} +*/ -}} +{{- define "common.resources" -}} +{{- $flavor := include "common.flavor" . -}} +{{- toYaml (pluck $flavor .Values.resources | first) | indent 12 -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_secret.yaml b/ric-common/Common-Template/helm/aux-common/templates/_secret.yaml new file mode 100644 index 0000000..523d788 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_secret.yaml @@ -0,0 +1,276 @@ +{{/* +# Copyright © 2019 AT&T, Samsung Electronics +# +# 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. +*/}} + +{{/* + For internal use only! + + Generates a secret header with given name and desired labels. + + The template takes two arguments: + - .global: environment (.) + - .name: name of the secret + + Example call: + {{ include "common.secret._header" (dict "global" . "name" "myFancyName") }} +*/}} +{{- define "common.secret._header" -}} +{{- $global := .global }} +{{- $name := .name }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ $name }} + namespace: {{ include "common.namespace" $global }} + labels: + app: {{ include "common.name" $global }} + chart: {{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }} + release: {{ $global.Release.Name }} + heritage: {{ $global.Release.Service }} +type: Opaque +{{- end -}} + +{{/* + For internal use only! + + Pick a value based on "user input" and generation policy. + + The template takes below arguments: + - .global: environment (.) + - .secretName: name of the secret where the value will be placed + - .secretEnv: map of values which configures this secret. This can contain below keys: + - value: Value of secret key provided by user (can be a template inside a string) + - policy: What to do if value is missing or empty. Possible options are: + - generate: Generate a new password deriving it from master password + - required: Fail the deployment if value has not been provided + Defaults to generate. + - name: Name of the key to which this value should be assigned +*/}} +{{- define "common.secret._value" -}} + {{- $global := .global }} + {{- $name := .secretName }} + {{- $secretEnv := .secretEnv }} + {{- $value := tpl $secretEnv.value $global }} + {{- $policy := default "generate" $secretEnv.policy }} + + {{- if $value }} + {{- $value | quote }} + {{- else if eq $policy "generate" }} + {{- include "common.createPassword" (dict "dot" $global "uid" $name) | quote }} + {{- else }} + {{- fail (printf "Value for %s secret %s key not provided" $name $secretEnv.name) }} + {{- end }} +{{- end -}} + + +{{/* + For internal use only! + + Generate a secret name based on provided name or UID. + If UID is provided then the name is generated by appending this UID right after + the chart name. If name is provided, it overrides the name generation algorith + and is used right away. Both name and uid strings may contain a template to be + resolved. + + The template takes below arguments: + - .global: environment (.) + - .uid: string that uniquely identifies this secret within a helm chart + - .name: string that can be used to override default name generation algorithm + and provide a custom name for the secret +*/}} +{{- define "common.secret._genName" -}} + {{- $global := .global }} + {{- $uid := tpl (default "" .uid) $global }} + {{- $name := tpl (default "" .name) $global }} + {{- default (printf "%s-%s" (include "common.fullname" $global) $uid) $name }} +{{- end -}} + +{{/* + Get the real secret name by UID or name, based on the configuration provided by user. + User may decide to not create a new secret but reuse existing one for this deployment + (aka externalSecret). In this case the real name of secret to be used is different + than the one declared in secret definition. This easily retrieve current secret real + name based on declared name or UID even if it has been overrided by the user using + externalSecret option. You should use this template always when you need to reference + a secret created using common.secret template by name. + + The template takes below arguments: + - .global: environment (.) + - .uid: string that uniquely identifies this secret within a helm chart + (can be omitted if name has been provided) + - .name: name which was used to declare a secret + (can be omitted if uid has been provided) +*/}} +{{- define "common.secret.getSecretName" -}} + {{- $global := .global }} + {{- $targetName := include "common.secret._genName" (dict "global" $global "uid" .uid "name" .name) }} + {{- range $secret := $global.Values.secrets }} + {{- $currName := include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name) }} + {{- if eq $currName $targetName }} + {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} + {{- default $currName $externalSecret }} + {{- end }} + {{- end }} +{{- end -}} + +{{/* + Convenience template which can be used to easily set the value of environment variable + to the value of a key in a secret. + + It takes care of all name mangling, usage of external secrets etc. + + The template takes below arguments: + - .global: environment (.) + - .uid: string that uniquely identifies this secret within a helm chart + (can be omitted if name has been provided) + - .name: name which was used to declare a secret + (can be omitted if uid has been provided) + - .key: Key within this secret which value should be assigned to this variable + + Example usage: + env: + - name: SECRET_PASSWORD + {{- include "common.secret.envFromSecret" (dict "global" . "uid" "secret" "key" "password") | indent 8}} +*/}} +{{- define "common.secret.envFromSecret" -}} + {{- $key := .key }} +valueFrom: + secretKeyRef: + name: {{ include "common.secret.getSecretName" . }} + key: {{ $key }} +{{- end -}} + +{{/* + Define secrets to be used by chart. + Every secret has a type which is one of: + - generic: + Generic secret template that allows to input some raw data (from files). + File Input can be passed as list of files (filePaths) or as a single string + (filePath) + - genericKV: + Type of secret which allows you to define a list of key value pairs. + The list is assiged to envs value. Every item may define below items: + - name: + Identifier of this value within secret + - value: + String that defines a value associated with given key. + This can be a simple string or a template. + - policy: + Defines what to do if value is not provided by the user. + Available options are: + - generate: + Generate a value by derriving it from master password + - required: + Fail the deployment + - password: + Type of secret that holds only the password. + Only two items can be defined for this type: + - password: + Equivalent of value field from genericKV + - policy: + The same meaning as for genericKV policy field + - basicAuth: + Type of secret that holds both username and password. + Below fields are available: + - login: + The value for login key. + This can be a simple string or a template. + Providing a value for login is always required. + - password: + The value for password key. + This can be a simple string or a template. + - passwordPolicy: + The same meaning as the policy field in genericKV. + Only the policy for password can be set. + + Every secret can be identified using: + - uid: + A string to be appended to the chart fullname to generate a secret name. + - name: + Overrides default secret name generation and allows to set immutable + and globaly unique name + + To allow sharing a secret between the components and allow to pre-deploy secrets + before ONAP deployment it is possible to use already existing secret instead of + creating a new one. For this purpose externalSecret field can be used. If value of + this field is evaluated to true no new secret is created, only the name of the + secret is aliased to the external one. + + Example usage: + secrets.yaml: + {{ include "common.secret" . }} + + values.yaml: + mysqlLogin: "root" + + mysqlExternalSecret: "some-other-secret-name" + + secrets: + - uid: "mysql" + externalSecret: '{{ tpl .Values.passExternalSecret . }}' + type: basicAuth + login: '{{ .Values.mysqlLogin }}' + mysqlPassword: '{{ .Values.mysqlPassword }}' + passwordPolicy: generate + + In the above example new secret is not going to be created. + Already existing one (some-other-secret-name) is going to be used. + To force creating a new one, just make sure that mysqlExternalSecret + is not set. + +*/}} +{{- define "common.secret" -}} + {{- $global := . }} + {{- range $secret := .Values.secrets }} + {{- $name := include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name) }} + {{- $type := default "generic" $secret.type }} + {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} + {{- if not $externalSecret }} +--- + {{ include "common.secret._header" (dict "global" $global "name" $name) }} + + {{- if eq $type "generic" }} +data: + {{- range $curFilePath := $secret.filePaths }} + {{ tpl ($global.Files.Glob $curFilePath).AsSecrets $global | indent 2 }} + {{- end }} + {{- if $secret.filePath }} + {{ tpl ($global.Files.Glob $secret.filePath).AsSecrets $global | indent 2 }} + {{- end }} + {{- else if eq $type "genericKV" }} +stringData: + {{- if $secret.envs }} + {{- range $secretEnv := $secret.envs }} + {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }} + {{ $secretEnv.name }}: {{ include "common.secret._value" $valueDesc }} + {{- end }} + {{- end }} + {{- else if eq $type "password" }} + {{- $secretEnv := (dict "policy" (default "generate" $secret.policy) "name" "password" "value" $secret.password) }} + {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }} +stringData: + password: {{ include "common.secret._value" $valueDesc }} + {{- else if eq $type "basicAuth" }} +stringData: + {{- $secretEnv := (dict "policy" "required" "name" "login" "value" $secret.login) }} + {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }} + login: {{ include "common.secret._value" $valueDesc }} + {{- $secretEnv := (dict "policy" (default "generate" $secret.passwordPolicy) "name" "password" "value" $secret.password) }} + {{- $valueDesc := (dict "global" $global "secretName" $name "secretEnv" $secretEnv) }} + password: {{ include "common.secret._value" $valueDesc }} + {{- end }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/templates/_service.tpl b/ric-common/Common-Template/helm/aux-common/templates/_service.tpl new file mode 100644 index 0000000..77b77d0 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_service.tpl @@ -0,0 +1,31 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# +# 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" -}} + {{- $name := default .Chart.Name .Values.nameOverride -}} + {{- default $name .Values.service.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/ric-common/Common-Template/helm/aux-common/templates/_storageClass.tpl b/ric-common/Common-Template/helm/aux-common/templates/_storageClass.tpl new file mode 100644 index 0000000..8fd1f97 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/templates/_storageClass.tpl @@ -0,0 +1,57 @@ +{{/* +# Copyright © 2019 Amdocs, Bell Canada, Orange +# +# 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. +*/}} + +{{/* + Expand the name of the storage class. + The value "common.fullname"-data is used by default, + unless either override mechanism is used. + + - .Values.global.persistence.storageClass : override default storageClass for all charts + - .Values.persistence.storageClassOverride : override global and default storage class on a per chart basis + - .Values.persistence.storageClass : override default storage class on a per chart basis +*/}} +{{- define "common.storageClass" -}} + {{- if .Values.persistence.storageClassOverride -}} + {{- if ne "-" .Values.persistence.storageClassOverride -}} + {{- printf "%s" .Values.persistence.storageClassOverride -}} + {{- else -}} + {{- $storage_class := "" -}} + {{- printf "%q" $storage_class -}} + {{- end -}} + {{- else -}} + {{- if or .Values.persistence.storageClass .Values.global.persistence.storageClass }} + {{- if ne "-" (default .Values.persistence.storageClass .Values.global.persistence.storageClass) -}} + {{- printf "%s" (default .Values.persistence.storageClass .Values.global.persistence.storageClass) -}} + {{- else -}} + {{- $storage_class := "" -}} + {{- printf "%q" $storage_class -}} + {{- end -}} + {{- else -}} + {{- printf "%s-data" (include "common.fullname" .) -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{/* + Calculate if we need a PV. If a storageClass is provided, then we don't need. +*/}} +{{- define "common.needPV" -}} +{{- if or (or .Values.persistence.storageClassOverride .Values.persistence.storageClass) .Values.global.persistence.storageClass -}} + False +{{- else -}} + True +{{- end -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/aux-common/values.yaml b/ric-common/Common-Template/helm/aux-common/values.yaml new file mode 100644 index 0000000..60788f1 --- /dev/null +++ b/ric-common/Common-Template/helm/aux-common/values.yaml @@ -0,0 +1,20 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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 configuration default values that can be inherited by +# all subcharts. +################################################################# diff --git a/ric-common/Common-Template/helm/ric-common/Chart.yaml b/ric-common/Common-Template/helm/ric-common/Chart.yaml new file mode 100644 index 0000000..56ddffe --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/Chart.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. # +################################################################################ + +apiVersion: v1 +description: Common templates for inclusion in other charts +name: ric-common +version: 3.3.2 diff --git a/ric-common/Common-Template/helm/ric-common/templates/_a1mediator.tpl b/ric-common/Common-Template/helm/ric-common/templates/_a1mediator.tpl new file mode 100644 index 0000000..ec4740f --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_a1mediator.tpl @@ -0,0 +1,66 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.a1mediator" -}} + {{- printf "a1mediator" -}} +{{- end -}} + +{{- define "common.fullname.a1mediator" -}} + {{- $name := ( include "common.name.a1mediator" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.a1mediator" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.kongpath.ric.a1mediator" -}}/a1mediator{{- end -}} + +{{- define "common.servicename.a1mediator.rmr" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.a1mediator.http" -}} + {{- $name := ( include "common.fullname.a1mediator" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.a1mediator.rmr.data" -}}4562{{- end -}} +{{- define "common.serviceport.a1mediator.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.a1mediator.http" -}}10000{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_alarmmanager.tpl b/ric-common/Common-Template/helm/ric-common/templates/_alarmmanager.tpl new file mode 100755 index 0000000..a172e5e --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_alarmmanager.tpl @@ -0,0 +1,81 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.alarmmanager" -}} + {{- printf "alarmmanager" -}} +{{- end -}} + +{{- define "common.fullname.alarmmanager" -}} + {{- $name := ( include "common.name.alarmmanager" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- define "common.kongpath.ric.alarmmanager" -}}/alarmmanager{{- end -}} + +{{- define "common.servicename.alarmmanager.rmr" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.alarmmanager.http" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.alarmmanager.rest" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "service-%s-rest" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.pvname.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "pv-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.pvcname.alarmmanager" -}} + {{- $name := ( include "common.fullname.alarmmanager" . ) -}} + {{- printf "pvc-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.alarmmanager.rmr.data" -}}4560{{- end -}} +{{- define "common.serviceport.alarmmanager.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.alarmmanager.http" -}}8080{{- end -}} +{{- define "common.serviceport.alarmmanager.rest" -}}8088{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_appmgr.tpl b/ric-common/Common-Template/helm/ric-common/templates/_appmgr.tpl new file mode 100644 index 0000000..954ba3d --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_appmgr.tpl @@ -0,0 +1,74 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.appmgr" -}} + {{- printf "appmgr" -}} +{{- end -}} + + +{{- define "common.fullname.appmgr" -}} + {{- $name := ( include "common.name.appmgr" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.serviceaccountname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.kongpath.ric.appmgr" -}}/appmgr{{- end -}} + +{{- define "common.servicename.appmgr.rmr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.appmgr.http" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.secretname.appmgr" -}} + {{- $name := ( include "common.fullname.appmgr" . ) -}} + {{- printf "secret-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.appmgr.rmr.data" -}}4560{{- end -}} +{{- define "common.serviceport.appmgr.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.appmgr.http" -}}8080{{- end -}} + diff --git a/ric-common/Common-Template/helm/ric-common/templates/_chart.tpl b/ric-common/Common-Template/helm/ric-common/templates/_chart.tpl new file mode 100644 index 0000000..54875fd --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_chart.tpl @@ -0,0 +1,20 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + + +{{- define "common.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_context_locator.tpl b/ric-common/Common-Template/helm/ric-common/templates/_context_locator.tpl new file mode 100644 index 0000000..5155dec --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_context_locator.tpl @@ -0,0 +1,37 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + + + + + +{{- define "locate" -}} + {{- $ctx := .ctx }} + {{- $keylist := .keylist }} + {{- $currentkey := first $keylist -}} + {{- $restkeys := rest $keylist -}} + {{- if empty $restkeys -}} + {{- $result := index $ctx $currentkey -}} + {{- if not (empty $result) -}} + {{- $result -}} + {{- end -}} + {{- else -}} + {{- with index $ctx $currentkey }} + {{- $newctx := dict "ctx" . "keylist" $restkeys -}} + {{- include "locate" $newctx -}} + {{- end -}} + {{- end -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_dashboard.tpl b/ric-common/Common-Template/helm/ric-common/templates/_dashboard.tpl new file mode 100644 index 0000000..7193400 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_dashboard.tpl @@ -0,0 +1,59 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.dashboard" -}} + {{- printf "dashboard" -}} +{{- end -}} + + +{{- define "common.fullname.dashboard" -}} + {{- $name := ( include "common.name.dashboard" . ) -}} + {{- $namespace := ( include "common.namespace.aux" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.dashboard" -}} + {{- $name := ( include "common.fullname.dashboard" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.dashboard" -}} + {{- $name := ( include "common.fullname.dashboard" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.dashboard" -}} + {{- $name := ( include "common.fullname.dashboard" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.dashboard" -}} + {{- $name := ( include "common.fullname.dashboard" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.dashboard" -}} + {{- $name := ( include "common.fullname.dashboard" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.dashboard.http" -}} + {{- $name := ( include "common.fullname.dashboard" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.dashboard.http" -}}30080{{- end -}} +{{- define "common.serviceport.dashboard.container" -}}8080{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_dbaas.tpl b/ric-common/Common-Template/helm/ric-common/templates/_dbaas.tpl new file mode 100644 index 0000000..9f3daca --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_dbaas.tpl @@ -0,0 +1,58 @@ +################################################################################ +# Copyright (c) 2020 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.dbaas" -}} + {{- printf "dbaas" -}} +{{- end -}} + +{{- define "common.fullname.dbaas" -}} + {{- $name := ( include "common.name.dbaas" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.statefulsetname.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "statefulset-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.dbaas" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.dbaas.tcp" -}} + {{- $name := ( include "common.fullname.dbaas" . ) -}} + {{- printf "service-%s-tcp" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.dbaas.redis" -}}6379{{- end -}} +{{- define "common.serviceport.dbaas.sentinel" -}}26379{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_docker.tpl b/ric-common/Common-Template/helm/ric-common/templates/_docker.tpl new file mode 100644 index 0000000..62ef171 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_docker.tpl @@ -0,0 +1,63 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.dockerregistry.url" -}} + {{- $defaultregistry := .defaultregistry }} + {{- $keylist := list $.ctx.Chart.Name "registry" -}} + {{- $ctx := dict "ctx" $.ctx.Values "keylist" $keylist -}} + {{- $overrideregistry := include "locate" $ctx -}} + {{- $keylist := list "common" "localregistry" -}} + {{- $ctx := dict "ctx" $.ctx.Values "keylist" $keylist -}} + {{- $localregistry := include "locate" $ctx -}} + {{- if not (empty $overrideregistry) -}} + {{- $overrideregistry -}} + {{- else -}} + {{- if not (empty $localregistry) -}} + {{- $localregistry -}} + {{- else -}} + {{- $defaultregistry -}} + {{- end -}} + {{- end -}} +{{- end -}} + + +{{- define "common.dockerregistry.credential" -}} + {{- $reponame := include "common.dockerregistry.url" . -}} + {{- $postfix := $reponame | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" -}} + {{- printf "secret-%s" $postfix -}} +{{- end -}} + + +{{- define "common.dockerregistry.pullpolicy" -}} + {{- $defaulpullpolicy := .defaultpullpolicy }} + {{- $keylist := list $.ctx.Chart.Name "pullpolicy" -}} + {{- $ctx := dict "ctx" $.ctx.Values "keylist" $keylist -}} + {{- $overridepullpolicy := include "locate" $ctx -}} + {{- $keylist := list "common" "pullpolicy" -}} + {{- $ctx := dict "ctx" $.ctx.Values "keylist" $keylist -}} + {{- $globalpullpolicy := include "locate" $ctx -}} + {{- if not (empty $overridepullpolicy) -}} + {{- $overridepullpolicy -}} + {{- else -}} + {{- if not (empty $globalpullpolicy) -}} + {{- $globalpullpolicy -}} + {{- else -}} + {{- $defaulpullpolicy -}} + {{- end -}} + {{- end -}} +{{- end -}} + + diff --git a/ric-common/Common-Template/helm/ric-common/templates/_e2mgr.tpl b/ric-common/Common-Template/helm/ric-common/templates/_e2mgr.tpl new file mode 100644 index 0000000..5275d28 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_e2mgr.tpl @@ -0,0 +1,66 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.e2mgr" -}} + {{- printf "e2mgr" -}} +{{- end -}} + +{{- define "common.fullname.e2mgr" -}} + {{- $name := ( include "common.name.e2mgr" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "configmap-%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.containername.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.e2mgr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.kongpath.ric.e2mgr" -}}/e2mgr{{- end -}} + +{{- define "common.servicename.e2mgr.rmr" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.e2mgr.http" -}} + {{- $name := ( include "common.fullname.e2mgr" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.e2mgr.rmr.data" -}}3801{{- end -}} +{{- define "common.serviceport.e2mgr.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.e2mgr.http" -}}3800{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_e2term.tpl b/ric-common/Common-Template/helm/ric-common/templates/_e2term.tpl new file mode 100644 index 0000000..5a43161 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_e2term.tpl @@ -0,0 +1,89 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.e2term" -}} + {{- printf "e2term" -}} +{{- end -}} + +{{- define "common.fullname.e2term" -}} + {{- $name := ( include "common.name.e2term" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.deploymentname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "deployment-%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.containername.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.pvname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "pv-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.pvcname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "pvc-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.e2term.rmr" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- define "common.servicename.e2term.sctp" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "service-%s-sctp" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.e2term.http" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.e2term.prometheus" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "service-%s-prometheus" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.serviceport.e2term.rmr.data" -}}38000{{- end -}} +{{- define "common.serviceport.e2term.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.e2term.http" -}}8080{{- end -}} +{{- define "common.serviceport.e2term.sctp" -}}36422{{- end -}} +{{- define "common.serviceport.e2term.prometheus" -}}8088{{- end -}} + + +{{- define "common.serviceaccountname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.ingressname.e2term" -}} + {{- $name := ( include "common.fullname.e2term" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_esreader.tpl b/ric-common/Common-Template/helm/ric-common/templates/_esreader.tpl new file mode 100644 index 0000000..d895ddc --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_esreader.tpl @@ -0,0 +1,60 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + + +{{- define "common.name.esreader" -}} + {{- printf "esreader" -}} +{{- end -}} + + +{{- define "common.fullname.esreader" -}} + {{- $name := ( include "common.name.esreader" . ) -}} + {{- $namespace := ( include "common.namespace.infra" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + +{{- define "common.deploymentname.esreader" -}} + {{- $name := ( include "common.fullname.esreader" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.configmapname.esreader" -}} + {{- $name := ( include "common.fullname.esreader" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.containername.esreader" -}} + {{- $name := ( include "common.fullname.esreader" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.serviceport.esreader.http" -}}8080{{- end -}} + +{{- define "common.pvname.esreader" -}} + {{- $name := ( include "common.fullname.esreader" . ) -}} + {{- printf "pv-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.pvcname.esreader" -}} + {{- $name := ( include "common.fullname.esreader" . ) -}} + {{- printf "pvc-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + diff --git a/ric-common/Common-Template/helm/ric-common/templates/_influxdb.tpl b/ric-common/Common-Template/helm/ric-common/templates/_influxdb.tpl new file mode 100644 index 0000000..c6be83c --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_influxdb.tpl @@ -0,0 +1,57 @@ +################################################################################ +# Copyright (c) 2021 HCL Technologies Limited. # +# # +# 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. # +################################################################################ + +{{- define "common.name.influxdb" -}} + {{- printf "influxdb" -}} +{{- end -}} + +{{- define "common.fullname.influxdb" -}} + {{- $name := ( include "common.name.influxdb" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.influxdb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.influxdb.labels" -}} +helm.sh/chart: {{ include "common.influxdb.chart" . }} +{{ include "common.influxdb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{- define "common.influxdb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "common.name.influxdb" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{- define "common.influxdb.serviceAccountName" -}} + {{- $name := ( include "common.fullname.influxdb" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.influxdb.http" -}}8086{{- end -}} +{{- define "common.serviceport.influxdb.meta.bind_address" -}}8091{{- end -}} +{{- define "common.serviceport.influxdb.http.bind_address" -}}8086{{- end -}} +{{- define "common.serviceport.influxdb.rpc.bind_address" -}}8088{{- end -}} +{{- define "common.serviceport.influxdb.graphite.bind_address" -}}2003{{- end -}} +{{- define "common.serviceport.influxdb.udp.bind_address" -}}8089{{- end -}} +{{- define "common.serviceport.influxdb.opentsdb.bind_address" -}}4242{{- end -}} +{{- define "common.serviceport.influxdb.collectd.bind_address" -}}25826{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_ingress_controller.tpl b/ric-common/Common-Template/helm/ric-common/templates/_ingress_controller.tpl new file mode 100644 index 0000000..e136404 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_ingress_controller.tpl @@ -0,0 +1,71 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.ingresscontroller.url.platform" -}} + {{- $keylist := list "common" "ingresscontroller" "url" "platform" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $url := include "locate" $ctx -}} + {{- if not (empty $url) -}} + {{- $url -}} + {{- else -}} + {{- printf "ric-entry" -}} + {{- end -}} +{{- end -}} + +{{- define "common.ingresscontroller.url.aux" -}} + {{- $keylist := list "common" "ingresscontroller" "url" "aux" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $url := include "locate" $ctx -}} + {{- if not (empty $url) -}} + {{- $url -}} + {{- else -}} + {{- printf "aux-entry" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.ingresscontroller.url.dashboard" -}} + {{- $keylist := list "common" "ingresscontroller" "url" "dashboard" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $url := include "locate" $ctx -}} + {{- if not (empty $url) -}} + {{- $url -}} + {{- else -}} + {{- printf "dashboard-entry" -}} + {{- end -}} +{{- end -}} + +{{- define "common.ingresscontroller.port.http" -}} + {{- $keylist := list "common" "ingresscontroller" "port" "http" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $port := include "locate" $ctx -}} + {{- if not (empty $port) -}} + {{- $port -}} + {{- else -}} + {{- printf "32080" -}} + {{- end -}} +{{- end -}} + +{{- define "common.ingresscontroller.port.https" -}} + {{- $keylist := list "common" "ingresscontroller" "port" "https" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $port := include "locate" $ctx -}} + {{- if not (empty $port) -}} + {{- $port -}} + {{- else -}} + {{- printf "32443" -}} + {{- end -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_jaegeradapter.tpl b/ric-common/Common-Template/helm/ric-common/templates/_jaegeradapter.tpl new file mode 100644 index 0000000..0743710 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_jaegeradapter.tpl @@ -0,0 +1,72 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.jaegeradapter" -}} + {{- printf "jaegeradapter" -}} +{{- end -}} + +{{- define "common.fullname.jaegeradapter" -}} + {{- $name := ( include "common.name.jaegeradapter" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.jaegeradapter" -}} + {{- $name := ( include "common.fullname.jaegeradapter" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.jaegeradapter" -}} + {{- $name := ( include "common.fullname.jaegeradapter" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.jaegeradapter" -}} + {{- $name := ( include "common.fullname.jaegeradapter" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.servicename.jaegeradapter.query" -}} + {{- $name := ( include "common.fullname.jaegeradapter" . ) -}} + {{- printf "service-%s-query" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- define "common.servicename.jaegeradapter.collector" -}} + {{- $name := ( include "common.fullname.jaegeradapter" . ) -}} + {{- printf "service-%s-collector" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- define "common.servicename.jaegeradapter.agent" -}} + {{- $name := ( include "common.fullname.jaegeradapter" . ) -}} + {{- printf "service-%s-agent" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.jaegeradapter.zipkincompact" -}}5775{{- end -}} +{{- define "common.serviceport.jaegeradapter.jaegercompact" -}}6831{{- end -}} +{{- define "common.serviceport.jaegeradapter.jaegerbinary" -}}6832{{- end -}} +{{- define "common.serviceport.jaegeradapter.httpquery" -}}16686{{- end -}} +{{- define "common.serviceport.jaegeradapter.httpconfig" -}}5778{{- end -}} +{{- define "common.serviceport.jaegeradapter.zipkinhttp" -}}9411{{- end -}} +{{- define "common.serviceport.jaegeradapter.jaegerhttp" -}}14268{{- end -}} +{{- define "common.serviceport.jaegeradapter.jaegerhttpt" -}}14267{{- end -}} + +{{- define "common.portname.jaegeradapter.zipkincompact" -}}"zipkincompact"{{- end -}} +{{- define "common.portname.jaegeradapter.jaegercompact" -}}"jaegercompact"{{- end -}} +{{- define "common.portname.jaegeradapter.jaegerbinary" -}}"jaegerbinary"{{- end -}} +{{- define "common.portname.jaegeradapter.zipkinhttp" -}}"zipkinhttp"{{- end -}} +{{- define "common.portname.jaegeradapter.jaegerhttp" -}}"jaegerhttp"{{- end -}} +{{- define "common.portname.jaegeradapter.jaegerhttpt" -}}"jaegerhttpt"{{- end -}} +{{- define "common.portname.jaegeradapter.httpquery" -}}"httpquery"{{- end -}} +{{- define "common.portname.jaegeradapter.httpconfig" -}}"httpconfig"{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_logstash.tpl b/ric-common/Common-Template/helm/ric-common/templates/_logstash.tpl new file mode 100644 index 0000000..7e50e03 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_logstash.tpl @@ -0,0 +1,49 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.logstash" -}} + {{- printf "logstash" -}} +{{- end -}} + + +{{- define "common.fullname.logstash" -}} + {{- $name := ( include "common.name.logstash" . ) -}} + {{- $namespace := ( include "common.namespace.aux" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + +{{- define "common.deploymentname.logstash" -}} + {{- $name := ( include "common.fullname.logstash" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.configmapname.logstash" -}} + {{- $name := ( include "common.fullname.logstash" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.containername.logstash" -}} + {{- $name := ( include "common.fullname.logstash" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.serviceport.logstash.http" -}}8080{{- end -}} +{{- define "common.servicename.logstash.http" -}}logstash{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_messagerouter.tpl b/ric-common/Common-Template/helm/ric-common/templates/_messagerouter.tpl new file mode 100644 index 0000000..ac73f6c --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_messagerouter.tpl @@ -0,0 +1,58 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.messagerouter" -}} + {{- printf "messagerouter" -}} +{{- end -}} + +{{- define "common.fullname.messagerouter" -}} + {{- $name := ( include "common.name.messagerouter" . ) -}} + {{- $namespace := ( include "common.namespace.aux" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.messagerouter" -}} + {{- $name := ( include "common.fullname.messagerouter" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.messagerouter" -}} + {{- $name := ( include "common.fullname.messagerouter" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.messagerouter" -}} + {{- $name := ( include "common.fullname.messagerouter" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.messagerouter" -}} + {{- $name := ( include "common.fullname.messagerouter" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.messagerouter.tcp" -}} + {{- $name := ( include "common.fullname.messagerouter" . ) -}} + {{- printf "service-%s-tcp" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.messagerouter.http" -}}3904{{- end -}} +{{- define "common.serviceport.messagerouter.https" -}}3905{{- end -}} +{{- define "common.serviceport.messagerouter.kafka" -}}9092{{- end -}} +{{- define "common.serviceport.messagerouter.zookeeper" -}}2181{{- end -}} + +{{- define "common.servicename.messagerouter.http" -}}ricaux-messagerouter{{- end -}} + diff --git a/ric-common/Common-Template/helm/ric-common/templates/_mrsub.tpl b/ric-common/Common-Template/helm/ric-common/templates/_mrsub.tpl new file mode 100644 index 0000000..15583d5 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_mrsub.tpl @@ -0,0 +1,48 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + + +{{- define "common.name.mrsub" -}} + {{- printf "mrsub" -}} +{{- end -}} + +{{- define "common.fullname.mrsub" -}} + {{- $name := ( include "common.name.mrsub" . ) -}} + {{- $namespace := ( include "common.namespace.aux" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + +{{- define "common.deploymentname.mrsub" -}} + {{- $name := ( include "common.fullname.mrsub" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.configmapname.mrsub" -}} + {{- $name := ( include "common.fullname.mrsub" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.containername.mrsub" -}} + {{- $name := ( include "common.fullname.mrsub" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.serviceport.mrsub.http" -}}8080{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_namespace.tpl b/ric-common/Common-Template/helm/ric-common/templates/_namespace.tpl new file mode 100644 index 0000000..d2df3ee --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_namespace.tpl @@ -0,0 +1,60 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.namespace.platform" -}} + {{- $keylist := list "common" "namespace" "platform" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $namespace := include "locate" $ctx -}} + {{- if not (empty $namespace) -}} + {{- $namespace -}} + {{- else -}} + {{- printf "ricplt" -}} + {{- end -}} +{{- end -}} + +{{- define "common.namespace.infra" -}} + {{- $keylist := list "common" "namespace" "infra" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $namespace := include "locate" $ctx -}} + {{- if not (empty $namespace) -}} + {{- $namespace -}} + {{- else -}} + {{- printf "ricinfra" -}} + {{- end -}} +{{- end -}} + +{{- define "common.namespace.xapp" -}} + {{- $keylist := list "common" "namespace" "xapp" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $namespace := include "locate" $ctx -}} + {{- if not (empty $namespace) -}} + {{- $namespace -}} + {{- else -}} + {{- printf "ricxapp" -}} + {{- end -}} +{{- end -}} + + +{{- define "common.namespace.aux" -}} + {{- $keylist := list "common" "namespace" "aux" -}} + {{- $ctx := dict "ctx" $.Values "keylist" $keylist -}} + {{- $namespace := include "locate" $ctx -}} + {{- if not (empty $namespace) -}} + {{- $namespace -}} + {{- else -}} + {{- printf "ricaux" -}} + {{- end -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_o1mediator.tpl b/ric-common/Common-Template/helm/ric-common/templates/_o1mediator.tpl new file mode 100644 index 0000000..1abcbe6 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_o1mediator.tpl @@ -0,0 +1,69 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.o1mediator" -}} + {{- printf "o1mediator" -}} +{{- end -}} + +{{- define "common.fullname.o1mediator" -}} + {{- $name := ( include "common.name.o1mediator" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.o1mediator" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.o1mediator" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.o1mediator" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.o1mediator" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.o1mediator" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- define "common.kongpath.ric.o1mediator" -}}/o1mediator{{- end -}} + +{{- define "common.servicename.o1mediator.http" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.o1mediator.tcp.netconf" -}} + {{- $name := ( include "common.fullname.o1mediator" . ) -}} + {{- printf "service-%s-tcp-netconf" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.serviceport.o1mediator.http.supervise" -}}9001{{- end -}} +{{- define "common.serviceport.o1mediator.http.mediation" -}}8080{{- end -}} +{{- define "common.serviceport.o1mediator.http.event" -}}3000{{- end -}} +{{- define "common.serviceport.o1mediator.tcp.netconf" -}}830{{- end -}} + +{{- define "common.nodeport.o1mediator.tcp.netconf" -}}30830{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_rsm.tpl b/ric-common/Common-Template/helm/ric-common/templates/_rsm.tpl new file mode 100644 index 0000000..4fe5d46 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_rsm.tpl @@ -0,0 +1,66 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.rsm" -}} + {{- printf "rsm" -}} +{{- end -}} + +{{- define "common.fullname.rsm" -}} + {{- $name := ( include "common.name.rsm" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.rsm" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.rsm" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.rsm" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.rsm" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.rsm" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.kongpath.ric.rsm" -}}/rsm{{- end -}} + +{{- define "common.servicename.rsm.rmr" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.rsm.http" -}} + {{- $name := ( include "common.fullname.rsm" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.rsm.rmr.data" -}}4801{{- end -}} +{{- define "common.serviceport.rsm.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.rsm.http" -}}4800{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_rtmgr.tpl b/ric-common/Common-Template/helm/ric-common/templates/_rtmgr.tpl new file mode 100644 index 0000000..f3dd2ab --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_rtmgr.tpl @@ -0,0 +1,64 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.rtmgr" -}} + {{- printf "rtmgr" -}} +{{- end -}} + +{{- define "common.fullname.rtmgr" -}} + {{- $name := ( include "common.name.rtmgr" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.rtmgr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.rtmgr.rmr" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.rtmgr.http" -}} + {{- $name := ( include "common.fullname.rtmgr" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.rtmgr.rmr.data" -}}4560{{- end -}} +{{- define "common.serviceport.rtmgr.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.rtmgr.http" -}}3800{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_submgr.tpl b/ric-common/Common-Template/helm/ric-common/templates/_submgr.tpl new file mode 100644 index 0000000..b4b06c1 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_submgr.tpl @@ -0,0 +1,55 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.submgr" -}} + {{- printf "submgr" -}} +{{- end -}} + +{{- define "common.fullname.submgr" -}} + {{- $name := ( include "common.name.submgr" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.submgr" -}} + {{- $name := ( include "common.fullname.submgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.deploymentname.submgr" -}} + {{- $name := ( include "common.fullname.submgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.submgr" -}} + {{- $name := ( include "common.fullname.submgr" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.submgr.rmr" -}} + {{- $name := ( include "common.fullname.submgr" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.submgr.http" -}} + {{- $name := ( include "common.fullname.submgr" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.submgr.rmr.data" -}}4560{{- end -}} +{{- define "common.serviceport.submgr.rmr.route" -}}4561{{- end -}} +{{- define "common.serviceport.submgr.http" -}}3800{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_tiller.tpl b/ric-common/Common-Template/helm/ric-common/templates/_tiller.tpl new file mode 100644 index 0000000..d423c39 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_tiller.tpl @@ -0,0 +1,149 @@ +################################################################################ +# 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. # +################################################################################ + +{{- define "recursiveprinter" -}} + {{- $ctx := .ctx }} + {{- $printkeys := .printkeys }} + {{- $currentkey := first $printkeys -}} + {{- $restkeys := rest $printkeys -}} + {{- if empty $restkeys -}} + {{- $result := index $ctx $currentkey -}} + {{- if not (empty $result) -}} + {{- $result -}} + {{- end -}} + {{- else -}} + {{- with index $ctx $currentkey }} + {{- $newctx := dict "ctx" . "printkeys" $restkeys -}} + {{- include "recursiveprinter" $newctx -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{- define "printer" -}} + {{- $topctx := .ctx }} + {{- if hasKey $topctx.Values "common" }} + {{- if hasKey $topctx.Values.common "tillers" }} + {{- $ctx := index $topctx.Values.common.tillers .key -}} + {{- if not (empty $ctx) -}} + {{- $newctx := dict "ctx" $ctx "printkeys" .printkey -}} + {{- include "recursiveprinter" $newctx -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- end -}} + + + + +{{- define "common.tillerName" -}} + {{- $printkey := list "name" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default "tiller-deploy" (include "printer" $newctx) -}} +{{- end -}} + + +{{- define "common.tillerNameSpace" -}} + {{- $printkey := list "nameSpace" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default "kube-system" (include "printer" $newctx) -}} +{{- end -}} + +{{- define "common.tillerDeployNameSpace" -}} + {{- $printkey := list "deployNameSpace" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default "kube-system" (include "printer" $newctx) -}} +{{- end -}} + + + +{{- define "common.tillerPort" -}} + {{- $printkey := list "port" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default 44134 (include "printer" $newctx) -}} +{{- end -}} + + + + +{{- define "common.tillerTLSVerify" -}} + {{- $printkey := list "tls" "verify" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default false (include "printer" $newctx) -}} +{{- end -}} + + +{{- define "common.tillerTLSAuthenticate" -}} + {{- $printkey := list "tls" "authenticate" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default false (include "printer" $newctx) -}} +{{- end -}} + + +{{- define "common.tillerHelmClientTLSSecret" -}} + {{- $tlsverify := include "common.tillerTLSVerify" . }} + {{- $tlsauthenticate := include "common.tillerTLSAuthenticate" . }} + {{- if or (eq $tlsverify "true") (eq $tlsauthenticate "true") }} + {{- $printkey := list "secret" "helmSecretName" -}} + {{- $newctx := dict "ctx" .ctx "key" .key "printkey" $printkey }} + {{- default "" (include "printer" $newctx) -}} + {{- else -}} + {{- printf "" -}} + {{- end }} +{{- end -}} + + +{{- define "common.serviceaccountname.tiller" -}} + {{- $name := ( include "common.tillerName" . ) -}} + {{- printf "svcacct-tiller-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + + +{{- define "common.deploymentname.tiller" -}} + {{- $name := ( include "common.tillerName" . ) -}} + {{- printf "deployment-tiller-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "common.servicename.tiller" -}} + {{- $topctx := .ctx }} + {{- if hasKey $topctx.Values "common" }} + {{- if hasKey $topctx.Values.common "tillers" }} + {{- $ctx := index $topctx.Values.common.tillers .key -}} + {{- if not (empty $ctx) -}} + {{- if hasKey $ctx "name" -}} + {{- $name := include "common.tillerName" . -}} + {{- printf "service-tiller-%s" $name | trunc 63 | trimSuffix "-" -}} + {{- else -}} + {{ "tiller-deploy" }} + {{- end -}} + {{- else -}} + {{ "tiller-deploy" }} + {{- end -}} + {{- else -}} + {{ "tiller-deploy" }} + {{- end -}} + {{- else -}} + {{ "tiller-deploy" }} + {{- end -}} +{{- end -}} + +{{- define "common.tillerEndpoint" -}} + {{- $servicename := ( include "common.servicename.tiller" . ) -}} + {{- $deploynamespace := ( include "common.tillerDeployNameSpace" . ) -}} + {{- printf "%s.%s" $servicename $deploynamespace -}} +{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_ves.tpl b/ric-common/Common-Template/helm/ric-common/templates/_ves.tpl new file mode 100644 index 0000000..e768551 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_ves.tpl @@ -0,0 +1,66 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.ves" -}} + {{- printf "ves" -}} +{{- end -}} + + +{{- define "common.fullname.ves" -}} + {{- $name := ( include "common.name.ves" . ) -}} + {{- $namespace := ( include "common.namespace.aux" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.ves" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.ves" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.ves" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.ves" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.ves" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.kongpath.aux.vescollector" -}}/vescollector{{- end -}} + +{{- define "common.servicename.ves.http" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.ves.tcp" -}} + {{- $name := ( include "common.fullname.ves" . ) -}} + {{- printf "service-%s-tcp" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.ves.http" -}}8080{{- end -}} +{{- define "common.serviceport.ves.https" -}}8443{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_vespamgr.tpl b/ric-common/Common-Template/helm/ric-common/templates/_vespamgr.tpl new file mode 100644 index 0000000..a1c443d --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_vespamgr.tpl @@ -0,0 +1,53 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.vespamgr" -}} + {{- printf "vespamgr" -}} +{{- end -}} + +{{- define "common.fullname.vespamgr" -}} + {{- $name := ( include "common.name.vespamgr" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.vespamgr" -}} + {{- $name := ( include "common.fullname.vespamgr" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.vespamgr" -}} + {{- $name := ( include "common.fullname.vespamgr" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.vespamgr" -}} + {{- $name := ( include "common.fullname.vespamgr" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.vespamgr.http" -}} + {{- $name := ( include "common.fullname.vespamgr" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.vespamgr.alert" -}} + {{- $name := ( include "common.fullname.vespamgr" . ) -}} + {{- printf "service-%s-alert" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.vespamgr.http" -}}8080{{- end -}} +{{- define "common.serviceport.vespamgr.alert" -}}9095{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/templates/_xapp_onboarder.tpl b/ric-common/Common-Template/helm/ric-common/templates/_xapp_onboarder.tpl new file mode 100644 index 0000000..357f3ea --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/templates/_xapp_onboarder.tpl @@ -0,0 +1,65 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# 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. # +################################################################################ + +{{- define "common.name.xapp-onboarder" -}} + {{- printf "xapp-onboarder" -}} +{{- end -}} + +{{- define "common.fullname.xapp-onboarder" -}} + {{- $name := ( include "common.name.xapp-onboarder" . ) -}} + {{- $namespace := ( include "common.namespace.platform" . ) -}} + {{- printf "%s-%s" $namespace $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.configmapname.xapp-onboarder" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.deploymentname.xapp-onboarder" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.containername.xapp-onboarder" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- define "common.containername.xapp-onboarder.chartmuseum" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "container-%s-chartmuseum" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceaccountname.xapp-onboarder" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "svcacct-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.ingressname.xapp-onboarder" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "ingress-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.servicename.xapp-onboarder.server" -}} + {{- $name := ( include "common.fullname.xapp-onboarder" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.xapp-onboarder.server" -}}8888{{- end -}} +{{- define "common.serviceport.xapp-onboarder.chartmuseum" -}}8080{{- end -}} + +{{- define "common.kongpath.ric.xapp-onboarder" -}}/onboard{{- end -}} +{{- define "common.kongpath.ric.chartmuseum" -}}/helmrepo{{- end -}} diff --git a/ric-common/Common-Template/helm/ric-common/values.yaml b/ric-common/Common-Template/helm/ric-common/values.yaml new file mode 100644 index 0000000..8543211 --- /dev/null +++ b/ric-common/Common-Template/helm/ric-common/values.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. # +################################################################################ + +################################################################# +# Global configuration default values that can be inherited by +# all subcharts. +################################################################# diff --git a/ric-common/Initcontainer/docker/Dockerfile b/ric-common/Initcontainer/docker/Dockerfile new file mode 100644 index 0000000..8acff1b --- /dev/null +++ b/ric-common/Initcontainer/docker/Dockerfile @@ -0,0 +1,36 @@ +####################################################################### +# 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. +######################################################################### +FROM alpine + +MAINTAINER "RIC" + +LABEL name="Generic initcontainer image for RIC Platform components" + +RUN apk update + +# iproute2: required for e2 termination +RUN apk add iproute2 +# kubectl: required for xapp/ricplt helm installers +RUN apk add openssl +# kubectl: required for xapp/ricplt helm installers +ADD https://storage.googleapis.com/kubernetes-release/release/v1.14.1/bin/linux/amd64/kubectl /bin/kubectl +RUN chmod +x /bin/kubectl + +COPY bin/ricplt-init.sh /ricplt-init.sh + +# +CMD /ricplt-init.sh diff --git a/ric-common/Initcontainer/docker/bin/ricplt-init.sh b/ric-common/Initcontainer/docker/bin/ricplt-init.sh new file mode 100755 index 0000000..c16ad95 --- /dev/null +++ b/ric-common/Initcontainer/docker/bin/ricplt-init.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# 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 is placeholder script, intended +# to be overridden by individual RIC +# component charts. +exit 0 diff --git a/ric-common/Initcontainer/docker/container-tag.yaml b/ric-common/Initcontainer/docker/container-tag.yaml new file mode 100644 index 0000000..079c0dc --- /dev/null +++ b/ric-common/Initcontainer/docker/container-tag.yaml @@ -0,0 +1,2 @@ +--- +tag: 0.0.1