zalando / zalando/postgres-operator

Mounting a thesaurus in two locations for a mayor version upgrade does not work.

Open
#2,118 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.2k
Forks
1.1k
Avg merge
2d 16h
Merged PRs (30d)
3

Description

  • Which image of the operator are you using? registry.opensource.zalan.do/acid/postgres-operator:v1.8.2
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? Azure Kubernetes Service
  • Are you running Postgres Operator in production? yes
  • Type of issue? Question/Feature Request

So the original (working) config was:

  additionalVolumes:
  - name: thesaurus
    mountPath: /usr/share/postgresql/13/tsearch_data/extra.ths
    subPath: "legacy/Search/extra.ths"
    targetContainers:
      - postgres
    volumeSource:
      PersistentVolumeClaim:
        claimName: production-data
        readyOnly: true

Tried an upgrade and of course that will complain about the missing file, so tried to mount it twice.

So for example this will not deploy.

  additionalVolumes:
  - name: thesaurus-v13
    mountPath: /usr/share/postgresql/13/tsearch_data/extra.ths
    subPath: "legacy/Search/extra.ths"
    targetContainers:
      - postgres
    volumeSource:
      PersistentVolumeClaim:
        claimName: production-data
        readyOnly: true
  - name: thesaurus-v14
    mountPath: /usr/share/postgresql/14/tsearch_data/extra.ths
    subPath: "legacy/Search/extra.ths"
    targetContainers:
      - postgres
    volumeSource:
      PersistentVolumeClaim:
        claimName: production-data
        readyOnly: true

And them you get FailedMount errors. production-data points to a ReadWriteMany volume (azurefiles).

But this is required to make the pg_upgrade work that inplace_upgrade.py uses. Since none of these locations can be adjusted /usr/share/postgresql/14/tsearch_data is a hard requirement from postgres' side. It would be helpful to have some way of say having "mountPath" also be an array or something. Or maybe I'm overlooking the correct way to deploy custom thesaurus files and the like.

I get that this is maybe a bit of an esoteric issue. But I was wondering of anyone has dealt with this before.

When I manually edit the stateful-set to share the volume definition but still have two volumeMounts
I do get

 Mounts:
      /dev/shm from dshm (rw)
      /home/postgres/pgdata from pgdata (rw)
      /usr/share/postgresql/13/tsearch_data/cxa_locatie.ths from thesaurus (rw,path="legacy/Search/cxa_locatie.ths")
      /usr/share/postgresql/14/tsearch_data/cxa_locatie.ths from thesaurus (rw,path="legacy/Search/cxa_locatie.ths")
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-mwqg2 (ro)

Correctly, but I'm not confident I can use that when upgrading since the stateful set is overwritten by the operator. Although it might point into a direction of a solution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the operator's additionalVolumes configuration and the generated StatefulSet volume and volumeMount definitions; compare them with the manually edited StatefulSet that shares one PVC across both PostgreSQL paths. Done means a supported configuration mounts the thesaurus from production-data at both the PostgreSQL 13 and 14 paths and allows inplace_upgrade.py to deploy without FailedMount errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, postgresql
Domain
databases, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.