Skip to content

Move database validation to gRPC methods#28619

Merged
gabrielcorado merged 2 commits intomasterfrom
gabrielcorado/change-database-validation
Jul 4, 2023
Merged

Move database validation to gRPC methods#28619
gabrielcorado merged 2 commits intomasterfrom
gabrielcorado/change-database-validation

Conversation

@gabrielcorado
Copy link
Copy Markdown
Contributor

Closes #27904 by not calling the services.ValidateDatabase on cache initialization and not preventing cache initialization when database validation fails. The CheckAndSetDefaults is still being called on the database service.

The services.ValidateDatabase call is now into gRPC methods CreateDatabase and UpdateDatabase. Following other resources that perform their validations on gRPC methods (such as Access requests and Users).

Regarding invalid databases being stored on the database agent cache, this behavior will be similar to before #18776. This PR is not intended to change it, and it will be done in future PRs.

Copy link
Copy Markdown
Contributor

@espadolini espadolini left a comment

Choose a reason for hiding this comment

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

Why should the rpc layer be responsible for this, other than tradition? Is it to have the validation done before authz?

LGTM for consistency but would also LGTM if the check was moved to (*Server)CreateDatabase and (*Server)UpdateDatabase, not sure which one is the "more correct" one.

Copy link
Copy Markdown
Contributor

@smallinsky smallinsky left a comment

Choose a reason for hiding this comment

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

@gabrielcorado
Seems that one of UT needs to be aligned.

@gabrielcorado gabrielcorado enabled auto-merge July 4, 2023 13:32
@gabrielcorado gabrielcorado added this pull request to the merge queue Jul 4, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 4, 2023
@gabrielcorado gabrielcorado added this pull request to the merge queue Jul 4, 2023
Merged via the queue into master with commit a62b109 Jul 4, 2023
@gabrielcorado gabrielcorado deleted the gabrielcorado/change-database-validation branch July 4, 2023 13:57
@public-teleport-github-review-bot
Copy link
Copy Markdown

@gabrielcorado See the table below for backport results.

Branch Result
branch/v11 Failed
branch/v12 Failed
branch/v13 Create PR

gabrielcorado added a commit that referenced this pull request Jul 4, 2023
* refactor: move database validation to grpc

* test(local): update CRUD databases test
gabrielcorado added a commit that referenced this pull request Jul 4, 2023
* refactor: move database validation to grpc

* test(local): update CRUD databases test
github-merge-queue Bot pushed a commit that referenced this pull request Jul 4, 2023
* refactor: move database validation to grpc

* test(local): update CRUD databases test
github-merge-queue Bot pushed a commit that referenced this pull request Jul 4, 2023
* refactor: move database validation to grpc

* test(local): update CRUD databases test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache initialisation bad state Database Valdiation

4 participants