Skip to content

K8SPG-768 skip log creation #1217

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

nmarukovich
Copy link
Contributor

@nmarukovich nmarukovich commented Jul 9, 2025

K8SPG-768 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
Excessive log generation from the replication-cert-copy container within the Postgres database pod. The container checks available disk space, and if the free volume is less than 75%, it triggers a Kubernetes API call to update the pod annotation with a suggested volume size (e.g., suggested-pgdata-pvc-size: 15345Mi).

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Avoid updating the pod annotation unless AutoGrowVolumes is enabled.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Copy link
Contributor

@gkech gkech left a comment

Choose a reason for hiding this comment

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

overall everything is fine, tested a little with fallocate and couldn't see the logs that we have in main (per jira)

Comment on lines -236 to -250

# Manage autogrow annotation.
# Return size in Mebibytes.
size=$(df --human-readable --block-size=M /pgdata | awk 'FNR == 2 {print $2}')
use=$(df --human-readable /pgdata | awk 'FNR == 2 {print $5}')
sizeInt="${size//M/}"
# Use the sed punctuation class, because the shell will not accept the percent sign in an expansion.
useInt=$(echo $use | sed 's/[[:punct:]]//g')
triggerExpansion="$((useInt > 75))"
if [ $triggerExpansion -eq 1 ]; then
newSize="$(((sizeInt / 2)+sizeInt))"
newSizeMi="${newSize}Mi"
d='[{"op": "add", "path": "/metadata/annotations/suggested-pgdata-pvc-size", "value": "'"$newSizeMi"'"}]'
curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -XPATCH "${APISERVER}/api/v1/namespaces/${NAMESPACE}/pods/${HOSTNAME}?fieldManager=kubectl-annotate" -H "Content-Type: application/json-patch+json" --data "$d"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be nice to add a unit test with the FG enabled so that we can assert that is part exists in the script. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I think it's a good point. I will fix it.

@nmarukovich nmarukovich requested a review from gkech July 14, 2025 17:02
@JNKPercona
Copy link
Collaborator

Test Name Result Time
backup-enable-disable passed 00:06:48
custom-extensions passed 00:08:38
custom-tls passed 00:04:51
database-init-sql passed 00:03:27
demand-backup passed 00:25:52
finalizers passed 00:03:51
init-deploy passed 00:03:11
monitoring passed 00:07:39
monitoring-pmm3 passed 00:08:03
one-pod passed 00:06:33
operator-self-healing passed 00:08:29
pgvector-extension passed 00:02:33
pitr passed 00:14:27
scaling passed 00:04:43
scheduled-backup passed 00:28:23
self-healing passed 00:08:16
sidecars passed 00:02:35
start-from-backup passed 00:11:47
tablespaces passed 00:07:50
telemetry-transfer passed 00:03:20
upgrade-consistency passed 00:06:38
upgrade-minor failure 00:03:32
users passed 00:03:38
We run 23 out of 23 03:05:16

commit: 508d86b
image: perconalab/percona-postgresql-operator:PR-1217-508d86bc5

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