From 8a57a4e066fdb3f0c1d015f21a0d7cfd8e31b314 Mon Sep 17 00:00:00 2001 From: sHa Date: Tue, 22 Sep 2026 02:04:54 +0300 Subject: [PATCH] Add node-red Helm chart Adds a standalone chart for Node-RED (Deployment, Service, PVC, Ingress) with image version tracked via the version-source annotation for scripts/update-charts.sh. --- node-red/Chart.yaml | 12 +++++ node-red/templates/deployment.yaml | 83 ++++++++++++++++++++++++++++++ node-red/templates/ingress.yaml | 27 ++++++++++ node-red/templates/pvc.yaml | 18 +++++++ node-red/templates/service.yaml | 16 ++++++ node-red/values.yaml | 60 +++++++++++++++++++++ 6 files changed, 216 insertions(+) create mode 100644 node-red/Chart.yaml create mode 100644 node-red/templates/deployment.yaml create mode 100644 node-red/templates/ingress.yaml create mode 100644 node-red/templates/pvc.yaml create mode 100644 node-red/templates/service.yaml create mode 100644 node-red/values.yaml diff --git a/node-red/Chart.yaml b/node-red/Chart.yaml new file mode 100644 index 0000000..2a51e19 --- /dev/null +++ b/node-red/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +name: node-red +description: >- + Node-RED flow-based automation. Own chart (not a wrapper): Node-RED is a + single Deployment + Service + PVC + Ingress, so the image is tracked + directly off node-red/node-red releases via the annotation below and + scripts/update-charts.sh — no upstream chart in the loop to pin or bump. +type: application +version: 0.1.0 +appVersion: "5.0.7" +annotations: + version-source: github-release:node-red/node-red diff --git a/node-red/templates/deployment.yaml b/node-red/templates/deployment.yaml new file mode 100644 index 0000000..fc9d64d --- /dev/null +++ b/node-red/templates/deployment.yaml @@ -0,0 +1,83 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Release.Name }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + app.kubernetes.io/component: server + app.kubernetes.io/part-of: home-automation + annotations: + version-source: {{ index .Chart.Annotations "version-source" }} +spec: + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app: {{ .Release.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }} + spec: + {{- with .Values.securityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.containerSecurityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - containerPort: {{ .Values.httpPort }} + name: http + env: + - name: TZ + value: {{ .Values.timezone | quote }} + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 60 + periodSeconds: 30 + timeoutSeconds: 10 + failureThreshold: 3 + volumeMounts: + - name: data + mountPath: /data + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (printf "%s-data" .Release.Name) }} diff --git a/node-red/templates/ingress.yaml b/node-red/templates/ingress.yaml new file mode 100644 index 0000000..9eca732 --- /dev/null +++ b/node-red/templates/ingress.yaml @@ -0,0 +1,27 @@ +{{- range $name, $config := .Values.ingresses }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $.Release.Name }}-{{ $name }} + {{- with $config.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + - host: {{ $config.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ $.Release.Name }} + port: + number: {{ $.Values.service.port }} + {{- with $config.tls }} + tls: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/node-red/templates/pvc.yaml b/node-red/templates/pvc.yaml new file mode 100644 index 0000000..c50ea39 --- /dev/null +++ b/node-red/templates/pvc.yaml @@ -0,0 +1,18 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Release.Name }}-data + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + accessModes: + {{- toYaml .Values.persistence.accessModes | nindent 4 }} + {{- with .Values.persistence.storageClass }} + storageClassName: {{ . }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size }} +{{- end }} diff --git a/node-red/templates/service.yaml b/node-red/templates/service.yaml new file mode 100644 index 0000000..ef6cea2 --- /dev/null +++ b/node-red/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }} + labels: + app.kubernetes.io/name: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + type: {{ .Values.service.type }} + selector: + app: {{ .Release.Name }} + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: http + protocol: TCP diff --git a/node-red/values.yaml b/node-red/values.yaml new file mode 100644 index 0000000..e135266 --- /dev/null +++ b/node-red/values.yaml @@ -0,0 +1,60 @@ +# Default values for Node-RED Helm Chart +image: + repository: nodered/node-red + pullPolicy: IfNotPresent + +timezone: "Europe/Kyiv" + +# Container port exposed by the Node-RED editor / HTTP endpoints +httpPort: 1880 + +service: + type: ClusterIP + port: 1880 + +# Extra environment variables (rendered as name/value pairs). +# Node-RED flows read these via env.get() / ${VAR} in node config. +env: {} + # HOME_ASSISTANT_URL: http://home-assistant.home-assistant.svc.cluster.local + +# The nodered/node-red image runs as uid/gid 1000; fsGroup makes the PVC writable +securityContext: + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + runAsNonRoot: true + +containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + +resources: + requests: + cpu: "100m" + memory: "256Mi" + limits: + cpu: "1" + memory: "1Gi" + +# Persistent /data directory (flows, credentials, installed palette nodes) +persistence: + enabled: true + existingClaim: "" + storageClass: local-path + accessModes: + - ReadWriteOnce + size: 5Gi + +nodeSelector: {} +tolerations: [] +affinity: {} + +ingresses: {} + # https: + # host: node-red.example.com + # annotations: {} + # tls: + # - hosts: + # - node-red.example.com