From eb58efec7dd82f97b9d5f5e47052149cca0405c9 Mon Sep 17 00:00:00 2001 From: Tomasz Pietruszkiewicz Date: Wed, 14 Apr 2021 13:31:56 +0200 Subject: ves-client helm chart Change-Id: I960ce9566a9871179cfc7c5a072bbeedf6c7e26f Issue-ID: INT-1869 Signed-off-by: Tomasz Pietruszkiewicz --- helm/ves-client/Chart.yaml | 34 ++++++++++++++++ helm/ves-client/README.md | 23 +++++++++++ helm/ves-client/resources/cert.p12 | Bin 0 -> 2685 bytes helm/ves-client/resources/p12.pass | 1 + helm/ves-client/resources/trust.jks | Bin 0 -> 1455 bytes helm/ves-client/resources/truststore.pass | 1 + helm/ves-client/templates/_helpers.tpl | 53 +++++++++++++++++++++++++ helm/ves-client/templates/configmap.yaml | 11 ++++++ helm/ves-client/templates/deployment.yaml | 63 ++++++++++++++++++++++++++++++ helm/ves-client/templates/service.yaml | 15 +++++++ helm/ves-client/values.yaml | 54 +++++++++++++++++++++++++ 11 files changed, 255 insertions(+) create mode 100644 helm/ves-client/Chart.yaml create mode 100644 helm/ves-client/README.md create mode 100644 helm/ves-client/resources/cert.p12 create mode 100644 helm/ves-client/resources/p12.pass create mode 100644 helm/ves-client/resources/trust.jks create mode 100644 helm/ves-client/resources/truststore.pass create mode 100644 helm/ves-client/templates/_helpers.tpl create mode 100644 helm/ves-client/templates/configmap.yaml create mode 100644 helm/ves-client/templates/deployment.yaml create mode 100644 helm/ves-client/templates/service.yaml create mode 100644 helm/ves-client/values.yaml diff --git a/helm/ves-client/Chart.yaml b/helm/ves-client/Chart.yaml new file mode 100644 index 0000000..1629944 --- /dev/null +++ b/helm/ves-client/Chart.yaml @@ -0,0 +1,34 @@ +apiVersion: v2 +name: ves-client +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.1 +dependencies: + - name: mongodb + version: 10.x + repository: https://charts.bitnami.com/bitnami + condition: mongodb.enabled + - name: mongo-express + version: 2.x + repository: https://cowboysysop.github.io/charts/ + - name: repositoryGenerator + version: ~8.x-0 + repository: '@local' diff --git a/helm/ves-client/README.md b/helm/ves-client/README.md new file mode 100644 index 0000000..d565f03 --- /dev/null +++ b/helm/ves-client/README.md @@ -0,0 +1,23 @@ +# Ves-client + +# How to deploy on lab + +1. Copy files from helm/ves-client to lab + + `scp -i -r /ves-client ubuntu@:/ves-client ` +2. Log into the RKE + +3. Update helm dependencies + + `cd ./ves-client` + `helm dependency update` + +4. Install chart on your lab + + `helm install ves-client ./ves-client -f oom/kubernetes/registry.yaml` + +# How to use ves-client + + + + \ No newline at end of file diff --git a/helm/ves-client/resources/cert.p12 b/helm/ves-client/resources/cert.p12 new file mode 100644 index 0000000..0bbec38 Binary files /dev/null and b/helm/ves-client/resources/cert.p12 differ diff --git a/helm/ves-client/resources/p12.pass b/helm/ves-client/resources/p12.pass new file mode 100644 index 0000000..25acfbf --- /dev/null +++ b/helm/ves-client/resources/p12.pass @@ -0,0 +1 @@ +collector \ No newline at end of file diff --git a/helm/ves-client/resources/trust.jks b/helm/ves-client/resources/trust.jks new file mode 100644 index 0000000..e90b710 Binary files /dev/null and b/helm/ves-client/resources/trust.jks differ diff --git a/helm/ves-client/resources/truststore.pass b/helm/ves-client/resources/truststore.pass new file mode 100644 index 0000000..25acfbf --- /dev/null +++ b/helm/ves-client/resources/truststore.pass @@ -0,0 +1 @@ +collector \ No newline at end of file diff --git a/helm/ves-client/templates/_helpers.tpl b/helm/ves-client/templates/_helpers.tpl new file mode 100644 index 0000000..1d8fd9f --- /dev/null +++ b/helm/ves-client/templates/_helpers.tpl @@ -0,0 +1,53 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ves-client.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 "ves-client.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 "ves-client.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ves-client.labels" -}} +helm.sh/chart: {{ include "ves-client.chart" . }} +{{ include "ves-client.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ves-client.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ves-client.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + diff --git a/helm/ves-client/templates/configmap.yaml b/helm/ves-client/templates/configmap.yaml new file mode 100644 index 0000000..4717c38 --- /dev/null +++ b/helm/ves-client/templates/configmap.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Chart.Name }}-configmap +binaryData: + {{- $files := .Files }} + {{- range $key, $value := .Files }} + {{- if hasPrefix "resources/" $key }} + {{ $key | trimPrefix "resources/" }}: {{ $files.Get $key | b64enc | quote }} + {{- end }} + {{- end }} diff --git a/helm/ves-client/templates/deployment.yaml b/helm/ves-client/templates/deployment.yaml new file mode 100644 index 0000000..d635c69 --- /dev/null +++ b/helm/ves-client/templates/deployment.yaml @@ -0,0 +1,63 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ves-client.fullname" . }} + labels: + {{- include "ves-client.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "ves-client.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ves-client.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - env: + - name: MONGO_HOSTNAME + value: {{ .Values.config.mongoDbServer | quote }} + - name: USE_CERTIFICATE_FOR_AUTHORIZATION + value: {{ .Values.config.useCertForAuth | 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 }} + ports: + - containerPort: {{ .Values.config.containerPort }} + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: store-map + mountPath: {{ .Values.storeMap.directory }} + volumes: + - name: store-map + configMap: + name: {{ .Chart.Name }}-configmap + defaultMode: 0755 + {{- 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/ves-client/templates/service.yaml b/helm/ves-client/templates/service.yaml new file mode 100644 index 0000000..ad67f9b --- /dev/null +++ b/helm/ves-client/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ves-client.fullname" . }} + labels: + {{- include "ves-client.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: {{ .Values.service.port | quote }} + selector: + {{- include "ves-client.selectorLabels" . | nindent 4 }} diff --git a/helm/ves-client/values.yaml b/helm/ves-client/values.yaml new file mode 100644 index 0000000..c5a8391 --- /dev/null +++ b/helm/ves-client/values.yaml @@ -0,0 +1,54 @@ +# 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.vesclient + pullPolicy: IfNotPresent + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "ves-client" +config: + mongoDbServer: ves-client-mongodb + useCertForAuth: true + containerPort: 5000 + +storeMap: + directory: "/app/store" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +service: + type: NodePort + port: 5000 + +resources: {} + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +mongo-express: + fullnameOverride: "ves-client-mongo-express" + mongodbServer: ves-client-mongodb + nameOverride: mongo-express + mongodbAdminPassword: zXcVbN123! + +mongodb: + fullnameOverride: "ves-client-mongodb" + persistence: + enabled: false + auth: + rootPassword: zXcVbN123! + database: pnf_simulator + username: root -- cgit 1.2.3-korg