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

K8SPSMDB-934: add more logs to mongodb-healthcheck #1587

Merged
merged 27 commits into from
Aug 1, 2024
Merged

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Jul 10, 2024

K8SPSMDB-934 Powered by Pull Request Badge

https://perconadev.atlassian.net/browse/K8SPSMDB-934

DESCRIPTION

This pull request removes a lot of unused code for mongodb-healthcheck.

It also introduces several logging improvements:

  • more log messages
  • setting the default log level to DEBUG
  • storing logs in /data/db/mongod-data/logs/mongodb-healthcheck.log file

Additionally, each time the healthcheck fails, the current log is saved to the gzip compressed file mongodb-healthcheck-<timestamp>.log.gz and the file mongodb-healthcheck.log is reset. Logs older than 24 hours will be deleted.

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?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • 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 MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/XXL 1000+ lines label Jul 10, 2024
@pooknull pooknull marked this pull request as ready for review July 18, 2024 11:28
if requested.Cmp(configured) == 0 || requested.Cmp(actual) == 0 {
if requested.Cmp(configured) == 0 && requested.Cmp(actual) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, the pvc-resize test kept failing in this PR.

There was a case where statefulset had an updated resources (configured var), but pvcs didn't (actual var). In this case it was not possible to start a resize because requested.Cmp(configured) == 0 was true while requested.Cmp(actual) == 0 wasn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

os.Exit(1)
logOpts := zap.Options{
Encoder: getLogEncoder(),
Level: zapcore.DebugLevel,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we set this through some env var? What if a user doesn't want this level of verbosity?

I think this should be configurable. Maybe we don't need to have it now, but maybe a task to have it. Log levels generally should be configurable, especially if we set it to a more verbose level and you can't change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hors hors requested review from egegunes and inelpandzic July 31, 2024 14:20
@JNKPercona
Copy link
Collaborator

Test name Status
arbiter passed
balancer passed
custom-replset-name passed
custom-tls passed
cross-site-sharded passed
data-at-rest-encryption passed
data-sharded passed
demand-backup passed
demand-backup-eks-credentials passed
demand-backup-physical passed
demand-backup-physical-sharded passed
demand-backup-sharded passed
expose-sharded passed
ignore-labels-annotations passed
init-deploy passed
finalizer passed
ldap passed
ldap-tls passed
limits passed
liveness passed
mongod-major-upgrade passed
mongod-major-upgrade-sharded passed
monitoring-2-0 passed
multi-cluster-service passed
non-voting passed
one-pod passed
operator-self-healing-chaos passed
pitr passed
pitr-sharded passed
pitr-physical passed
pvc-resize passed
recover-no-primary passed
rs-shard-migration passed
scaling passed
scheduled-backup passed
security-context passed
self-healing-chaos passed
service-per-pod passed
serviceless-external-nodes passed
smart-update passed
split-horizon passed
storage passed
tls-issue-cert-manager passed
upgrade passed
upgrade-consistency passed
upgrade-consistency-sharded-tls passed
upgrade-sharded passed
users passed
version-service passed
We run 49 out of 49

commit: 1c5a404
image: perconalab/percona-server-mongodb-operator:PR-1587-1c5a4043

@hors hors merged commit b28f74e into main Aug 1, 2024
6 of 8 checks passed
@hors hors deleted the dev/K8SPSMDB-934 branch August 1, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL 1000+ lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants