[WIFI-2695] Add: helm chart

This commit is contained in:
Dmitry Dunaev
2021-07-01 13:28:29 +03:00
parent d5244f8626
commit 1d771a2bea
11 changed files with 398 additions and 0 deletions

View File

@@ -25,3 +25,4 @@ yarn-error.log*
.git
.github
Dockerfile
helm

1
helm/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.swp

22
helm/.helmignore Normal file
View 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/

5
helm/Chart.yaml Normal file
View File

@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: ucentralgwui
version: 0.1.0

62
helm/README.md Normal file
View File

@@ -0,0 +1,62 @@
# ucentralgwui
> Application description placeholder
## TL;DR;
```bash
$ helm install .
```
## Introduction
This chart bootstraps an ucentralgwui on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release stable/ipfs
```
The command deploys ucentralgwui 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 --purge 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 Memcached chart and their default values.
| Parameter | Description | Default |
|-----------|-------------|---------|
|||
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.

View File

@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "ucentralgwui.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 "ucentralgwui.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 "ucentralgwui.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@@ -0,0 +1,84 @@
{{- $root := . -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ucentralgwui.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "ucentralgwui.name" . }}
helm.sh/chart: {{ include "ucentralgwui.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "ucentralgwui.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.services.ucentralgwui.labels }}
{{- toYaml . | nindent 6 }}
{{- end }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "ucentralgwui.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.services.ucentralgwui.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: ucentralgwui
image: "{{ .Values.images.ucentralgwui.repository }}:{{ .Values.images.ucentralgwui.tag }}"
imagePullPolicy: {{ .Values.images.ucentralgwui.pullPolicy }}
env:
{{- range $key, $value := .Values.public_env_variables }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
ports:
{{- range $key, $value := .Values.services.ucentralgwui.ports }}
- name: {{ $key }}
containerPort: {{ $value.targetPort }}
protocol: {{ $value.protocol }}
{{- end }}
{{- if .Values.checks.ucentralgwui.liveness }}
livenessProbe:
{{- toYaml .Values.checks.ucentralgwui.liveness | nindent 12 }}
{{- end }}
{{- if .Values.checks.ucentralgwui.readiness }}
readinessProbe:
{{- toYaml .Values.checks.ucentralgwui.readiness | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
imagePullSecrets:
{{- range $image, $imageValue := .Values.images }}
{{- if $imageValue.regcred }}
- name: {{ include "ucentralgwui.fullname" $root }}-{{ $image }}-regcred
{{- 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 }}

View File

@@ -0,0 +1,47 @@
{{- $root := . -}}
{{- range $ingress, $ingressValue := .Values.ingresses }}
{{- if $ingressValue.enabled }}
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "ucentralgwui.fullname" $root }}-{{ $ingress }}
labels:
app.kubernetes.io/name: {{ include "ucentralgwui.name" $root }}
helm.sh/chart: {{ include "ucentralgwui.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 "ucentralgwui.fullname" $root }}-{{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View 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 "ucentralgwui.name" $root }}
helm.sh/chart: {{ include "ucentralgwui.chart" $root }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
name: {{ include "ucentralgwui.fullname" $root }}-{{ $image }}-regcred
data:
.dockerconfigjson: {{ template "imagePullSecret" $imageValue.regcred }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,48 @@
{{- $root := . -}}
{{- range $service, $serviceValue := .Values.services }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "ucentralgwui.fullname" $root }}-{{ $service }}
{{- with $serviceValue.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "ucentralgwui.name" $root }}
helm.sh/chart: {{ include "ucentralgwui.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 "ucentralgwui.name" $root }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
{{- with $serviceValue.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

75
helm/values.yaml Normal file
View File

@@ -0,0 +1,75 @@
# System
replicaCount: 1
nameOverride: ""
fullnameOverride: ""
images:
ucentralgwui:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/ucentralgw-ui
tag: main
pullPolicy: Always
services:
ucentralgwui:
type: ClusterIP
ports:
http:
servicePort: 80
targetPort: 80
protocol: TCP
checks:
ucentralgwui:
liveness:
httpGet:
path: /
port: http
readiness:
httpGet:
path: /
port: http
ingresses:
default:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# tls:
# - secretName: '{{ include "ucentralgwui.fullname" . }}-default-tls' # template may be used
# cert: |
# CERT_HERE_IN_PEM
# key: |
# KEY_HERE_IN_PEM
# hosts:
# - chart-example.local
hosts:
- chart-example.local
paths:
- path: /
serviceName: ucentralgwui
servicePort: http
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: {}
# Application
public_env_variables:
DEFAULT_GATEWAY_URL: https://ucentral.dpaas.arilia.com:16001
ALLOW_GATEWAY_CHANGE: false