Skip to content

[Bug]: instanceSidecarConfiguration.env can't override env inherited from the postgres container #1250

Open

Description

@AdzerKI

An env var set in instanceSidecarConfiguration.env is silently dropped when the postgres container already defines it, so TMPDIR, PGHOST and the other variables CNPG sets on the instance can't be changed for the sidecar.

reconcilePodSpec copies the main container env first and then appends the defaults and config.env only for names not already present, so the inherited value always wins.

Where it hurts: barman-cloud-backup stages every upload part in TMPDIR, which the sidecar inherits as /controller/tmp, the disk-backed scratch-data emptyDir. With the default max-archive-size the parts are ~20 MiB, and with data.jobs: 2 up to five of them are in flight. The sidecar memory cgroup (1Gi here) has a low dirty threshold, so most of the base backup goes through the node disk: on a 36 GB database that's about 10 GB of writes per nightly backup, just for temporary files that get deleted right after upload. Pointing TMPDIR at /dev/shm, which the sidecar already mounts, would avoid it, but the setting is ignored.

To reproduce: add

instanceSidecarConfiguration:
  env:
    - name: TMPDIR
      value: /dev/shm

to an ObjectStore, restart the instance and look at the plugin-barman-cloud container env: TMPDIR is still /controller/tmp.

I'd expect the explicitly configured env to take precedence over the inherited one. I'll open a PR that merges config.env before the main container envs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions