From 1c3ec2afabd6ec8a94796dfeee8e94f1806c1de1 Mon Sep 17 00:00:00 2001 From: Saikat Chakrabortty Date: Mon, 20 Apr 2020 20:40:42 +0530 Subject: [PATCH] Feat: Join Master --- .github/workflows/lint-test.yaml | 32 +++ .github/workflows/release.yaml | 31 +++ charts/volantmq/Chart.yaml | 19 ++ charts/volantmq/README.md | 54 +++++ charts/volantmq/templates/NOTES.txt | 18 ++ charts/volantmq/templates/_helpers.tpl | 80 ++++++++ charts/volantmq/templates/configmap.yaml | 13 ++ charts/volantmq/templates/deployment.yaml | 77 ++++++++ charts/volantmq/templates/ingress.yaml | 41 ++++ .../templates/metrics-prometheus.yaml | 34 ++++ charts/volantmq/templates/pvc.yaml | 29 +++ charts/volantmq/templates/service.yaml | 49 +++++ charts/volantmq/templates/serviceaccount.yaml | 12 ++ .../templates/test/test-configmap.yaml | 22 +++ charts/volantmq/templates/test/test.yaml | 36 ++++ charts/volantmq/values.yaml | 186 ++++++++++++++++++ ct.yaml | 4 + 17 files changed, 737 insertions(+) create mode 100644 .github/workflows/lint-test.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 charts/volantmq/Chart.yaml create mode 100644 charts/volantmq/README.md create mode 100644 charts/volantmq/templates/NOTES.txt create mode 100644 charts/volantmq/templates/_helpers.tpl create mode 100644 charts/volantmq/templates/configmap.yaml create mode 100644 charts/volantmq/templates/deployment.yaml create mode 100644 charts/volantmq/templates/ingress.yaml create mode 100644 charts/volantmq/templates/metrics-prometheus.yaml create mode 100644 charts/volantmq/templates/pvc.yaml create mode 100644 charts/volantmq/templates/service.yaml create mode 100644 charts/volantmq/templates/serviceaccount.yaml create mode 100644 charts/volantmq/templates/test/test-configmap.yaml create mode 100644 charts/volantmq/templates/test/test.yaml create mode 100644 charts/volantmq/values.yaml create mode 100644 ct.yaml diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml new file mode 100644 index 0000000..d85fac1 --- /dev/null +++ b/.github/workflows/lint-test.yaml @@ -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/chart-testing-action@v1.0.0-rc.2 + with: + command: lint + config: ct.yaml + + - name: Create kind cluster + uses: helm/kind-action@v1.0.0-alpha.3 + 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/chart-testing-action@v1.0.0-rc.2 + with: + command: install \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..b37d706 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 "$GITHUB_ACTOR@users.noreply.github.com" + # 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/chart-releaser-action@v1.0.0-rc.2 + env: + CR_TOKEN: "${{ secrets.CR_TOKEN }}" \ No newline at end of file diff --git a/charts/volantmq/Chart.yaml b/charts/volantmq/Chart.yaml new file mode 100644 index 0000000..9406f9b --- /dev/null +++ b/charts/volantmq/Chart.yaml @@ -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: gnante0@gmail.com + - name: saikatharryc + email: saikatchakrabortty2@gmail.com diff --git a/charts/volantmq/README.md b/charts/volantmq/README.md new file mode 100644 index 0000000..e14c04d --- /dev/null +++ b/charts/volantmq/README.md @@ -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 | + diff --git a/charts/volantmq/templates/NOTES.txt b/charts/volantmq/templates/NOTES.txt new file mode 100644 index 0000000..95d71d2 --- /dev/null +++ b/charts/volantmq/templates/NOTES.txt @@ -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 }} \ No newline at end of file diff --git a/charts/volantmq/templates/_helpers.tpl b/charts/volantmq/templates/_helpers.tpl new file mode 100644 index 0000000..d22687d --- /dev/null +++ b/charts/volantmq/templates/_helpers.tpl @@ -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 -}} \ No newline at end of file diff --git a/charts/volantmq/templates/configmap.yaml b/charts/volantmq/templates/configmap.yaml new file mode 100644 index 0000000..e296e89 --- /dev/null +++ b/charts/volantmq/templates/configmap.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/volantmq/templates/deployment.yaml b/charts/volantmq/templates/deployment.yaml new file mode 100644 index 0000000..fadcf66 --- /dev/null +++ b/charts/volantmq/templates/deployment.yaml @@ -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 diff --git a/charts/volantmq/templates/ingress.yaml b/charts/volantmq/templates/ingress.yaml new file mode 100644 index 0000000..48804ea --- /dev/null +++ b/charts/volantmq/templates/ingress.yaml @@ -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 }} diff --git a/charts/volantmq/templates/metrics-prometheus.yaml b/charts/volantmq/templates/metrics-prometheus.yaml new file mode 100644 index 0000000..d24cdfd --- /dev/null +++ b/charts/volantmq/templates/metrics-prometheus.yaml @@ -0,0 +1,34 @@ +{{- if and (.Values.metrics.enabled) (.Values.metrics.serviceMonitor.enabled) }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "volantmq.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace }} + {{- end }} + labels: + app: {{ template "volantmq.name" . }} + chart: {{ template "volantmq.chart" . }} + heritage: {{ .Release.Service }} + {{- range $key, $value := .Values.metrics.serviceMonitor.selector }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + endpoints: + - port: metrics + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + {{- if .Values.metrics.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }} + {{- end }} + selector: + matchLabels: + app: {{ template "volantmq.name" . }} + release: {{ .Release.Name }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} + {{- end -}} diff --git a/charts/volantmq/templates/pvc.yaml b/charts/volantmq/templates/pvc.yaml new file mode 100644 index 0000000..3cf07a9 --- /dev/null +++ b/charts/volantmq/templates/pvc.yaml @@ -0,0 +1,29 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "volantmq.fullname" . }} + namespace: {{ .Release.Namespace }} +{{- with .Values.persistence.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} + labels: + app: {{ template "volantmq.name" . }} + chart: {{ template "volantmq.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/volantmq/templates/service.yaml b/charts/volantmq/templates/service.yaml new file mode 100644 index 0000000..7a87fc7 --- /dev/null +++ b/charts/volantmq/templates/service.yaml @@ -0,0 +1,49 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "volantmq.fullname" . }} + labels: + app: {{ template "volantmq.name" . }} + chart: {{ template "volantmq.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- if .Values.service.labels }} +{{ toYaml .Values.service.labels | indent 4 }} +{{- end }} +{{- with .Values.service.annotations }} + annotations: +{{ toYaml . | indent 4 }} +{{- end }} +spec: + {{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }} + type: ClusterIP + {{- if .Values.service.clusterIP }} + clusterIP: {{ .Values.service.clusterIP }} + {{end}} +{{- else if eq .Values.service.type "LoadBalancer" }} + type: {{ .Values.service.type }} + {{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + {{- if .Values.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} + {{- end -}} +{{- else }} + type: {{ .Values.service.type }} +{{- end }} +{{- if .Values.service.externalIPs }} + externalIPs: +{{ toYaml .Values.service.externalIPs | indent 4 }} +{{- end }} + publishNotReadyAddresses: {{ .Values.service.publishNotReadyAddresses }} + ports: + - name: mqtt + port: {{ .Values.service.port }} + targetPort: 1883 + - name: metrics + port: 8080 + targetPort: 8080 + selector: + app: {{ template "volantmq.name" . }} + release: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/volantmq/templates/serviceaccount.yaml b/charts/volantmq/templates/serviceaccount.yaml new file mode 100644 index 0000000..9187ee4 --- /dev/null +++ b/charts/volantmq/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "volantmq.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + app: {{ template "volantmq.name" . }} + chart: {{ template "volantmq.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- end -}} diff --git a/charts/volantmq/templates/test/test-configmap.yaml b/charts/volantmq/templates/test/test-configmap.yaml new file mode 100644 index 0000000..b8225c1 --- /dev/null +++ b/charts/volantmq/templates/test/test-configmap.yaml @@ -0,0 +1,22 @@ +{{- if .Values.testFramework.enabled }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "volantmq.fullname" . }}-test + 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 | indent 4 }} +{{- end }} +data: + run.sh: |- + @test "Test Health" { + url="http://{{ template "volantmq.fullname" . }}.{{ .Release.Namespace }}:8080/health/live" + code=$(wget --server-response --spider --timeout 10 --tries 1 ${url} 2>&1 | awk '/^ HTTP/{print $2}') + [ "$code" == "200" ] + } +{{- end }} diff --git a/charts/volantmq/templates/test/test.yaml b/charts/volantmq/templates/test/test.yaml new file mode 100644 index 0000000..8699458 --- /dev/null +++ b/charts/volantmq/templates/test/test.yaml @@ -0,0 +1,36 @@ +{{- if .Values.testFramework.enabled }} +apiVersion: v1 +kind: Pod +metadata: + name: {{ template "volantmq.fullname" . }}-test + labels: + app: {{ template "volantmq.name" . }} + chart: {{ template "volantmq.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- if .Values.service.labels }} +{{ toYaml .Values.service.labels | indent 4 }} +{{- end }} + annotations: + helm.sh/hook: test-success + helm.sh/hook-delete-policy: hook-succeeded + namespace: {{ .Release.Namespace }} +spec: + serviceAccountName: {{ template "volantmq.serviceAccountName" . }} + {{- if .Values.testFramework.securityContext }} + securityContext: {{ toYaml .Values.testFramework.securityContext | nindent 4 }} + {{- end }} + containers: + - name: {{ .Release.Name }}-test + image: "{{ .Values.testFramework.image}}:{{ .Values.testFramework.tag }}" + command: ["/opt/bats/bin/bats", "-t", "/tests/run.sh"] + volumeMounts: + - mountPath: /tests + name: tests + readOnly: true + volumes: + - name: tests + configMap: + name: {{ template "volantmq.fullname" . }}-test + restartPolicy: Never +{{- end }} diff --git a/charts/volantmq/values.yaml b/charts/volantmq/values.yaml new file mode 100644 index 0000000..c89b2c2 --- /dev/null +++ b/charts/volantmq/values.yaml @@ -0,0 +1,186 @@ +# Default values for home-assistant. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image: + # image.registry -- URL to registry + registry: docker.io + # image.repository -- Image repository name + repository: volantmq/volantmq + # image.tag -- Image repository tag + tag: v0.4.0-rc.6 + # image.pullPolicy -- Image repository pull policy + pullPolicy: IfNotPresent + +## Service configuration +service: + # service.type -- Kubernetes Service type + type: ClusterIP + # service.annotations -- Kubernetes Service annotations + annotations: {} + # service.labels -- Kubernetes Service lavels + labels: {} + # service.port -- Kubernetes Service port + port: 1883 + # service.clusterIP -- Kubernetes clusterIp if any + clusterIP: None + ## List of IP addresses at which the hass-configurator service is available + ## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips + ## + # service.externalIPs -- Kubernetes Service externalIps + externalIPs: [] + # service.loadBalancerIP -- Kubernetes Service LoadBalancerIp + loadBalancerIP: "" + # service.loadBalancerSourceRanges -- Kubernetes Service Load Balancer source Range + loadBalancerSourceRanges: [] + # service.publishNotReadyAddresses -- Kubernetes Service publishNotReadyAddresses + publishNotReadyAddresses: false + + +metrics: + # metrics.enabled -- Enable Service Metrics + enabled: false + +# podAnnotations: +# prometheus.io/scrape: "true" +# prometheus.io/port: "8080" + + # Enable this if you're using https://github.com/coreos/prometheus-operator + serviceMonitor: + # metrics.serviceMonitor.enabled -- Enable Service Monitor + enabled: true + # metrics.serviceMonitor.namespace -- Specify a namespace if needed + namespace: prometheus + # metrics.serviceMonitor.interval -- fallback to the prometheus default unless specified + interval: 3s + # metrics.serviceMonitor.scrapeTimeout -- scrapeTimeout + # scrapeTimeout: 10s + + selector: + # metrics.serviceMonitor.selector.release -- prometheus operator release + release: prometheus-operator + +serviceAccount: + # serviceAccount.create -- Specifies whether a ServiceAccount should be created + ## + create: false + # serviceAccount.name -- The name of the ServiceAccount to use. + ## If not set and create is true, a name is generated using the fullname template + name: + +## Persist data to a persistent volume +persistence: + # persistence.enabled -- Enable Persisting data to a persistent volume + enabled: true + ## Data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + # persistence.accessMode -- Define preferred access mode + accessMode: ReadWriteOnce + # persistence.size -- Define volume claim size(default 8GB) + size: 8Gi + # persistence.annotations -- Define PV annotations + annotations: {} + +testFramework: + # testFramework.enabled -- Enable Test Framework + enabled: true + # testFramework.image -- Image to be used for testing of the chart + image: "bats/bats" + # testFramework.tag -- Image Tag for the test framework + tag: "v1.1.0" + # testFramework.securityContext -- define securityContext object if any + securityContext: {} + +readinessProbe: + # readinessProbe.enable -- Enabling Readiness Probe + enable: true + # readinessProbe.interval -- Readiness check interval + interval: 60 + # readinessProbe.timeout -- Define custom timeout + timeout: 3 + # readinessProbe.initialDelay -- Intial Delay to take in account + initialDelay: 30 + +livenessProbe: + # livenessProbe.enable -- Enabling Readiness Probe + enable: false + # livenessProbe.initialDelay -- Intial Delay to take in account + initialDelay: 30 + # livenessProbe.timeout -- Define custom timeout + timeout: 1 + +ingress: + # ingress.enabled -- Enable Ingress Object + enabled: false + # ingress.annotations -- Custom annotations for the ingress (e.g ingress.class ) + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # ingress.labels -- Custom ingress lavels + labels: {} + # ingress.path -- Ingress accepted path + path: / + # ingress.hosts -- Ingress accepted hostnames + hosts: + - chart-example.local + # ingress.extraPaths -- Extra paths to prepend to every host configuration. This is useful when working with annotation based services. + extraPaths: [] + # - path: /* + # backend: + # serviceName: ssl-redirect + # servicePort: use-annotation + # ingress.tls -- Ingress TLS configuration + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + + +# VolantMQ config +# config -- The VolantMQ config +config: | + system: + log: + console: + level: info # available levels: debug, info, warn, error, dpanic, panic, fatal + acceptor: + maxIncoming: 1000 + preSpawn: 100 + plugins: + enabled: + - health + config: + health: + - backend: health + config: + livenessEndpoint: live + readinessEndpoint: ready + auth: + anonymous: true + order: + - internal + mqtt: + version: + - v3.1.1 + keepAlive: + period: 60 + force: false + options: + connectTimeout: 2 + offlineQoS0: true + sessionDups: false + retainAvail: true + subsOverlap: false + subsId: false + subsShared: false + subsWildcard: true + receiveMax: 65535 + maxPacketSize: 268435455 + maxTopicAlias: 65535 + maxQoS: 2 diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..9a3ccfb --- /dev/null +++ b/ct.yaml @@ -0,0 +1,4 @@ +remote: origin +target-branch: master +chart-dirs: + - charts \ No newline at end of file