Skip to content

Remove Divisor from Downward API resrouceFieldRefs #4231

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

Merged

Conversation

andrewlecuyer
Copy link
Collaborator

Remove divisor from Downward API resrouceFieldRefs. This means CPU and memory information will now be exposed using the default divisor for CPU and memory (with default being "1" for both). This means memory information will now be represented in bytes, as expected by pgMonitor and the CPK Metrics & Monitoring stack when consuming Downward API information.

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • New feature
  • Bug fix
    Fixes memory metrics in the Metrics & Monitoring stack.
  • Documentation
  • Testing enhancement
  • Other

What is the current behavior (link to any open issues here)?
The divisor for the Downward API volumes for CPU and memory defaults to 1m for CPU and 1Mi for memory.

What is the new behavior (if this is a feature change)?

  • Breaking change (fix or feature that would cause existing functionality to change)
    Potential breaking behavior if anyone is consuming Downward API info via a custom sidecar.

Other Information:

Issue: PGO-2604

This means CPU and memory information will now be exposed using the default
divisor for CPU and memory (with default being "1" for both).  This means memory
information will now be represented in bytes, as expected by pgMonitor and the
CPK Metrics & Monitoring stack when  consuming Downward API information.

Issue: PGO-2604
@andrewlecuyer andrewlecuyer force-pushed the remove-downward-api-divisor branch from 867e83c to 114fcea Compare August 5, 2025 22:03
@benjaminjb
Copy link
Contributor

The default divisor is "1" (reasonable) but in reconcile_test.go, it looks like "0" (maddening)?

@andrewlecuyer
Copy link
Collaborator Author

@benjaminjb agreed! Looks like without a full Kube running we won't get the default of 1.

Copy link
Contributor

@benjaminjb benjaminjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want a release note for this, but I can't think of any other docs that need to change, can you?

@andrewlecuyer
Copy link
Collaborator Author

Just noting that I tested this with the monitoring stack, and everything looks good.

E.g. for this spec:

apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
  name: hippo
  namespace: postgres-operator
spec:
  instrumentation: {}
  postgresVersion: 17
  instances:
    - name: instance1
      replicas: 2
      resources:
        requests:
          cpu: 1
          memory: "1Gi"
      dataVolumeClaimSpec:
        accessModes:
        - "ReadWriteOnce"
        resources:
          requests:
            storage: 1Gi

I see this on the file system:

$ cat mem_request
1073741824
$ cat cpu_request
1

And then the dashboard accurately reflects the memory reqiest:

Screenshot 2025-08-08 at 4 52 12 PM

@andrewlecuyer
Copy link
Collaborator Author

@benjaminjb agreed, release notes should be sufficient.

@andrewlecuyer andrewlecuyer merged commit a69a1d5 into CrunchyData:main Aug 8, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants