Skip to content

feat: add managed afinity rules to helm-charts - #104

Merged
almeidabbm merged 2 commits into
mainfrom
01-13-feat_add_managed_afinity_rules_to_helm-charts
Jan 13, 2026
Merged

almeidabbm merged 2 commits into
mainfrom
01-13-feat_add_managed_afinity_rules_to_helm-charts

Conversation

@almeidabbm

@almeidabbm almeidabbm commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor

Add High Availability Features to Lightdash Helm Chart

Relates to: https://linear.app/lightdash/issue/PROD-2405/gcp-alert-failure-of-uptime-check-id-staging-lightdash-cloud
Relates to: https://linear.app/lightdash/issue/PROD-2444/gcp-alert-failure-of-uptime-check-id-lightdash-cloud-us-f6pmvbw1bso
Relates to: https://linear.app/lightdash/issue/PROD-2400/gcp-alert-failure-of-uptime-check-id-lightdash-cloud-us-f6pmvbw1bso

TL;DR

Added pod anti-affinity and improved documentation for high availability configurations in the Lightdash Helm chart.

What changed?

  • Added configurable pod anti-affinity rules to spread pods across nodes and availability zones
  • Created a reusable Helm template helper for pod anti-affinity configuration
  • Added comprehensive documentation for high availability features
  • Implemented pod anti-affinity in both backend and worker deployments
  • Bumped chart version from 2.1.0 to 2.2.0

Why make this change?

This change enhances the Helm chart's ability to deploy Lightdash in a highly available configuration. By adding pod anti-affinity rules, we can ensure that pods are distributed across different nodes and availability zones, reducing the risk of downtime during node maintenance or failures. The implementation is flexible, allowing users to choose between hard constraints (required) and soft preferences (best-effort) for both node and zone distribution.

Worker

# Source: lightdash/templates/workerDeployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-lightdash-worker
  labels:
    helm.sh/chart: lightdash-2.2.0
    app.kubernetes.io/name: lightdash
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.2248.0"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: worker
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: lightdash
      app.kubernetes.io/instance: release-name
      app.kubernetes.io/component: worker
  template:
    metadata:
      annotations:
        checksum/config: 4e7682c130b500610aafd22d6d01d804d639b2a9158e9f02a37d00591a54de4c
        checksum/secrets: aa3ae5f50c91045992f7ea41b45571fb59bab9529519555135af20b3413d4114
      labels:
        app.kubernetes.io/name: lightdash
        app.kubernetes.io/instance: release-name
        app.kubernetes.io/component: worker
    spec:
      securityContext:
        {}
      serviceAccountName: release-name-lightdash
      containers:
        - name: lightdash
          securityContext:
            {}
          image: "lightdash/lightdash:0.2248.0"
          imagePullPolicy: IfNotPresent
          command: ["node", "dist/scheduler.js"]
          args: 
          env:
            - name: PGPASSWORD
              valueFrom:
                secretKeyRef:
                  name: release-name-postgresql
                  key: password
            - name: PORT
              value: "8080"
            - name: SCHEDULER_CONCURRENCY
              value: "3"
          envFrom:
            - configMapRef:
                name: release-name-lightdash
            - secretRef:
                name: release-name-lightdash
          startupProbe:
            initialDelaySeconds: 5
            timeoutSeconds: 10
            periodSeconds: 10
            failureThreshold: 18
            httpGet:
              path: /api/v1/livez
              port: 8080
          livenessProbe:
            initialDelaySeconds: 5
            timeoutSeconds: 15
            periodSeconds: 15
            failureThreshold: 20
            httpGet:
              path: /api/v1/health
              port: 8080
          readinessProbe:
            initialDelaySeconds: 5
            timeoutSeconds: 5
            periodSeconds: 5
            failureThreshold: 2
            httpGet:
              path: /api/v1/health
              port: 8080
          resources:
            requests:
              cpu: 475m
              ephemeral-storage: 1Gi
              memory: 725Mi
      affinity:
        
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  app.kubernetes.io/name: lightdash
                  app.kubernetes.io/instance: release-name
                  app.kubernetes.io/component: worker
              topologyKey: kubernetes.io/hostname
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 50
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/name: lightdash
                    app.kubernetes.io/instance: release-name
                    app.kubernetes.io/component: worker
                topologyKey: topology.kubernetes.io/zone
      terminationGracePeriodSeconds: 90

Backend

# Source: lightdash/templates/backendDeployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-lightdash-backend
  labels:
    helm.sh/chart: lightdash-2.2.0
    app.kubernetes.io/name: lightdash
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.2248.0"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: lightdash
      app.kubernetes.io/instance: release-name
      app.kubernetes.io/component: backend
  template:
    metadata:
      annotations:
        checksum/config: 4e7682c130b500610aafd22d6d01d804d639b2a9158e9f02a37d00591a54de4c
        checksum/secrets: aa3ae5f50c91045992f7ea41b45571fb59bab9529519555135af20b3413d4114
      labels:
        app.kubernetes.io/name: lightdash
        app.kubernetes.io/instance: release-name
        app.kubernetes.io/component: backend
    spec:
      securityContext:
        {}
      serviceAccountName: release-name-lightdash
      containers:
        - name: lightdash
          securityContext:
            {}
          image: "lightdash/lightdash:0.2248.0"
          imagePullPolicy: IfNotPresent
          command: 
          args: 
          env:
            - name: PGPASSWORD
              valueFrom:
                secretKeyRef:
                  name: release-name-postgresql
                  key: password
            
          envFrom:
            - configMapRef:
                name: release-name-lightdash
            - secretRef:
                name: release-name-lightdash
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          startupProbe:
            initialDelaySeconds: 5
            timeoutSeconds: 10
            periodSeconds: 10
            failureThreshold: 18
            httpGet:
              path: /api/v1/livez
              port: 8080
          livenessProbe:
            initialDelaySeconds: 5
            timeoutSeconds: 15
            periodSeconds: 15
            failureThreshold: 6
            httpGet:
              path: /api/v1/livez
              port: 8080
          readinessProbe:
            initialDelaySeconds: 5
            periodSeconds: 5
            timeoutSeconds: 5
            failureThreshold: 2
            httpGet:
              path: /api/v1/health
              port: 8080
          resources:
            {}
      affinity:
        
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchLabels:
                  app.kubernetes.io/name: lightdash
                  app.kubernetes.io/instance: release-name
                  app.kubernetes.io/component: backend
              topologyKey: kubernetes.io/hostname
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 50
              podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/name: lightdash
                    app.kubernetes.io/instance: release-name
                    app.kubernetes.io/component: backend
                topologyKey: topology.kubernetes.io/zone
      terminationGracePeriodSeconds: 90

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@almeidabbm
almeidabbm requested a review from ZeRego January 13, 2026 15:23
@almeidabbm almeidabbm self-assigned this Jan 13, 2026
@almeidabbm
almeidabbm marked this pull request as ready for review January 13, 2026 15:25
@almeidabbm
almeidabbm merged commit 9d0a464 into main Jan 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants