Skip to content

Commit

Permalink
Add node-red chart
Browse files Browse the repository at this point in the history
  • Loading branch information
th0th committed Jul 16, 2024
1 parent 42a7e28 commit 7652f03
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A collection of helm charts.
## Available charts

* [listmonk](./charts/listmonk)
* [node-red](./charts/node-red)

## Sponsor

Expand Down
12 changes: 6 additions & 6 deletions charts/listmonk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ High performance, self-hosted, newsletter and mailing list manager with a modern

```shell
$ helm upgrade \
--create-namespace \
--install listmonk listmonk \
--namespace listmonk \
--repo https://th0th.github.io/helm-charts \
--values values.yaml \
--version 0.1.0
--create-namespace \
--install listmonk listmonk \
--namespace listmonk \
--repo https://th0th.github.io/helm-charts \
--values values.yaml \
--version 0.1.0
```

## Uninstall
Expand Down
6 changes: 6 additions & 0 deletions charts/node-red/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
appVersion: "4.0.2"
name: node-red
description: Low-code programming for event-driven applications.
type: application
version: 0.1.0
44 changes: 44 additions & 0 deletions charts/node-red/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# node-red

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 4.0.2](https://img.shields.io/badge/AppVersion-4.0.2-informational?style=flat-square)

Low-code programming for event-driven applications.

## Install

> [!WARNING]
> You won't be able to authenticate without setting `nodeRed.settings.adminAuth.users` properly.
```shell
$ helm upgrade \
--create-namespace \
--install node-red node-red \
--namespace node-red \
--repo https://th0th.github.io/helm-charts \
--values values.yaml \
--version 0.1.0
```

## Uninstall

```shell
$ helm uninstall --namespace node-red node-red
```

## Values

| Key | Type | Default | Description |
|----------------------------------|--------|---------------------------------------------------|----------------------------------------|
| ingress.annotations | object | `{}` | annotations for the ingress |
| ingress.enabled | bool | `false` | enable the ingress |
| ingress.host | string | `"node-red.local"` | host for the ingress |
| ingress.tls | list | `[]` | tls configuration for the ingress |
| nodeRed.image.repository | string | `"nodered/node-red"` | node-red image repository |
| nodeRed.image.tag | string | `"latest"` | node-red image tag |
| nodeRed.persistence.enabled | bool | `true` | enable persistence |
| nodeRed.resources | object | `{}` | resources for the node-red statefulset |
| nodeRed.settings | object | `{"adminAuth":{"type":"credentials","users":[]}}` | node-red settings |
| nodeRed.settings.adminAuth | object | `{"type":"credentials","users":[]}` | admin authentication config |
| nodeRed.settings.adminAuth.users | list | `[]` | list of users |
| nodeRed.timeZone | string | `"America/New_York"` | time zone | | time zone |

42 changes: 42 additions & 0 deletions charts/node-red/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- define "nodeRed.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "nodeRed.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 }}

{{- define "nodeRed.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "nodeRed.labels" -}}
helm.sh/chart: {{ include "nodeRed.chart" . }}
{{ include "nodeRed.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "nodeRed.selectorLabels" -}}
app.kubernetes.io/name: {{ include "nodeRed.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "nodeRed.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "nodeRed.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
22 changes: 22 additions & 0 deletions charts/node-red/templates/configmap-node-red.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "nodeRed.fullname" . }}-node-red
labels:
{{- include "nodeRed.labels" . | nindent 4 }}
data:
settings.js: |
module.exports = {
adminAuth: {
type: "{{ required "A valid .Values.nodeRed.settings.adminAuth.type is required!" .Values.nodeRed.settings.adminAuth.type }}",
users: [
{{- range (.Values.nodeRed.settings.adminAuth.users | default list) }}
{
password: "{{ .password }}",
permissions: "{{ .permissions }}",
username: "{{ .username }}",
},
{{- end }}
],
},
};
24 changes: 24 additions & 0 deletions charts/node-red/templates/ingress-node-red.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{ if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "nodeRed.fullname" . }}-node-red
labels:
{{- include "nodeRed.labels" . | nindent 4 }}
annotations:
{{- toYaml .Values.ingress.annotations | nindent 4 }}
spec:
rules:
- host: {{ .Values.ingress.host}}
http:
paths:
- backend:
service:
name: '{{ include "nodeRed.fullname" . }}-node-red'
port:
name: http
path: /
pathType: Prefix
tls:
{{- toYaml .Values.ingress.tls | nindent 4 }}
{{ end }}
16 changes: 16 additions & 0 deletions charts/node-red/templates/service-node-red.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "nodeRed.fullname" . }}-node-red
labels:
{{- include "nodeRed.labels" . | nindent 4 }}
spec:
type: ClusterIP
selector:
statefulSet: node-red
{{- include "nodeRed.selectorLabels" . | nindent 4 }}
ports:
- name: http
port: 1880
protocol: TCP
targetPort: 1880
53 changes: 53 additions & 0 deletions charts/node-red/templates/statefulset-node-red.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "nodeRed.fullname" . }}-node-red
labels:
{{- include "nodeRed.labels" . | nindent 4 }}
spec:
persistentVolumeClaimRetentionPolicy:
whenDeleted: Retain
whenScaled: Retain
replicas: 1
selector:
matchLabels:
statefulSet: node-red
{{- include "nodeRed.selectorLabels" . | nindent 6 }}
serviceName: node-red-hl
template:
metadata:
labels:
statefulSet: node-red
{{- include "nodeRed.selectorLabels" . | nindent 8 }}
name: node-red
spec:
containers:
- env:
- name: TZ
value: {{ .Values.nodeRed.timeZone }}
image: {{ .Values.nodeRed.image.repository }}:{{ .Values.nodeRed.image.tag }}
name: node-red
resources: {{- toYaml .Values.nodeRed.resources | nindent 12 }}
volumeMounts:
- mountPath: /data
name: data
subPath: node-red-data
- mountPath: /data/settings.js
name: configmap-node-red
subPath: settings.js
volumes:
- configMap:
name: {{ include "nodeRed.fullname" . }}-node-red
name: configmap-node-red
volumeClaimTemplates:
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
volumeMode: Filesystem
32 changes: 32 additions & 0 deletions charts/node-red/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ingress:
# -- annotations for the ingress
annotations: { }
# -- enable the ingress
enabled: false
# -- host for the ingress
host: node-red.local
# -- tls configuration for the ingress
tls: [ ]
nodeRed:
image:
# -- node-red image repository
repository: nodered/node-red
# -- node-red image tag
tag: latest
persistence:
# -- enable persistence
enabled: true
# -- resources for the node-red statefulset
resources: { }
# -- node-red settings
settings:
# -- admin authentication config
adminAuth:
type: credentials
# -- list of users
users: [ ]
# - password: "$2y$08$q7DQYqhJrLC0.NnLelnre.IUaE2wQX3/xBiQ1cyAuNva8i5A6760q"
# permissions: "*"
# username: admin
# -- time zone
timeZone: America/New_York

0 comments on commit 7652f03

Please sign in to comment.