From 63e6b8666b65f40b7c65d60af33877db81260511 Mon Sep 17 00:00:00 2001 From: RehanRaza Date: Thu, 16 Dec 2021 11:50:59 +0100 Subject: [PATCH] Add a standalone helm chart for ODU slice assurance app This helm chart is needed when the app is instantiated via control loop. The kubernetes-participant that will deploy the app needs to run "helm install" command with this chart. Change-Id: If849de755c1ec5086ec0df2489c4c23d9ef3580a Issue-ID: NONRTRIC-692 Signed-off-by: RehanRaza --- .../goversion/helm/odu-app/.helmignore | 23 +++++++ .../goversion/helm/odu-app/Chart.yaml | 39 +++++++++++ .../goversion/helm/odu-app/templates/_helpers.tpl | 79 ++++++++++++++++++++++ .../helm/odu-app/templates/deployment.yaml | 72 ++++++++++++++++++++ .../goversion/helm/odu-app/templates/service.yaml | 30 ++++++++ .../goversion/helm/odu-app/values.yaml | 72 ++++++++++++++++++++ 6 files changed, 315 insertions(+) create mode 100644 test/usecases/odusliceassurance/goversion/helm/odu-app/.helmignore create mode 100644 test/usecases/odusliceassurance/goversion/helm/odu-app/Chart.yaml create mode 100644 test/usecases/odusliceassurance/goversion/helm/odu-app/templates/_helpers.tpl create mode 100644 test/usecases/odusliceassurance/goversion/helm/odu-app/templates/deployment.yaml create mode 100644 test/usecases/odusliceassurance/goversion/helm/odu-app/templates/service.yaml create mode 100644 test/usecases/odusliceassurance/goversion/helm/odu-app/values.yaml diff --git a/test/usecases/odusliceassurance/goversion/helm/odu-app/.helmignore b/test/usecases/odusliceassurance/goversion/helm/odu-app/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/test/usecases/odusliceassurance/goversion/helm/odu-app/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/test/usecases/odusliceassurance/goversion/helm/odu-app/Chart.yaml b/test/usecases/odusliceassurance/goversion/helm/odu-app/Chart.yaml new file mode 100644 index 00000000..56ac8879 --- /dev/null +++ b/test/usecases/odusliceassurance/goversion/helm/odu-app/Chart.yaml @@ -0,0 +1,39 @@ +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# 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. +# ============LICENSE_END================================================= + +apiVersion: v1 +name: odu-app +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/_helpers.tpl b/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/_helpers.tpl new file mode 100644 index 00000000..0220d2e2 --- /dev/null +++ b/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/_helpers.tpl @@ -0,0 +1,79 @@ +{{/* +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# 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. +# ============LICENSE_END================================================= +*/}} + +{{/* +Expand the name of the chart. +*/}} +{{- define "odu-app.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 "odu-app.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 "odu-app.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "odu-app.labels" -}} +helm.sh/chart: {{ include "odu-app.chart" . }} +{{ include "odu-app.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "odu-app.selectorLabels" -}} +app.kubernetes.io/name: {{ include "odu-app.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "odu-app.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "odu-app.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/deployment.yaml b/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/deployment.yaml new file mode 100644 index 00000000..d9661e40 --- /dev/null +++ b/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/deployment.yaml @@ -0,0 +1,72 @@ +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# 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. +# ============LICENSE_END================================================= + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "odu-app.fullname" . }} + labels: + {{- include "odu-app.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "odu-app.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "odu-app.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: MR_HOST + value: "{{ .Values.messagerouter.host }}" + - name: MR_PORT + value: "{{ .Values.messagerouter.port }}" + - name: SDNR_ADDRESS + value: "{{ .Values.sdnr.address }}" + ports: + - name: http + containerPort: 80 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/service.yaml b/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/service.yaml new file mode 100644 index 00000000..6c64790d --- /dev/null +++ b/test/usecases/odusliceassurance/goversion/helm/odu-app/templates/service.yaml @@ -0,0 +1,30 @@ +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# 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. +# ============LICENSE_END================================================= + +apiVersion: v1 +kind: Service +metadata: + name: {{ include "odu-app.fullname" . }} + labels: + {{- include "odu-app.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "odu-app.selectorLabels" . | nindent 4 }} diff --git a/test/usecases/odusliceassurance/goversion/helm/odu-app/values.yaml b/test/usecases/odusliceassurance/goversion/helm/odu-app/values.yaml new file mode 100644 index 00000000..f36dca92 --- /dev/null +++ b/test/usecases/odusliceassurance/goversion/helm/odu-app/values.yaml @@ -0,0 +1,72 @@ +# Copyright (C) 2021 Nordix Foundation. All rights reserved. +# ======================================================================== +# 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. +# ============LICENSE_END================================================= + +# Default values for odu-app. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: odu-app + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +messagerouter: + host: http://dmaap-mr + port: 3904 + +sdnr: + address: http://sdnr-simulator:9990 + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} -- 2.16.6