Skip to content

CLDSRV-1031: Report the health of every configured KMS - #6347

Merged
bert-e merged 1 commit into
development/9.6from
improvement/CLDSRV-1031-report-health-of-every-kms
Nov 4, 2026
Merged

bert-e merged 1 commit into
development/9.6from
improvement/CLDSRV-1031-report-health-of-every-kms

Conversation

@dvasilas

@dvasilas dvasilas commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Context (S3C-11459): Allow a deployment to configure multiple KMSs.


The deep health check currently reports only the default KMS, keyed by its client type (kmip, aws, fileKms, …). The other configured KMSs are never checked.

This PR runs the existing KMS health check for every configured KMS and reports one entry per KMS, keyed by kms: and its providerName. The prefix keeps a KMS from taking the key of another entry, such as a data location with the same name.

Example:

    "kms:thales": { "code": 200, "message": "OK", "lastChecked": "2026-10-30T09:12:44.000Z" },
    "kms:local": { "code": 200, "message": "OK" },
    "kms:scality": { "code": 200, "message": "OK" }

KMS health stays informational: a failing KMS fails neither start-up nor readiness, even when every KMS fails. A KMS whose client has no health check reports OK without being contacted; today only the KMIP client has one.

@bert-e

bert-e commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Hello dvasilas,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

Comment thread lib/kms/wrapper.js Dismissed
Comment thread lib/kms/wrapper.js Dismissed
Comment thread lib/kms/wrapper.js Dismissed
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.78%. Comparing base (ff05797) to head (9edd6fe).
⚠️ Report is 1 commits behind head on development/9.6.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/kms/wrapper.js 90.59% <100.00%> (+0.59%) ⬆️

... and 2 files with indirect coverage changes

@@                 Coverage Diff                 @@
##           development/9.6    #6347      +/-   ##
===================================================
+ Coverage            90.74%   90.78%   +0.04%     
===================================================
  Files                  207      207              
  Lines                38954    38995      +41     
===================================================
+ Hits                 35348    35402      +54     
+ Misses                3606     3593      -13     
Flag Coverage Δ
checksums-disabled-tests 46.23% <58.24%> (+0.06%) ⬆️
file-ft-tests 75.91% <58.24%> (+0.08%) ⬆️
file-ft-tests-null-compat 76.37% <58.24%> (+0.03%) ⬆️
kmip-ft-tests 43.77% <85.71%> (+0.23%) ⬆️
mongo-v0-ft-tests 76.94% <58.24%> (+0.03%) ⬆️
mongo-v1-ft-tests 76.93% <58.24%> (+0.04%) ⬆️
multiple-backend 44.53% <58.24%> (+0.06%) ⬆️
s3c-ft-tests-v0 71.70% <58.24%> (+0.04%) ⬆️
s3c-ft-tests-v0-null-compat 71.75% <58.24%> (+0.03%) ⬆️
s3c-ft-tests-v1 71.66% <58.24%> (+0.03%) ⬆️
sur-tests 45.08% <58.24%> (-1.14%) ⬇️
sur-tests-inflights 48.44% <58.24%> (+0.04%) ⬆️
unit 80.47% <100.00%> (+0.02%) ⬆️
utapi-v2-tests 45.09% <58.24%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fredmnl fredmnl left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My Claude review surfaced that we could have conflicts in the keys used by the healthchecks if we ever chose a location name that matches a kms provider. It's somewhat new since they weren't both freely chosen fields (kms had only a couple of valid names). I think we can go multiple ways, all of which are fine by me:

  • namespace the kms fields e.g. kms:thales/kms:scality (not sure if we can just go ahead in this PR, it could have side effects on s3-frontend and monitoring which I haven't looked at, but I think we are making breaking changes anyway so it might be the right time to do it)
  • create a ticket and handle later
  • ignore it

At first, I thought that conflicts would be very unlikely but I could see a deployment where one would use city names for data location and for KMSs because they would have multiple regions. Still, I don't know how reasonable that is, hence why ignoring is still a valid option IMO.

The effect would be that two conflicting keys would overwrite each other, and one successful healthcheck could hide an unsuccessful one. We might also report the health status from the other one in the monitoring.

Comment thread lib/kms/wrapper.js Outdated

const shouldRefreshCache = healthCache.shouldRefresh();

if (shouldRefreshCache) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggesting readability nit:

  • Call function inline
  • Process the negation first so we have fewer indent when processing the "should refresh" part

i.e.

Suggested change
if (shouldRefreshCache) {
if (!healthCache.shouldRefresh()) {
// Use cached healthcheck result if within a 1-hour window
if (!healthCache.shouldRefresh()) {
logger.debug('using cached KMS health check', { provider, cachedResult });
return cb(null, cachedResult);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied.

@bert-e

bert-e commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Conflict

There is a conflict between your branch improvement/CLDSRV-1031-report-health-of-every-kms and the
destination branch development/9.6.

Please resolve the conflict on the feature branch (improvement/CLDSRV-1031-report-health-of-every-kms).

git fetch && \
git checkout origin/improvement/CLDSRV-1031-report-health-of-every-kms && \
git merge origin/development/9.6

Resolve merge conflicts and commit

git push origin HEAD:improvement/CLDSRV-1031-report-health-of-every-kms

@fredmnl

fredmnl commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

One more thing: I might be confused with which PR is ongoing or where they're pointed but make sure that the regex in Federation pre-checks and the one validating cloudserver config for KMS names match. I think it's currently ^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$ in Federation and ^[a-z0-9]+$ in cloudserver.

@dvasilas

dvasilas commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

One more thing: I might be confused with which PR is ongoing or where they're pointed but make sure that the regex in Federation pre-checks and the one validating cloudserver config for KMS names match. I think it's currently ^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$ in Federation and ^[a-z0-9]+$ in cloudserver.

Good catch, I have created S3C-11505 for this.

@dvasilas

dvasilas commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

My Claude review surfaced that we could have conflicts in the keys used by the healthchecks if we ever chose a location name that matches a kms provider. It's somewhat new since they weren't both freely chosen fields (kms had only a couple of valid names). I think we can go multiple ways, all of which are fine by me:

  • namespace the kms fields e.g. kms:thales/kms:scality (not sure if we can just go ahead in this PR, it could have side effects on s3-frontend and monitoring which I haven't looked at, but I think we are making breaking changes anyway so it might be the right time to do it)
  • create a ticket and handle later
  • ignore it

At first, I thought that conflicts would be very unlikely but I could see a deployment where one would use city names for data location and for KMSs because they would have multiple regions. Still, I don't know how reasonable that is, hence why ignoring is still a valid option IMO.

The effect would be that two conflicting keys would overwrite each other, and one successful healthcheck could hide an unsuccessful one. We might also report the health status from the other one in the monitoring.

My claude review also flagged it, and I first thought a conflict is very unlikely, but your comment changed my mind.
I think adding the kms: prefix to KMS keys in the healthcheck is a good option. It doesn't break the consumers, s3-frontend only logs the deep check body.

I also considered nesting (something like { kms: { <providerName1>: { }, <providerName2>: { }, ... } } but it requires updating ringinfo.sh in the ring repo.

@dvasilas
dvasilas force-pushed the improvement/CLDSRV-1031-report-health-of-every-kms branch from 8973404 to 917dc94 Compare November 4, 2026 19:55
@bert-e

bert-e commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

Comment thread tests/unit/healthchecks/clientCheck.js Resolved
The deep health check has one entry per configured KMS, keyed by kms: and its providerName, each with its own cache; KMS failures stay informational.
@dvasilas
dvasilas force-pushed the improvement/CLDSRV-1031-report-health-of-every-kms branch from 917dc94 to 9edd6fe Compare November 4, 2026 19:59
@dvasilas

dvasilas commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve

@bert-e
bert-e merged commit 9edd6fe into development/9.6 Nov 4, 2026
37 checks passed
@bert-e

bert-e commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

I have successfully merged the changeset of this pull request
into targetted development branches:

  • ✔️ development/9.6

The following branches have NOT changed:

  • development/7.10
  • development/7.4
  • development/7.70
  • development/8.8
  • development/9.0
  • development/9.1
  • development/9.2
  • development/9.3
  • development/9.4
  • development/9.5

This pull request did not target the following hotfix branch(es) so they
were left untouched:

  • hotfix/7.10.8
  • hotfix/7.70.73
  • hotfix/7.10.30
  • hotfix/7.10.2
  • hotfix/7.8.0
  • hotfix/7.10.28
  • hotfix/7.4.9
  • hotfix/7.4.0
  • hotfix/7.10.3
  • hotfix/7.7.0
  • hotfix/7.10.49
  • hotfix/7.70.11
  • hotfix/7.9.0
  • hotfix/7.10.15
  • hotfix/9.3.13
  • hotfix/7.4.5
  • hotfix/7.70.51
  • hotfix/7.4.4
  • hotfix/7.6.0
  • hotfix/8.8.45
  • hotfix/9.2.24
  • hotfix/7.10.27
  • hotfix/7.4.1
  • hotfix/7.10.1
  • hotfix/7.4.6
  • hotfix/7.4.8
  • hotfix/7.2.0
  • hotfix/9.2.36
  • hotfix/7.10.0
  • hotfix/7.4.10
  • hotfix/9.0.32
  • hotfix/7.4.2
  • hotfix/7.70.45
  • hotfix/9.0.7
  • hotfix/7.4.7
  • hotfix/7.70.21
  • hotfix/6.4.7
  • hotfix/7.4.3
  • hotfix/7.10.4

Please check the status of the associated issue CLDSRV-1031.

Goodbye dvasilas.

The following options are set: approve

@bert-e
bert-e deleted the improvement/CLDSRV-1031-report-health-of-every-kms branch November 4, 2026 20:18
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.

5 participants