From d06b3e6b9bb5104c34037029aaa040dc96d48c86 Mon Sep 17 00:00:00 2001 From: Zhe Huang Date: Fri, 28 Jun 2019 10:59:32 -0400 Subject: [PATCH] Modify A1mediator charts to utilize comment template Signed-off-by: Zhe Huang Change-Id: Ib79da18824389809a546786aa6fea11914c53fb7 --- .../helm/a1mediator/requirements.yaml | 20 +++++++ .../helm/a1mediator/templates/_helpers.tpl | 45 ---------------- .../helm/a1mediator/templates/config.yaml | 26 +++++++-- .../helm/a1mediator/templates/deployment.yaml | 51 +++++++++++++----- .../a1mediator/templates/ingress-a1mediator.yaml | 6 +-- .../helm/a1mediator/templates/service-http.yaml | 38 +++++++++++++ .../helm/a1mediator/templates/service-rmr.yaml | 37 +++++++++++++ .../helm/a1mediator/templates/service.yaml | 62 ---------------------- .../templates/tests/test-connection.yaml | 15 ------ .../50-RIC-Platform/helm/a1mediator/values.yaml | 57 ++++++++++++-------- 10 files changed, 193 insertions(+), 164 deletions(-) create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/requirements.yaml delete mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-http.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-rmr.yaml delete mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml delete mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/requirements.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/requirements.yaml new file mode 100644 index 00000000..2ab71b4e --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/requirements.yaml @@ -0,0 +1,20 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +dependencies: + - name: ric-common + version: ~2.0.0 diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl deleted file mode 100644 index fa46babd..00000000 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl +++ /dev/null @@ -1,45 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "a1mediator.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "a1mediator.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "a1mediator.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "a1mediator.labels" -}} -app.kubernetes.io/name: {{ include "a1mediator.name" . }} -helm.sh/chart: {{ include "a1mediator.chart" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml index afac492b..acf2df03 100644 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml @@ -1,12 +1,30 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +--- apiVersion: v1 kind: ConfigMap metadata: - name: a1conf + name: {{ include "common.configmapname.a1mediator" . }}-a1conf data: local.rt: | newrt|start - rte|20000|ADM_CONTROL_GOES_HERE:4563 - rte|20001|{{ .Values.rmrservice.name }}:{{ .Values.rmrservice.port }} + rte|20000|service-ricxapp-admctrl-rmr:4563 + rte|20001|{{ include "common.servicename.a1mediator.rmr" .}}:{{ .Values.a1mediator.service.rmr.port }} newrt|end rmr_string_int_mapping.txt: {{ tpl (.Files.Get "files/rmr_string_int_mapping.txt") . | quote }} - ricmanifest.json: {{ tpl (.Files.Get "files/ricmanifest.json") . | quote }} + ricmanifest.json: {{ tpl (.Files.Get "files/ricmanifest.json") . | quote }} \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml index 7669af84..4eb0110d 100644 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml @@ -1,21 +1,44 @@ +################################################################################ +# 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: apps/v1 kind: Deployment metadata: - name: {{ include "a1mediator.fullname" . }} + name: {{ include "common.deploymentname.a1mediator" . }} + namespace: {{ include "common.namespace" . }} labels: -{{ include "a1mediator.labels" . | indent 4 }} + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} spec: - replicas: {{ .Values.replicaCount }} + replicas: {{ .Values.a1mediator.replicaCount }} selector: matchLabels: - app.kubernetes.io/name: {{ include "a1mediator.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + release: {{ .Release.Name }} template: metadata: labels: - app.kubernetes.io/name: {{ include "a1mediator.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + release: {{ .Release.Name }} spec: + hostname: {{ .Chart.Name }} imagePullSecrets: - name: {{ include "common.repositoryCred" . }} containers: @@ -34,16 +57,18 @@ spec: - name: PYTHONUNBUFFERED value: "0" - name: RMR_RCV_RETRY_INTERVAL - value: "{{ .Values.rmr_timeout_config.rcv_retry_interval_ms }}" + value: "{{ .Values.a1mediator.rmr_timeout_config.rcv_retry_interval_ms }}" - name: RMR_RETRY_TIMES - value: "{{ .Values.rmr_timeout_config.rcv_retry_times }}" + value: "{{ .Values.a1mediator.rmr_timeout_config.rcv_retry_times }}" image: {{ include "common.repository" . }}/{{ .Values.a1mediator.image.name }}:{{ .Values.a1mediator.image.tag }} imagePullPolicy: {{ include "common.pullPolicy" . }} ports: - name: http - containerPort: {{ .Values.httpservice.port }} + containerPort: {{ .Values.a1mediator.service.http.containerPort }} + protocol: TCP + - name: rmr + containerPort: {{ .Values.a1mediator.service.rmr.containerPort }} protocol: TCP - livenessProbe: httpGet: path: /ui @@ -52,9 +77,7 @@ spec: httpGet: path: /ui port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} volumes: - name: "a1conf" configMap: - name: "a1conf" + name: {{ include "common.configmapname.a1mediator" . }}-a1conf \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml index c0658d3c..d7b63abc 100644 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/ingress-a1mediator.yaml @@ -1,12 +1,12 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: ric-ingress-a1mediator + name: {{ include "common.ingressname.a1mediator" . }} spec: rules: - http: paths: - path: /a1mediator backend: - serviceName: {{ include "common.servicename.a1mediator" . }} - servicePort: {{ .Values.httpservice.port }} + serviceName: {{ include "common.servicename.a1mediator.http" . }} + servicePort: {{ .Values.a1mediator.service.http.port }} \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-http.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-http.yaml new file mode 100644 index 00000000..c04f6f36 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-http.yaml @@ -0,0 +1,38 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename.a1mediator.http" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.a1mediator.service.http.port }} + protocol: "TCP" + name: "http" + targetPort: "http" + selector: + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + release: {{ .Release.Name }} + diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-rmr.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-rmr.yaml new file mode 100644 index 00000000..987dde40 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service-rmr.yaml @@ -0,0 +1,37 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "common.servicename.a1mediator.rmr" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.a1mediator.service.rmr.port }} + protocol: "TCP" + name: "rmr" + targetPort: "rmr" + selector: + app: {{ include "common.namespace" . }}-{{ include "common.name" . }} + release: {{ .Release.Name }} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml deleted file mode 100644 index 9f61e861..00000000 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml +++ /dev/null @@ -1,62 +0,0 @@ -# This is the service for A1's external facing HTTP API -apiVersion: v1 -kind: Service -metadata: - name: {{ include "common.servicename.a1mediator" . }} - labels: - app.kubernetes.io/name: {{ include "common.fullname.a1mediator" . }} - helm.sh/chart: {{ include "common.chart" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - {{- if .Chart.AppVersion }} - app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} - {{- end }} - app.kubernetes.io/managed-by: {{ .Release.Service }} - -spec: - type: {{ .Values.httpservice.type }} - ports: - - port: {{ .Values.httpservice.port }} - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: {{ include "a1mediator.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - ---- -# This is the service for rmr between A1 and the xapps -apiVersion: v1 -kind: Service -metadata: - name: {{ .Values.rmrservice.name }} - labels: -{{ include "a1mediator.labels" . | indent 4 }} - -spec: - type: {{ .Values.rmrservice.type }} - ports: - - port: {{ .Values.rmrservice.port }} - targetPort: {{ .Values.rmrservice.port }} - protocol: TCP - selector: - app.kubernetes.io/name: {{ include "a1mediator.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - ---- -# This is the service for the "hidden" port 4561 that rmr listens on for route manager -apiVersion: v1 -kind: Service -metadata: - name: {{ .Values.rmrrtemgrservice.name }} - labels: -{{ include "a1mediator.labels" . | indent 4 }} - -spec: - type: {{ .Values.rmrrtemgrservice.type }} - ports: - - port: {{ .Values.rmrrtemgrservice.port }} - targetPort: {{ .Values.rmrrtemgrservice.port }} - protocol: TCP - selector: - app.kubernetes.io/name: {{ include "a1mediator.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml deleted file mode 100644 index ca683685..00000000 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "a1mediator.fullname" . }}-test-connection" - labels: -{{ include "a1mediator.labels" . | indent 4 }} - annotations: - "helm.sh/hook": test-success -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "a1mediator.fullname" . }}:{{ .Values.httpservice.port }}'] - restartPolicy: Never diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml index d6aed57a..d09cb189 100644 --- a/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml @@ -1,32 +1,47 @@ +################################################################################ +# 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. # +################################################################################ + +################################################################# +# Application configuration defaults. +################################################################# +# application image + +repository: "nexus3.o-ran-sc.org:10004" +imagePullPolicy: IfNotPresent +repositoryCred: docker-reg-cred + a1mediator: replicaCount: 1 image: - repository: nexus3.o-ran-sc.org:10004 name: ric-plt-a1 tag: 0.8.2 - pullPolicy: IfNotPresent - - -# This is the service for A1's external facing HTTP API -httpservice: - port: 10000 # This is hardcoded in a1, probably dangerous to change - type: ClusterIP -# This is the service for rmr between A1 and the xapps -rmrservice: - name: rmrservice - port: 4562 # This is hardcoded in a1, probably dangerous to change - type: ClusterIP + service: + http: + port: 10000 + containerPort: 10000 + rmr: + port: 4562 + containerPort: 4562 -# This is the service for the "hidden" port 4561 that rmr listens on for route manager -rmrrtemgrservice: - name: rmrrtemgrservice - port: 4561 # This is hardcoded in rmr, probably dangerous to change - type: ClusterIP # these are ENV variables that A1 takes; see docs -rmr_timeout_config: - rcv_retry_interval_ms: 500 - rcv_retry_times: 20 + rmr_timeout_config: + rcv_retry_interval_ms: 500 + rcv_retry_times: 20 -- 2.16.6