X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=xapp_onboarder%2Fxapp_onboarder%2Fresources%2Fxapp-std%2Ftemplates%2F_helpers.tpl;fp=xapp_onboarder%2Fxapp_onboarder%2Fresources%2Fxapp-std%2Ftemplates%2F_helpers.tpl;h=d117edb776b68bba1db826e8c161951263cc6437;hb=3b56acc14a2308e853612e22738cd44687288149;hp=0000000000000000000000000000000000000000;hpb=96a85f952452bf2efd606dcc52f86250f7da29a0;p=it%2Fdev.git diff --git a/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/_helpers.tpl b/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/_helpers.tpl new file mode 100644 index 0000000..d117edb --- /dev/null +++ b/xapp_onboarder/xapp_onboarder/resources/xapp-std/templates/_helpers.tpl @@ -0,0 +1,79 @@ +################################################################################ +# 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. # +################################################################################ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ricxapp.name" -}} + {{- default .Chart.Name .Values.name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "ricxapp.fullname" -}} + {{- $name := ( include "ricxapp.name" . ) -}} + {{- $fullname := ( printf "%s-%s" .Release.Namespace $name ) -}} + {{- default $fullname .Values.fullname | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "ricxapp.chart" -}} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} + + + +{{- define "ricxapp.servicename.rmr" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "service-%s-rmr" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.servicename.http" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "service-%s-http" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.configmapname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.deploymentname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.containername" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.imagepullsecret" -}} + {{- $reponame := .repo -}} + {{- $postfix := $reponame | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" -}} + {{- printf "secret-%s" $postfix -}} +{{- end -}} \ No newline at end of file