apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nodered
  name: nodered
  namespace: nodered-ns
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: nodered
  template:
    metadata:
      labels:
        app: nodered
    spec:
      containers:
        - name: nodered
          # image: nodered/node-red:1.0.6-12-minimal
          # image: nodered/node-red:1.2.7-minimal
          image: nodered/node-red:2.0.6-12-minimal
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 1880
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
            failureThreshold: 1
            periodSeconds: 30
          startupProbe:
            httpGet:
              path: /
              port: http
            failureThreshold: 30
            periodSeconds: 30
          resources:
            limits:
              cpu: 500m
              memory: 512Mi
            requests:
              cpu: 250m
              memory: 256Mi
          env:
            - name: FLOWS
              value: "flows.json"
            - name: NODE_RED_ENABLE_SAFE_MODE
              value: "false"
            - name: NODE_RED_ENABLE_PROJECTS
              value: "false"
            - name: NODE_OPTIONS
              value: ""
            - name: TZ
              value: "Berlin/Europe"
          volumeMounts:
            - name: data
              mountPath: /data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: nodered-pvc
      securityContext:
        fsGroup: 1001