Skip to content

feat: add pod scheduling support for operator HA#213

Open
jetroberts wants to merge 1 commit intoakyriako:mainfrom
jetroberts:feature/operator-ha-scheduling
Open

feat: add pod scheduling support for operator HA#213
jetroberts wants to merge 1 commit intoakyriako:mainfrom
jetroberts:feature/operator-ha-scheduling

Conversation

@jetroberts
Copy link

Summary

Fixes #209 - Adds pod scheduling configuration support for operator controller pods to enable high availability deployments.

Problem

When deploying the operator with multiple replicas for HA, pods could be scheduled on the same node, undermining fault tolerance. Users had no way to configure pod anti-affinity or other scheduling constraints.

Solution

Added support for affinity, nodeSelector, and tolerations in Helm values, following the same pattern used by the TypesenseCluster CRD.

Changes

  • Helm Values (values.yaml): Added affinity, nodeSelector, tolerations fields (opt-in, empty by default)
  • Deployment Template (deployment.yaml): Wire values to pod spec using {{- with }} blocks
  • Chart Version (Chart.yaml): Bumped to 0.3.6
  • Documentation (README.md): Added HA configuration section with example

Testing

✅ Helm chart lints successfully
✅ Default configuration renders without affinity (backward compatible)
✅ HA configuration with anti-affinity renders correctly
✅ Deployed on Kind 2-node cluster - pods scheduled on different nodes
✅ Pod rescheduling works correctly with anti-affinity constraints
✅ Leader election works with multiple replicas

Example Usage

# values.yaml
controllerManager:
  replicas: 2
  affinity:
    podAntiAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchExpressions:
              - key: control-plane
                operator: In
                values: [controller-manager]
          topologyKey: kubernetes.io/hostname

Backward Compatibility

✅ Fully backward compatible

  • All new fields default to empty ({} or [])
  • Existing deployments unaffected
  • Opt-in configuration approach

Files Changed

  • charts/typesense-operator/values.yaml (+3 lines)
  • charts/typesense-operator/templates/deployment.yaml (+9 lines)
  • charts/typesense-operator/Chart.yaml (version bump)
  • charts/typesense-operator/README.md (+23 lines)

Total: 4 files changed, 36 insertions(+), 1 deletion(-)

- Add affinity, nodeSelector, tolerations to Helm values
- Update deployment template to use scheduling fields
- Add HA configuration example to README
- Bump chart version to 0.3.6

Fixes akyriako#209
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.

Feature: Enforce Operator Pods Scheduling on Separate Nodes for High Availability

1 participant