Helm chart not creating affinity for backup job

Description:

The backup job needs to run on a node with storage and amd64 architecture. However, while affinity is specified in the values file, it does not show up in the PerconaPGBackup CRD or in the resultant job spec.

Steps to Reproduce:

This is the relevant section of the values file:

backups:
  pgbackrest:
    repoHost:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              labelSelector:
                matchLabels:
                  postgres-operator.crunchydata.com/data: pgbackrest
              topologyKey: kubernetes.io/hostname
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - amd64
              - key: node-role.kubernetes.io/storage
                operator: Exists

Version:

2.3.1

Logs:

Expected Result:

The backup job scheduled on a node that meets the requirements

Actual Result:

The backup job is scheduled on an unsupported architecture (arm64)

Additional Information:

Hello @simonpg ,

please try the following section for affinity:

  backups:
    pgbackrest:
      ...
      jobs:
        affinity:
          nodeAffinity:
...

That worked, of course. :man_facepalming: One minor issue: Adding only an affinity section produced the following error:

Error: UPGRADE FAILED: template: pg-db/templates/cluster.yaml:288:27: executing "pg-db/templates/cluster.yaml" at <.Values.backups.pgbackrest.jobs.resources.limits.cpu>: nil pointer evaluating interface {}.limits

I uncommented the resources section and the upgrade worked.