From 9261cb42473e94facab531786237924c283cfc1c Mon Sep 17 00:00:00 2001 From: RehanRaza Date: Mon, 30 Mar 2020 11:48:10 +0200 Subject: [PATCH] Add helm chart for nonrtric Controlpanel Change-Id: I75e3f5112758d1474ec44e6f697cd8777a825bbc Issue-ID: NONRTRIC-175 Signed-off-by: RehanRaza --- nonrtric/helm/controlpanel/.helmignore | 22 ++++++++ nonrtric/helm/controlpanel/Chart.yaml | 21 +++++++ .../controlpanel/resources/application.properties | 24 ++++++++ .../helm/controlpanel/templates/_controlpanel.tpl | 32 +++++++++++ .../helm/controlpanel/templates/configmap.yaml | 28 ++++++++++ .../helm/controlpanel/templates/deployment.yaml | 64 ++++++++++++++++++++++ nonrtric/helm/controlpanel/templates/service.yaml | 36 ++++++++++++ nonrtric/helm/controlpanel/values.yaml | 28 ++++++++++ 8 files changed, 255 insertions(+) create mode 100644 nonrtric/helm/controlpanel/.helmignore create mode 100644 nonrtric/helm/controlpanel/Chart.yaml create mode 100644 nonrtric/helm/controlpanel/resources/application.properties create mode 100644 nonrtric/helm/controlpanel/templates/_controlpanel.tpl create mode 100644 nonrtric/helm/controlpanel/templates/configmap.yaml create mode 100644 nonrtric/helm/controlpanel/templates/deployment.yaml create mode 100644 nonrtric/helm/controlpanel/templates/service.yaml create mode 100644 nonrtric/helm/controlpanel/values.yaml diff --git a/nonrtric/helm/controlpanel/.helmignore b/nonrtric/helm/controlpanel/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/nonrtric/helm/controlpanel/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/nonrtric/helm/controlpanel/Chart.yaml b/nonrtric/helm/controlpanel/Chart.yaml new file mode 100644 index 00000000..8d960dcf --- /dev/null +++ b/nonrtric/helm/controlpanel/Chart.yaml @@ -0,0 +1,21 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for nonrtric controlpanel +name: controlpanel +version: 1.0.0 diff --git a/nonrtric/helm/controlpanel/resources/application.properties b/nonrtric/helm/controlpanel/resources/application.properties new file mode 100644 index 00000000..9c42bba0 --- /dev/null +++ b/nonrtric/helm/controlpanel/resources/application.properties @@ -0,0 +1,24 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ +server.port = 8080 +policycontroller.url.prefix = http://policymanagementservice:8081 +userfile = users.json +portalapi.decryptor = org.oransc.portal.nonrtric.controlpanel.portalapi.PortalSdkDecryptorAes +portalapi.usercookie = UserId +portalapi.security = false +portalapi.appname = Non-RT RIC Control Panel +portalapi.username = Default +portalapi.password = password diff --git a/nonrtric/helm/controlpanel/templates/_controlpanel.tpl b/nonrtric/helm/controlpanel/templates/_controlpanel.tpl new file mode 100644 index 00000000..c8efba33 --- /dev/null +++ b/nonrtric/helm/controlpanel/templates/_controlpanel.tpl @@ -0,0 +1,32 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +{{- define "common.name.controlpanel" -}} + {{- printf "controlpanel" -}} +{{- end -}} + +{{- define "common.namespace.nonrtric" -}} + {{- printf "nonrtric" -}} +{{- end -}} + +{{- define "common.containername.controlpanel" -}} + {{- $name := ( include "common.name.controlpanel" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "common.serviceport.controlpanel.http" -}}30090{{- end -}} + +{{- define "common.serviceport.controlpanel.container" -}}8080{{- end -}} \ No newline at end of file diff --git a/nonrtric/helm/controlpanel/templates/configmap.yaml b/nonrtric/helm/controlpanel/templates/configmap.yaml new file mode 100644 index 00000000..e351ce97 --- /dev/null +++ b/nonrtric/helm/controlpanel/templates/configmap.yaml @@ -0,0 +1,28 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.name.controlpanel" . }}-configmap + namespace: {{ include "common.namespace.nonrtric" . }} + labels: + app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: +{{ tpl (.Files.Glob "resources/*").AsConfig . | indent 2 }} \ No newline at end of file diff --git a/nonrtric/helm/controlpanel/templates/deployment.yaml b/nonrtric/helm/controlpanel/templates/deployment.yaml new file mode 100644 index 00000000..023c4463 --- /dev/null +++ b/nonrtric/helm/controlpanel/templates/deployment.yaml @@ -0,0 +1,64 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +kind: Deployment +apiVersion: apps/v1 +metadata: + name: {{ include "common.name.controlpanel" . }} + namespace: {{ include "common.namespace.nonrtric" . }} + generation: 1 + labels: + app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + deployment.kubernetes.io/revision: '1' +spec: + replicas: {{ .Values.controlpanel.replicaCount }} + selector: + matchLabels: + app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }} + release: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }} + release: {{ .Release.Name }} + spec: + hostname: {{ include "common.name.controlpanel" . }} + containers: + - name: {{ include "common.containername.controlpanel" . }} + image: {{ .Values.controlpanel.image.registry }}/{{ .Values.controlpanel.image.name }}:{{ .Values.controlpanel.image.tag }} + imagePullPolicy: {{ .Values.controlpanel.imagePullPolicy }} + ports: + - name: http + containerPort: {{ include "common.serviceport.controlpanel.container" . }} + protocol: TCP + volumeMounts: + - name: configmap + mountPath: /maven/application.properties + subPath: application.properties + readOnly: true + readinessProbe: + tcpSocket: + port: {{ include "common.serviceport.controlpanel.container" . }} + initialDelaySeconds: 15 + periodSeconds: 15 + volumes: + - name: configmap + configMap: + name: {{ include "common.name.controlpanel" . }}-configmap \ No newline at end of file diff --git a/nonrtric/helm/controlpanel/templates/service.yaml b/nonrtric/helm/controlpanel/templates/service.yaml new file mode 100644 index 00000000..e031ea63 --- /dev/null +++ b/nonrtric/helm/controlpanel/templates/service.yaml @@ -0,0 +1,36 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +kind: Service +apiVersion: v1 +metadata: + name: {{ include "common.name.controlpanel" . }} + namespace: {{ include "common.namespace.nonrtric" . }} + labels: + app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: NodePort + ports: + - port: {{ include "common.serviceport.controlpanel.container" . }} + nodePort: {{ include "common.serviceport.controlpanel.http" . }} + protocol: TCP + targetPort: http + selector: + app: {{ include "common.namespace.nonrtric" . }}-{{ include "common.name.controlpanel" . }} + release: {{ .Release.Name }} \ No newline at end of file diff --git a/nonrtric/helm/controlpanel/values.yaml b/nonrtric/helm/controlpanel/values.yaml new file mode 100644 index 00000000..be16a156 --- /dev/null +++ b/nonrtric/helm/controlpanel/values.yaml @@ -0,0 +1,28 @@ +################################################################################ +# Copyright (c) 2020 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +# Default values for controlpanel. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +controlpanel: + imagePullPolicy: IfNotPresent + # image registry and tag to be changed after first release of controlpanel + image: + registry: "nexus3.o-ran-sc.org:10004/o-ran-sc" + name: nonrtric-controlpanel + tag: 1.0.0 + replicaCount: 1 \ No newline at end of file -- 2.16.6