Rocket.Chat Helm Chart NATS Upgrade Details

Rocket.Chat Helm Chart NATS Upgrade Details

Original GitHub pull request, Improve metrics scraping documentation by gabrielpetry · Pull Request #169 · RocketChat/helm-charts · GitHub

We recently upgraded the version of NATS embedded in the Rocket.Chat Helm chart from 0.13 to 1.3. This upgrade brings significant improvements and aligns with our vision for metric scraping.

The main reason for this upgrade is the improvements made by NATS, particularly the switch to using PodMonitor instead of Prometheus Service Monitor. This change helps us streamline how metrics are gathered.
Important Change: Version 7.0.0 Introduces Breaking Changes for NATS
Note: If you prefer to avoid these changes, you can continue using version 6.25.0 by explicitly specifying it in your Helm commands:

helm install rocketchat --version "6.25.0" rocketchat/rocketchat

If you choose to upgrade to version 7.0.0, you will need to update your NATS configuration. Below are the changes you need to make:
NATS Image Version Update
From:

nats:
  nats:
    image: nats:2.4-alpine

To:

nats:
  container:
    image:
      repository: nats
      tag: 2.4-alpine

NATS Replicas Update
From:

nats:
  cluster:
    replicas: 3

To:

nats:
  replicaCount: 3

Node Selector and Affinity Update
From:

nats:
  nodeSelector:
    kubernetes.io/arch: amd64
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                  - amd64

To:

nats:
  statefulSet:
    patch:
      - op: add
        path: /spec/template/spec/nodeSelector
        value:
          kubernetes.io/arch: amd64
      - op: add
        path: /spec/template/spec/affinity
        value:
          nodeAffinity:
            requiredDuringSchedulingIgnoredDuringExecution:
              nodeSelectorTerms:
                - matchExpressions:
                    - key: kubernetes.io/arch
                      operator: In
                      values:
                        - amd64

Metrics Update
From:

nats:
  exporter:
    serviceMonitor:
      enabled: true

To:

nats:
  promExporter:
    podMonitor:
      enabled: true

We understand that these changes may require some adjustments, and we are here to assist if you encounter any issues. This upgrade is a significant step forward in improving our system’s performance and alignment with modern metric collection practices.