Skip to content

Commit

Permalink
Feat: Join Master
Browse files Browse the repository at this point in the history
  • Loading branch information
saikatharryc authored Apr 20, 2020
1 parent 61afa7b commit 1c3ec2a
Show file tree
Hide file tree
Showing 17 changed files with 737 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch history
run: git fetch --prune --unshallow

- name: Run chart-testing (lint)
id: lint
uses: helm/[email protected]
with:
command: lint
config: ct.yaml

- name: Create kind cluster
uses: helm/[email protected]
with:
installLocalPathProvisioner: true
# Only build a kind cluster if there are chart changes to test.
if: steps.lint.outputs.changed == 'true'

- name: Run chart-testing (install)
uses: helm/[email protected]
with:
command: install
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release Charts

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Fetch history
run: git fetch --prune --unshallow

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# See https://github.com/helm/chart-releaser-action/issues/6
- name: Install Helm
run: |
curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.CR_TOKEN }}"
19 changes: 19 additions & 0 deletions charts/volantmq/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: volantmq
version: 0.1.2
appVersion: "dev"
description: VolantMQ mqtt broker
keywords:
- mqtt
- volantmq
- mqtt-broker
sources:
- https://github.com/VolantMQ/helm
- https://github.com/VolantMQ/volantmq
icon: https://avatars2.githubusercontent.com/u/30122488
home: https://github.com/VolantMQ/helm
maintainers:
- name: 4nte
email: [email protected]
- name: saikatharryc
email: [email protected]
54 changes: 54 additions & 0 deletions charts/volantmq/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
VolantMQ helm chart
========
VolantMQ mqtt broker

Current chart version is `0.1.0`

## Chart Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| config | string | [config](/charts/volantmq/values.yaml#L147) | The VolantMQ config (for more detailed click config related info [here](https://github.com/VolantMQ/volantmq#config-file) )|
| image.pullPolicy | string | `"IfNotPresent"` | Image repository pull policy |
| image.registry | string | `"docker.io"` | URL to registry |
| image.repository | string | `"volantmq/volantmq"` | Image repository name |
| image.tag | string | `"v0.4.0-rc.6"` | Image repository tag |
| ingress.annotations | object | `{}` | Custom annotations for the ingress (e.g ingress.class ) |
| ingress.enabled | bool | `false` | Enable Ingress Object |
| ingress.extraPaths | list | `[]` | Extra paths to prepend to every host configuration. This is useful when working with annotation based services. |
| ingress.hosts | list | `["chart-example.local"]` | Ingress accepted hostnames |
| ingress.labels | object | `{}` | Custom ingress lavels |
| ingress.path | string | `"/"` | Ingress accepted path |
| ingress.tls | list | `[]` | |
| livenessProbe.enable | bool | `false` | Enabling Readiness Probe |
| livenessProbe.initialDelay | int | `30` | Intial Delay to take in account |
| livenessProbe.timeout | int | `1` | Define custom timeout |
| metrics.enabled | bool | `false` | Enable Service Metrics |
| metrics.serviceMonitor.enabled | bool | `true` | Enable Service Monitor |
| metrics.serviceMonitor.interval | string | `"3s"` | fallback to the prometheus default unless specified |
| metrics.serviceMonitor.namespace | string | `"prometheus"` | Specify a namespace if needed |
| metrics.serviceMonitor.selector.release | string | `"prometheus-operator"` | prometheus operator release |
| persistence.accessMode | string | `"ReadWriteOnce"` | Define preferred access mode |
| persistence.annotations | object | `{}` | Define PV annotations |
| persistence.enabled | bool | `true` | Enable Persisting data to a persistent volume |
| persistence.size | string | `"8Gi"` | Define volume claim size(default 8GB) |
| readinessProbe.enable | bool | `true` | Enabling Readiness Probe |
| readinessProbe.initialDelay | int | `30` | Intial Delay to take in account |
| readinessProbe.interval | int | `60` | Readiness check interval |
| readinessProbe.timeout | int | `3` | Define custom timeout |
| service.annotations | object | `{}` | Kubernetes Service annotations |
| service.clusterIP | string | `"None"` | Kubernetes clusterIp if any |
| service.externalIPs | list | `[]` | Kubernetes Service externalIps |
| service.labels | object | `{}` | Kubernetes Service lavels |
| service.loadBalancerIP | string | `""` | Kubernetes Service LoadBalancerIp |
| service.loadBalancerSourceRanges | list | `[]` | Kubernetes Service Load Balancer source Range |
| service.port | int | `1883` | Kubernetes Service port |
| service.publishNotReadyAddresses | bool | `false` | Kubernetes Service publishNotReadyAddresses |
| service.type | string | `"ClusterIP"` | Kubernetes Service type |
| serviceAccount.create | bool | `false` | Specifies whether a ServiceAccount should be created |
| serviceAccount.name | string | `nil` | The name of the ServiceAccount to use. |
| testFramework.enabled | bool | `true` | Enable Test Framework |
| testFramework.image | string | `"bats/bats"` | Image to be used for testing of the chart |
| testFramework.securityContext | object | `{}` | define securityContext object if any |
| testFramework.tag | string | `"v1.1.0"` | Image Tag for the test framework |

18 changes: 18 additions & 0 deletions charts/volantmq/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Thank you for installing {{ .Chart.Name }}.

To verify that volantmq has started, run:

$ kubectl --namespace={{ .Release.Namespace }} get pods | grep 'volantmq'



{{- if not .Values.persistence.enabled }}
#################################################################################
###### WARNING: Persistence is disabled!!! You will lose your data when #####
###### the volantmq pod is terminated. #####
#################################################################################
{{- end }}

To learn more about the release, try:

$ helm status {{ .Release.Name }} -n {{ .Release.Namespace }}
80 changes: 80 additions & 0 deletions charts/volantmq/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "volantmq.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Expand the chart plus release name (used by the chart label)
*/}}
{{- define "volantmq.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version -}}
{{- 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 "volantmq.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 -}}


{{/*
Return the proper volantmq image name
*/}}
{{- define "volantmq.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{- $tag := .Values.image.tag | toString -}}
{{/*
Helm 2.11 supports the assignment of a value to a variable defined in a different scope,
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic.
Also, we can't use a single if because lazy evaluation is not an option
*/}}
{{- if .Values.global }}
{{- if .Values.global.imageRegistry }}
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- else -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- end -}}



{{/*
Create the name of the service account to use
*/}}
{{- define "volantmq.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "volantmq.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "volantmq.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/volantmq/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "volantmq.fullname" . }}-config
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "volantmq.name" . }}
chart: {{ template "volantmq.chart" . }}
release: {{.Release.Name}}
heritage: {{.Release.Service}}
data:
volantmq-config.yaml: |-
{{- .Values.config | nindent 6 }}
77 changes: 77 additions & 0 deletions charts/volantmq/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: {{ template "volantmq.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "volantmq.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "volantmq.name" . }}
chart: {{ template "volantmq.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.service.labels -}}
{{ toYaml .Values.service.labels | nindent 4 }}
{{- end -}}
{{- if .Values.service.annotations }}
annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app: {{ template "volantmq.name" . }}
release: {{ .Release.Name }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
labels:
app: {{ template "volantmq.name" . }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ template "volantmq.fullname" . }}
image: {{ template "volantmq.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
ports:
- name: mqtt
containerPort: 1883
- name: mqtt-tls
containerPort: 1884
- name: websocket
containerPort: 883
- name: websocket-tls
containerPort: 884
- name: metrics
containerPort: 8080
{{- if .Values.readinessProbe.enable }}
readinessProbe:
httpGet:
path: /health/ready
port: metrics
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelay }}
periodSeconds: {{ .Values.readinessProbe.interval }}
timeoutSeconds: {{ .Values.readinessProbe.timeout }}
{{- end }}
{{- if .Values.livenessProbe.enable }}
livenessProbe:
httpGet:
path: /health/live
port: metrics
scheme: HTTP
initialDelaySeconds: {{ add .Values.livenessProbe.initialDelay .Values.readinessProbe.initialDelay }}
periodSeconds: 60
timeoutSeconds: {{ .Values.livenessProbe.timeout }}
{{- end }}
env:
- name: VOLANTMQ_CONFIG
value: "/etc/config/volantmq-config.yaml"
volumeMounts:
- mountPath: /etc/config
name: config-volume
volumes:
- name: config-volume
configMap:
name: {{ template "volantmq.fullname" . }}-config
41 changes: 41 additions & 0 deletions charts/volantmq/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "volantmq.fullname" . -}}
{{- $servicePort := .Values.service.port -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $extraPaths := .Values.ingress.extraPaths -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "volantmq.name" . }}
chart: {{ template "volantmq.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
{{ if $extraPaths }}
{{ toYaml $extraPaths | indent 10 }}
{{- end }}
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
Loading

0 comments on commit 1c3ec2a

Please sign in to comment.