Repository navigation
[Improvement-17813][ApiServer][Part2] Add an optional connectivity check on datasource create and update - #18739
Open
njnu-seafish wants to merge 4 commits into
Open
njnu-seafish wants to merge 4 commits into
njnu-seafish wants to merge 4 commits into
Conversation
njnu-seafish
requested review from
Gallardot,
SbloodyS and
caishunfeng
as code owners
October 26, 2026 04:37
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was this PR generated or assisted by AI?
YES. Optimize and refine the code using AI after writing it.
Purpose of the pull request
Part of #17813.
This PR implements the "connectivity check on save" route from the #17813 discussion
(option 1 there), in the shape that discussion converged on:
So this PR adds
api.datasource-connection-check-enabled(defaultfalse):One placement detail worth calling out: on update, the check runs after the password resolution (the existing blank-keeps-old-password backfill), so it always tests the effective credentials that are about to be persisted — when the user keeps the old password, the connectivity is verified against that old password. The unit test locks this with an ArgumentCaptor assertion.
This PR complements the write-path guard PR (Improvement-17813 branch, "Treat the mask value returned by query APIs as an unmodified password when updating a datasource"): with the guard merged, editing a datasource without touching the password resolves to the old password, this check then validates it end-to-end, and the save succeeds — the two layers close the loop.
Brief change log
ApiConfig: newdatasourceConnectionCheckEnabledflag (defaultfalse), bound toapi.datasource-connection-check-enabled.DataSourceServiceImpl:createDataSource/updateDataSourcecallcheckConnectionBeforePersistwith the assembledConnectionParam(gated by the flag); on update this happens after the password backfill.application.yaml, standalone-serverapplication.yaml, k8svalues.yaml(customizedConfig example),configuration.md(en + zh).DataSourceServiceTest+ 1 inApiConfigTest.(
datasource-connection-check-disabled/datasource-connection-check-enabled),DataSourceConnectionCheckDisabledAPITest/DataSourceConnectionCheckEnabledAPITestasserting create/update with an unreachable host succeeds when disabled and fails when enabled, plus aDataSourcePageclient andpostJson/putJsonhelpers.Verify this pull request
Unit tests (18/18 in
DataSourceServiceTest, 4/4 inApiConfigTest):never())CONNECTION_TEST_FAILURE) with no row persisted (insertnever called)connectionParamskeep itApiConfigTestasserts the yaml binding takes effectPull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md