Skip to content

Conversation

@nammn
Copy link
Collaborator

@nammn nammn commented Dec 16, 2025

Summary

This pull request fixes the issue: "Monitoring fails to start when disabling TLS"

This pull request addresses a bug where monitoring agents could fail after disabling TLS on a MongoDB deployment, and refactors the code to improve monitoring agent configuration and TLS parameter handling. The changes ensure that TLS-specific parameters are properly cleared when TLS is disabled, preventing monitoring agents from referencing certificate files that no longer exist. The refactor also improves code clarity and reliability by replacing deprecated methods and updating function names to better reflect their behavior.

Proof of Work

  • green patch

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you added changelog file?

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

⚠️ (this preview might not be accurate if the PR is not rebased on current master branch)

MCK 1.6.2 Release Notes

Bug Fixes

  • Fixed an issue where monitoring agents would fail after disabling TLS on a MongoDB deployment.
  • Persistent Volume Claim resize fix: Fixed an issue where the Operator ignored namespaces when listing PVCs, causing conflicts with resizing PVCs of the same name. Now, PVCs are filtered by both name and namespace for accurate resizing.

tags: [ "pr_patch", "staging", "e2e_test_suite", "static" ]
run_on:
- ubuntu2404-large
<<: *base_om8_dependency
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

revert me once the image build has been fixed for the database image

@nammn nammn force-pushed the fix-tls-stopping branch 4 times, most recently from 2d967f1 to 73a98ff Compare December 18, 2025 13:31
When TLS is disabled on AppDB, clear stale TLS params from monitoring
config's additionalParams to prevent the monitoring agent from trying
to use certificate files that no longer exist.

Added addTLSParams/clearTLSParams functions that use shared constants
to ensure add and remove operations stay in sync.
1. Fix type assertion in clearTLSParamsFromMonitoringVersion to handle
   both map[string]string (locally created) and map[string]interface{}
   (from JSON/API unmarshaling)

2. Fix addMonitoring to update TLS params on existing monitoring entries
   when TLS is enabled (previously only added TLS for new entries)

3. Fix trueString constant to be "true" instead of "trueString"
@nammn nammn marked this pull request as ready for review December 19, 2025 13:54
@nammn nammn requested review from a team and vinilage as code owners December 19, 2025 13:54
}
d.AddMonitoring(log, tls, caFilepath)
d.ConfigureMonitoring(log, tls, caFilepath)
d.addBackup(log)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: if we are renaming addXXX functions to configureXXX let's do the same for addBackup

}
}

func addMonitoring(ac *automationconfig.AutomationConfig, log *zap.SugaredLogger, tls bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: configureMonitoring

Copy link
Collaborator

@MaciejKaras MaciejKaras left a comment

Choose a reason for hiding this comment

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

Very nice!

It's a pity though that we have different object for Deployment in OM and in AppDB so the logic has to be maintained in two places.

Comment on lines +1 to +6
---
kind: fix
date: 2025-12-16
---

* Fixed an issue where monitoring agents would fail after disabling TLS on a MongoDB deployment.
Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM!

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.

4 participants