mirror of
https://github.com/Telecominfraproject/wlan-cloud-rrm.git
synced 2025-10-29 09:42:22 +00:00
[WIFI-9155] Add: helm chart (#6)
* [WIFI-9155] Add: helm chart Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com> * [WIFI-9155] Del: default helm values Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
This commit is contained in:
3
helm/.gitignore
vendored
Normal file
3
helm/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.swp
|
||||
charts
|
||||
Chart.lock
|
||||
0
helm/.gitkeep
Normal file
0
helm/.gitkeep
Normal file
22
helm/.helmignore
Normal file
22
helm/.helmignore
Normal file
@@ -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/
|
||||
10
helm/Chart.yaml
Normal file
10
helm/Chart.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
apiVersion: v2
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: owrrm
|
||||
version: 0.1.0
|
||||
dependencies:
|
||||
- name: mysql
|
||||
repository: https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral-helm/
|
||||
version: 8.8.3
|
||||
condition: mysql.enabled
|
||||
84
helm/README.md
Normal file
84
helm/README.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# owrrm
|
||||
|
||||
This Helm chart helps to deploy OpenWIFI radio resource management service (further on refered as __RRM__) to the Kubernetes clusters. It is mainly used in [assembly chart](https://github.com/Telecominfraproject/wlan-cloud-ucentral-deploy/tree/main/chart) as Gateway requires other services as dependencies that are considered in that Helm chart. This chart is purposed to define deployment logic close to the application code itself and define default values that could be overriden during deployment.
|
||||
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```bash
|
||||
$ helm install .
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps the RRM on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
Currently this chart is not assembled in charts archives, so [helm-git](https://github.com/aslafy-z/helm-git) is required for remote the installation
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release git+https://github.com/Telecominfraproject/wlan-cloud-rrm@helm/owrrm-0.1.0.tgz?ref=main
|
||||
```
|
||||
|
||||
The command deploys the RRM on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```bash
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the chart and their default values. If Default value is not listed in the table, please refer to the [Values](values.yaml) files for details.
|
||||
|
||||
| Parameter | Type | Description | Default |
|
||||
|-----------|------|-------------|---------|
|
||||
| replicaCount | number | Amount of replicas to be deployed | `1` |
|
||||
| strategyType | string | Application deployment strategy | `'RollingUpdate'` |
|
||||
| nameOverride | string | Override to be used for application deployment | |
|
||||
| fullnameOverride | string | Override to be used for application deployment (has priority over nameOverride) | |
|
||||
| images.owrrm.repository | string | Docker image repository | |
|
||||
| images.owrrm.tag | string | Docker image tag | `'main'` |
|
||||
| images.owrrm.pullPolicy | string | Docker image pull policy | `'Always'` |
|
||||
| services.owrrm.type | string | OpenWIFI RRM service type | `'ClusterIP'` |
|
||||
| services.owrrm.ports.http.servicePort | number | Websocket endpoint port to be exposed on service | `16789` |
|
||||
| services.owrrm.ports.http.targetPort | number | Websocket endpoint port to be targeted by service | `16789` |
|
||||
| services.owrrm.ports.http.protocol | string | Websocket endpoint protocol | `'TCP'` |
|
||||
| checks.owrrm.liveness.httpGet.path | string | Liveness check path to be used | `'/'` |
|
||||
| checks.owrrm.liveness.httpGet.port | number | Liveness check port to be used (should be pointint to ALB endpoint) | `16789` |
|
||||
| checks.owrrm.readiness.httpGet.path | string | Readiness check path to be used | `'/'` |
|
||||
| checks.owrrm.readiness.httpGet.port | number | Readiness check port to be used (should be pointint to ALB endpoint) | `16789` |
|
||||
| ingresses.http.enabled | boolean | Defines if REST API endpoint should be exposed via Ingress controller | `False` |
|
||||
| ingresses.http.hosts | array | List of hosts for exposed REST API | |
|
||||
| ingresses.http.paths | array | List of paths to be exposed for REST API | |
|
||||
| public_env_variables | hash | Defines list of environment variables to be passed to the RRM, used for service configuration | |
|
||||
| secret_env_variables | hash | Defines list of environment variables to be passed to the RRM (stored in Kubernetes secrets) | |
|
||||
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release \
|
||||
--set replicaCount=1 \
|
||||
.
|
||||
```
|
||||
|
||||
The above command sets that only 1 instance of your app should be running
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release -f values.yaml .
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml) as a base for customization.
|
||||
32
helm/templates/_helpers.tpl
Normal file
32
helm/templates/_helpers.tpl
Normal file
@@ -0,0 +1,32 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "owrrm.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 "owrrm.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 "owrrm.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
127
helm/templates/deployment.yaml
Normal file
127
helm/templates/deployment.yaml
Normal file
@@ -0,0 +1,127 @@
|
||||
{{- $root := . -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "owrrm.fullname" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owrrm.name" . }}
|
||||
helm.sh/chart: {{ include "owrrm.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
strategy:
|
||||
type: {{ .Values.strategyType }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "owrrm.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- with .Values.services.owrrm.labels }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owrrm.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- with .Values.services.owrrm.labels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
|
||||
initContainers:
|
||||
- name: wait-kafka
|
||||
image: "{{ .Values.images.dockerize.repository }}:{{ .Values.images.dockerize.tag }}"
|
||||
imagePullPolicy: {{ .Values.images.dockerize.pullPolicy }}
|
||||
args:
|
||||
- -wait
|
||||
- tcp://{{ .Values.public_env_variables.KAFKACONFIG_BOOTSTRAPSERVER }}
|
||||
- -timeout
|
||||
- 600s
|
||||
|
||||
containers:
|
||||
|
||||
- name: owrrm
|
||||
image: "{{ .Values.images.owrrm.repository }}:{{ .Values.images.owrrm.tag }}"
|
||||
imagePullPolicy: {{ .Values.images.owrrm.pullPolicy }}
|
||||
|
||||
env:
|
||||
- name: KUBERNETES_DEPLOYED
|
||||
value: "{{ now }}"
|
||||
{{- range $key, $value := .Values.public_env_variables }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.secret_env_variables }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "owrrm.fullname" $root }}-env
|
||||
key: {{ $key }}
|
||||
{{- end }}
|
||||
|
||||
ports:
|
||||
{{- range $port, $portValue := .Values.services.owrrm.ports }}
|
||||
- name: {{ $port }}
|
||||
containerPort: {{ $portValue.targetPort }}
|
||||
protocol: {{ $portValue.protocol }}
|
||||
{{- end }}
|
||||
|
||||
volumeMounts:
|
||||
{{- range .Values.volumes.owrrm }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .mountPath }}
|
||||
{{- if .subPath }}
|
||||
subPath: {{ .subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.checks.owrrm.liveness }}
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.checks.owrrm.liveness | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.checks.owrrm.readiness }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.checks.owrrm.readiness | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
imagePullSecrets:
|
||||
{{- range $image, $imageValue := .Values.images }}
|
||||
{{- if $imageValue.regcred }}
|
||||
- name: {{ include "owrrm.fullname" $root }}-{{ $image }}-regcred
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
volumes:
|
||||
{{- range $container, $containerVolumes := .Values.volumes }}
|
||||
{{- range $containerVolumes }}
|
||||
- name: {{ .name }}
|
||||
{{- tpl .volumeDefinition $root | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
47
helm/templates/ingress.yaml
Normal file
47
helm/templates/ingress.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
{{- $root := . -}}
|
||||
{{- range $ingress, $ingressValue := .Values.ingresses }}
|
||||
{{- if $ingressValue.enabled }}
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "owrrm.fullname" $root }}-{{ $ingress }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owrrm.name" $root }}
|
||||
helm.sh/chart: {{ include "owrrm.chart" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
|
||||
{{- with $ingressValue.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
spec:
|
||||
|
||||
{{- if $ingressValue.tls }}
|
||||
tls:
|
||||
{{- range $ingressValue.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ tpl .secretName $root }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
rules:
|
||||
{{- range $ingressValue.hosts }}
|
||||
- host: {{ . | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range $ingressValue.paths }}
|
||||
- path: {{ .path }}
|
||||
backend:
|
||||
serviceName: {{ include "owrrm.fullname" $root }}-{{ .serviceName }}
|
||||
servicePort: {{ .servicePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
17
helm/templates/secret-env.yaml
Normal file
17
helm/templates/secret-env.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
app.kuberentes.io/name: {{ include "owrrm.name" . }}
|
||||
helm.sh/chart: {{ include "owrrm.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
name: {{ include "owrrm.fullname" . }}-env
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
data:
|
||||
# Secret env variables
|
||||
{{- range $key, $value := .Values.secret_env_variables }}
|
||||
{{ $key }}: {{ $value | b64enc | quote }}
|
||||
{{- end }}
|
||||
|
||||
21
helm/templates/secret-regcred.yaml
Normal file
21
helm/templates/secret-regcred.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- define "imagePullSecret" }}
|
||||
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .registry (printf "%s:%s" .username .password | b64enc) | b64enc }}
|
||||
{{- end }}
|
||||
{{- $root := . -}}
|
||||
{{- range $image, $imageValue := .Values.images }}
|
||||
{{- if $imageValue.regcred }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
metadata:
|
||||
labels:
|
||||
app.kuberentes.io/name: {{ include "owrrm.name" $root }}
|
||||
helm.sh/chart: {{ include "owrrm.chart" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
|
||||
name: {{ include "owrrm.fullname" $root }}-{{ $image }}-regcred
|
||||
data:
|
||||
.dockerconfigjson: {{ template "imagePullSecret" $imageValue.regcred }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
48
helm/templates/service.yaml
Normal file
48
helm/templates/service.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
{{- $root := . -}}
|
||||
{{- range $service, $serviceValue := .Values.services }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "owrrm.fullname" $root }}-{{ $service }}
|
||||
{{- with $serviceValue.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owrrm.name" $root }}
|
||||
helm.sh/chart: {{ include "owrrm.chart" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
|
||||
|
||||
{{- with $serviceValue.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $serviceValue.serviceMonitor }}
|
||||
|
||||
{{- range $selector, $selectorValue := $serviceValue.serviceMonitor.serviceSelector }}
|
||||
{{ $selector }}: {{ tpl $selectorValue $root }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ $serviceValue.type }}
|
||||
ports:
|
||||
|
||||
{{- range $service_service, $service_value := $serviceValue.ports }}
|
||||
- name: {{ $service_service }}
|
||||
targetPort: {{ $service_value.targetPort }}
|
||||
protocol: {{ $service_value.protocol }}
|
||||
port: {{ $service_value.servicePort }}
|
||||
{{- if and (eq "NodePort" $serviceValue.type) $service_value.nodePort }}
|
||||
nodePort: {{ $service_value.nodePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "owrrm.name" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
{{- with $serviceValue.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
105
helm/values.yaml
Normal file
105
helm/values.yaml
Normal file
@@ -0,0 +1,105 @@
|
||||
# System
|
||||
replicaCount: 1
|
||||
strategyType: RollingUpdate
|
||||
revisionHistoryLimit: 2
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
images:
|
||||
owrrm:
|
||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owrrm
|
||||
tag: main
|
||||
pullPolicy: Always
|
||||
# regcred:
|
||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||
# username: username
|
||||
# password: password
|
||||
dockerize:
|
||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/dockerize
|
||||
tag: 0.16.0
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
services:
|
||||
owrrm:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
restapi:
|
||||
servicePort: 16789
|
||||
targetPort: 16789
|
||||
protocol: TCP
|
||||
restapiinternal:
|
||||
servicePort: 17007
|
||||
targetPort: 17007
|
||||
protocol: TCP
|
||||
|
||||
checks:
|
||||
owrrm:
|
||||
liveness:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 16789
|
||||
readiness:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 16789
|
||||
|
||||
ingresses:
|
||||
http:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
serviceName: owrrm
|
||||
servicePort: restapi
|
||||
|
||||
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:'.
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
# Application
|
||||
public_env_variables: {}
|
||||
|
||||
secret_env_variables: {}
|
||||
|
||||
volumes:
|
||||
owrrm: []
|
||||
|
||||
# MySQL (https://github.com/bitnami/charts/tree/master/bitnami/mysql)
|
||||
mysql:
|
||||
enabled: false
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/mysql
|
||||
tag: 8.0.26-debian-10-r10
|
||||
|
||||
auth:
|
||||
rootPassword: openwifi
|
||||
database: owrrm
|
||||
|
||||
primary:
|
||||
persistence:
|
||||
enabled: true
|
||||
storageClass: ""
|
||||
size: 8Gi
|
||||
Reference in New Issue
Block a user