# Helm chart not creating affinity for backup job

**URL:** <https://forums.percona.com/t/helm-chart-not-creating-affinity-for-backup-job/29894>\
**Category:** Percona Operator for PostgreSQL\
**Created:** [April 27, 2024, 6:32am UTC](https://forums.percona.com/t/helm-chart-not-creating-affinity-for-backup-job/29894 "2024-04-27T06:32:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonpg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/simonpg/32/16149_2.png) [@simonpg](https://forums.percona.com/u/simonpg)\
**Post date:** [April 27, 2024, 6:32am UTC](https://forums.percona.com/t/helm-chart-not-creating-affinity-for-backup-job/29894/1 "2024-04-27T06:32:11Z")

</div>

## 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:

```auto
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:

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [April 29, 2024, 1:30pm UTC](https://forums.percona.com/t/helm-chart-not-creating-affinity-for-backup-job/29894/2 "2024-04-29T13:30:16Z")

</div>

Hello @simonpg ,

please try the following section for affinity:

```auto
  backups:
    pgbackrest:
      ...
      jobs:
        affinity:
          nodeAffinity:
...

```

---

<div class="post-metadata">

**Author:** ![simonpg](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/simonpg/32/16149_2.png) [@simonpg](https://forums.percona.com/u/simonpg)\
**Post date:** [April 29, 2024, 2:54pm UTC](https://forums.percona.com/t/helm-chart-not-creating-affinity-for-backup-job/29894/3 "2024-04-29T14:54:48Z")

</div>

That worked, of course. 🤦‍♂️ One minor issue: Adding only an affinity section produced the following error:

```auto
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.
