Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Postgres CR Status with Additional Details #2669

Open
ravina-c opened this issue Jun 19, 2024 · 2 comments · May be fixed by #2714
Open

Improving Postgres CR Status with Additional Details #2669

ravina-c opened this issue Jun 19, 2024 · 2 comments · May be fixed by #2714

Comments

@ravina-c
Copy link

  • 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
@FxKu
Copy link
Member

FxKu commented Jun 24, 2024

#1698 just for reference. I would be happy to help and review a PR.

Let's start small first and have maybe only observedGeneration (because it was also mentioned in #1698) and lastTransitionTime - I would also need to look up which status fields K8s currently recommends. I think, showing status of child resources could also be useful. But let's start small first and also be backwards compatible with the current status field.

@ravina-c
Copy link
Author

Sure, I am working on the code changes, will submit a draft PR soon.

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants