How to set strict pod affinity for a chart that utilizes bitnami common chart (Appsmith)

20 Views Asked by At

I have a deployed and working self-hosted Appsmith community instance on GKE. The problem I have is that its components could be scattered across different k8s nodes which can cause service outage if one of those nodes fails. The deployment is done using helm chart that is based on bitnami common chart: https://github.com/bitnami/charts/tree/main/bitnami/appsmith Here is how it looks:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: infra-appsmith
  namespace: infra-<...>
spec:
  destination:
    namespace: infra-appsmith
    server: https://kubernetes.default.svc
  project: infra
  source:
    chart: appsmith
    helm:
      releaseName: appsmith
      values: |-
        mongodb:
          replicaCount: 1
          useStatefulSet: true
          arbiter:
            enabled: false
        global:
          storageClass: premium-rwo
        redis:
          enabled: true
          architecture: standalone
        image:
          tag: v1.11
          pullPolicy: IfNotPresent
        tolerations:
          - key: "cloud.google.com/gke-preemptible"
            operator: "Equal"
            value: "true"
            effect: "NoSchedule"
        probes:
          startupProbe:
            failureThreshold: 6
          livenessProbe:
            failureThreshold: 6
    repoURL: https://helm.appsmith.com
    targetRevision: 2.0.7
  syncPolicy:
    syncOptions:
    - CreateNamespace=true

As I understand from the documentation to solve my issue I only need to add one add podAffinityPreset: hard in each of every: backend, client, rts i.e. add those 6 lines in values:

  values: |-
    backend:
      podAffinityPreset: hard
    client:
      podAffinityPreset: hard
    rts:
      podAffinityPreset: hard

But contrary to my expectation, when I hit describe for those STS, I always get the same affinity block (here's an example for MongoDB):

spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/component: mongodb
      app.kubernetes.io/instance: appsmith
      app.kubernetes.io/name: mongodb
  serviceName: appsmith-mongodb
  template:
    ...
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                labelSelector:
                  matchLabels:
                    app.kubernetes.io/component: mongodb
                    app.kubernetes.io/instance: appsmith
                    app.kubernetes.io/name: mongodb
                namespaces:
                  - infra-appsmith
                topologyKey: kubernetes.io/hostname
              weight: 1

So, the question is how to ensure strict pod/sts affinity using bitnami common chart features? Or specifically using appsmith chart values?

0

There are 0 best solutions below