zalando / zalando/postgres-operator

Improving Postgres CR Status with Additional Details

Open
#2,669 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue help wanted
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? e.g. ghcr.io/zalando/postgres-operator:v1.12.2
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? Bare Metal K8s
  • Are you running Postgres Operator in production? yes
  • Type of issue? feature request

Hi,
Currently the status field of the postgresql CR looks something like:

status:
  PostgresClusterStatus: Running

I'd like to propose following changes to the status:

  • Number Of Instances can be added to the status to indicate the number of running pods associated with the Postgres CR
  • Label Selector can be included in the status to define the label criteria applied to pods linked with the Postgres CR and this is also required for scale subresource.
  • Observed generation: It would be useful in identifying if the operator has made any changes to the CR after the CR spec has been updated.
  • LastTransitionTime can also be added to to provide insights into the state and lifecycle of resources.

post these changes, the status field of the postgresql CR would look something like this:

status:
  labelSelector: cluster-name=postgres-cluster-pvc-5
  numberOfInstances: 3
  conditions:
  - lastTransitionTime: "2024-06-03T10:18:04Z"
    status: "True"
    type: postgresClusterStatusRunning
  observedGeneration: 2

Along with this, I am proposing to add scale subresource in the CRD of postgresql as well, which would use some of the fields proposed above, and then this scale subresource can be further used by external systems to scale or monitor the CR. This scale subresource would look something like this:

 subresources:
   status: {}
   scale:
       specReplicasPath: .spec.numberOfInstances  
       statusReplicasPath: .status.numberOfInstances  
       labelSelectorPath: .status.labelSelector

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

No files or tests are named. Start by locating the postgresql CRD and the operator entry points that construct its status, then trace how scale subresources are declared and served. Done means agreeing on and implementing the proposed status details and scale paths, with coverage for the resulting CR behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.