From 270fd1248a752ffccb3d2041e47083548f313a62 Mon Sep 17 00:00:00 2001 From: Edyta Krukowska Date: Thu, 15 Apr 2021 12:18:24 +0200 Subject: Create helm chart for netconf server Issue-ID: INT-1869 Signed-off-by: Edyta Krukowska Change-Id: I62277bec37940bd7ebe5cb598b28fee53551ead4 --- helm/netconf/Chart.yaml | 33 ++++++++++++++++++++ helm/netconf/README.md | 23 ++++++++++++++ helm/netconf/templates/_helpers.tpl | 53 ++++++++++++++++++++++++++++++++ helm/netconf/templates/deployment.yaml | 56 ++++++++++++++++++++++++++++++++++ helm/netconf/templates/service.yaml | 16 ++++++++++ helm/netconf/values.yaml | 55 +++++++++++++++++++++++++++++++++ 6 files changed, 236 insertions(+) create mode 100644 helm/netconf/Chart.yaml create mode 100644 helm/netconf/README.md create mode 100644 helm/netconf/templates/_helpers.tpl create mode 100644 helm/netconf/templates/deployment.yaml create mode 100644 helm/netconf/templates/service.yaml create mode 100644 helm/netconf/values.yaml diff --git a/helm/netconf/Chart.yaml b/helm/netconf/Chart.yaml new file mode 100644 index 0000000..348ffaf --- /dev/null +++ b/helm/netconf/Chart.yaml @@ -0,0 +1,33 @@ +apiVersion: v2 +name: netconf-server +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. +appVersion: 1.0.0 +dependencies: + - name: zookeeper + version: 6.7.0 + repository: https://charts.bitnami.com/bitnami + - name: kafka + version: 12.17.2 + repository: https://charts.bitnami.com/bitnami + - name: repositoryGenerator + version: ~8.x-0 + repository: '@local' \ No newline at end of file diff --git a/helm/netconf/README.md b/helm/netconf/README.md new file mode 100644 index 0000000..a8ebd08 --- /dev/null +++ b/helm/netconf/README.md @@ -0,0 +1,23 @@ +# Netconf Server + +# How to deploy on lab + +1. Copy files from helm/netconf to lab + + `scp -i -r /netconf ubuntu@:/netconf ` +2. Log into the RKE + +3. Update helm dependencies + + `cd ./netconf` + `helm dependency update` + +4. Install chart on your lab + + `helm install netconfserver ./netconf -f oom/kubernetes/registry.yaml` + +# How to use netconf + extarnal port to use netconf server is 30555 + + + \ No newline at end of file diff --git a/helm/netconf/templates/_helpers.tpl b/helm/netconf/templates/_helpers.tpl new file mode 100644 index 0000000..1b0ef5c --- /dev/null +++ b/helm/netconf/templates/_helpers.tpl @@ -0,0 +1,53 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "netconf-server.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 "netconf-server.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 "netconf-server.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "netconf-server.labels" -}} +helm.sh/chart: {{ include "netconf-server.chart" . }} +{{ include "netconf-server.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "netconf-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "netconf-server.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + diff --git a/helm/netconf/templates/deployment.yaml b/helm/netconf/templates/deployment.yaml new file mode 100644 index 0000000..15785cd --- /dev/null +++ b/helm/netconf/templates/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "netconf-server.fullname" . }} + labels: + {{- include "netconf-server.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "netconf-server.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "netconf-server.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - env: + - name: KAFKA_HOST_NAME + value: {{ .Values.config.kafka_hostname | quote }} + name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: {{ include "repositoryGenerator.repository" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + livenessProbe: + httpGet: + path: /healthcheck + port: {{ .Values.service.port }} + readinessProbe: + httpGet: + path: /readiness + port: {{ .Values.service.port }} + {{- 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/helm/netconf/templates/service.yaml b/helm/netconf/templates/service.yaml new file mode 100644 index 0000000..e359b81 --- /dev/null +++ b/helm/netconf/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "netconf-server.fullname" . }} + labels: + {{- include "netconf-server.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + nodePort: {{ .Values.service.nodePort }} + protocol: TCP + name: {{ .Values.service.port | quote }} + selector: + {{- include "netconf-server.selectorLabels" . | nindent 4 }} diff --git a/helm/netconf/values.yaml b/helm/netconf/values.yaml new file mode 100644 index 0000000..146cd8a --- /dev/null +++ b/helm/netconf/values.yaml @@ -0,0 +1,55 @@ +# Default values for ves-client. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: /onap/org.onap.integration.nfsimulator.netconfserver + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "netconf-server" + + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: NodePort + port: 6555 + nodePort: 30555 + +resources: {} + +zookeeper: + fullnameOverride: "netconf-server-zookeeper" + auth: + enabled: false + allowAnonymousLogin: true + persistence: + enabled: false + +kafka: + fullnameOverride: "netconf-server-kafka" + zookeeper: + enabled: false + externalZookeeper: + servers: "netconf-server-zookeeper" + persistence: + enabled: false + +config: + kafka_hostname: "netconf-server-kafka" + +nodeSelector: {} + +tolerations: [] + +affinity: {} -- cgit 1.2.3-korg