Skip to content

tidb-cloud: add CMEK documentation for Google Cloud - #24792

Open
xboxeer wants to merge 3 commits into
pingcap:masterfrom
xboxeer:feat/cmek-gcp-doc
Open

xboxeer wants to merge 3 commits into
pingcap:masterfrom
xboxeer:feat/cmek-gcp-doc

Conversation

@xboxeer

@xboxeer xboxeer commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What is changed, added, or deleted? (Required)

Add a new page tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md and link it in TOC-tidb-cloud.md under Data Access Control.

The page documents how to encrypt TiDB Cloud Dedicated data with a customer-managed key in Google Cloud KMS:

  • Select the Dedicated key scope and add the CMEK configuration under Organization Settings > CMEK.
  • Copy the full key name returned by the console, which is the name prefix plus the TiDB Cloud-generated suffix.
  • Create the key ring and a symmetric key in Cloud KMS, in the region selected in the console.
  • Grant roles/cloudkms.cryptoKeyEncrypterDecrypter to both service agents: Compute Engine (cluster disks) and Cloud Storage (backups). Both grants are required.
  • Paste the Cloud KMS key resource name and verify the configuration.
  • Rotate, revoke, and restore CMEK access.

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)

What is the related PR or file link(s)?

  • Related code change PR links (if applicable): N/A
  • This PR is translated from: N/A
  • Other reference link(s): N/A

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Notes for reviewers

  • The existing AWS and Azure CMEK pages still describe the previous project-level flow (Project Settings > Encryption Access). This new page follows the current organization-level flow (Organization Settings > CMEK). Aligning the other two pages can be handled in a follow-up PR.
  • This first version is text-only and does not include console screenshots.

Summary by CodeRabbit

  • Documentation
    • Added a Google Cloud guide for configuring customer-managed encryption keys (CMEK) for TiDB Cloud Dedicated cluster data and backups.
    • The guide covers project and region requirements, key setup, required service-agent permissions, key selection and rotation, and how to revoke or restore access.
    • It clarifies that clusters with changefeeds or PITR enabled must have those features removed or disabled before they can be paused, and that running VM disks may remain accessible until shutdown.
    • It explains that key-dependent operations fail after affected clusters are paused until key versions and required permissions are restored.
    • Added a link to the guide in the TiDB Cloud table of contents.

Add a page describing how to encrypt TiDB Cloud Dedicated data with a customer-managed key in Google Cloud KMS, covering key scope selection, service agent authorization, key resource name configuration, and revocation.
@ti-chi-bot

ti-chi-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign csuzhangxc for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 2, 2026
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

The TiDB Cloud documentation adds a Google Cloud guide for using customer-managed encryption keys (CMEK) with Dedicated clusters and backups. The table of contents links to the guide.

Changes: Google Cloud CMEK documentation

Layer / File(s) Summary
Project and key setup
tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md, TOC-tidb-cloud.md
The guide describes CMEK restrictions, project configuration, and regional Cloud KMS key creation. The table of contents links to the guide.
Permissions and cluster use
tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md
The guide describes the required service-agent permissions, key verification, and key matching for cluster creation.
Key lifecycle
tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md
The guide covers automatic key rotation, revocation conditions, and restoration of access and disabled key versions. It also documents restrictions on pausing clusters and disk access until shutdown.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: qiancai, lilin90

Merge Risk: Moderate · up to c5e7f

The new Google Cloud CMEK guide's revocation and restore sections are incomplete. Readers may believe access is revoked while other grants still allow decryption, or while a change is still propagating. After restoring access they may be left without point-in-time restore and without changefeeds. These are small documentation fixes that should be made before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a new CMEK documentation page for Google Cloud in TiDB Cloud. It matches the changeset, which adds tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md and a TOC link. The title …
Description check Passed The description covers the required sections of the template: what changed, the TiDB version selection (master), related PR or file links, and AI agent involvement. The first-time contributor checklis…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a new CMEK documentation page for Google Cloud in TiDB Cloud. It matches the changeset, which adds tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md and a TOC link. The title is short, specific, and in the repository's expected format.

Full details: Description check

Explanation

The description covers the required sections of the template: what changed, the TiDB version selection (master), related PR or file links, and AI agent involvement. The first-time contributor checklist and the Contributor License Agreement item are not addressed, and the template's 'Do your changes match' checklist is filled in. The required 'What is changed' section is detailed and accurate. Missing items are minor, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Major 2
  1. Revoke access to every active key version.
  2. Pause only clusters affected by the revoked key.
Minor 1
  1. Specify the Google Cloud project for the CLI commands.
Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: aff3f03
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 7b29e25c-0551-4b58-9a8c-a4b8cc5a6838
Commits

Reviewing files that changed from the base of the PR and between aff3f03 and 6182804.

Files selected for processing: 2

  • TOC-tidb-cloud.md
  • tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@qiancai qiancai added translation/no-need No need to translate this PR. area/tidb-cloud This PR relates to the area of TiDB Cloud. labels Dec 2, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Dec 2, 2026
@qiancai qiancai added missing-translation-status This PR does not have translation status info. for-cloud-release This PR is related to TiDB Cloud release. labels Dec 2, 2026
Specify the Google Cloud project in the gcloud commands, revoke access to all key versions, and limit the pause and resume steps to clusters that use the affected regional key.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Major 1
  1. Account for inherited key access.
Minor 2
  1. Add the pause prerequisites before the revocation steps.
  2. The revocation note states access loss before running VMs stop.
Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: aff3f03
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b2ed0f57-c00f-4e75-a5fc-ee595a4200ff
Commits

Reviewing files that changed from the base of the PR and between 6182804 and 52c33c1.

Files selected for processing: 1

  • tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Note inherited key ring and project level grants, add the pause prerequisites for clusters with PITR or changefeeds, and explain when attached disks become inaccessible.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Major 2
  1. Restore the features disabled for the pause.
  2. Check all effective decrypt grants.
Minor 1
  1. Revocation takes time to become effective.
Review info

Run configuration

  • Source mode: Auto
  • Repository: pingcap/docs
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: aff3f03
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 215ecc39-b25e-4c21-91b3-22333d5639ab
Commits

Reviewing files that changed from the base of the PR and between 52c33c1 and c5e7f63.

Files selected for processing: 1

  • tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.


> **Note:**
>
> Step 2 pauses the affected clusters. You cannot pause a cluster that has [changefeeds](/tidb-cloud/changefeed-overview.md) or [Point-in-Time Restore (PITR)](/tidb-cloud/backup-and-restore.md#turn-on-point-in-time-restore) enabled, so delete the changefeeds or turn off PITR first. For details, see [Limitations](/tidb-cloud/pause-or-resume-tidb-cluster.md#limitations).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Data Integrity & Integration · Quick win

Restore the features disabled for the pause.

After restoration, the procedure resumes the clusters but does not restore PITR or the deleted changefeeds. PITR and replication therefore remain disabled. Ask readers to record the affected settings before revocation and restore them after the clusters resume. (raw.githubusercontent.com)


> **Note:**
>
> Removing the key-level role bindings revokes access to all versions of the key at once, provided that neither service agent also holds a decrypt-capable role granted at the key ring or project level. If such an inherited grant exists, remove it at that level as well. Alternatively, disable every enabled version of the key, not only the current one. Data and backups written before a rotation are still protected by the earlier versions, so disabling only the newest version leaves them decryptable. Record which versions you disable so that you can re-enable them when you restore access.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Major · Security & Privacy · Quick win

Check all effective decrypt grants.

A service agent can have another decrypt-capable grant directly on the key or inherit one from a folder or organization. Removing the Step 2 bindings and checking only the key ring and project leaves that access intact. Instruct readers to check and remove all applicable grants, or disable every enabled key version. (docs.cloud.google.com)


Minor · Security & Privacy · Quick win

Revocation takes time to become effective.

Disabling a key version and removing a role binding are both eventually consistent. A disabled key version can stay usable for up to 1 minute, and in exceptional cases for several hours. A removed IAM role binding can take about 2 minutes, and 7 minutes or longer in some cases. Pausing the clusters in Step 2 does not confirm that the change has taken effect. Wait for the change to take effect before you treat access as revoked.

Suggested note

--- "a/tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md"
+++ "b/tidb-cloud/tidb-cloud-encrypt-cmek-gcp.md"
@@ -183,7 +183,9 @@
 
     > **Note:**
     >
     > Removing the key-level role bindings revokes access to all versions of the key at once, provided that neither service agent also holds a decrypt-capable role granted at the key ring or project level. If such an inherited grant exists, remove it at that level as well. Alternatively, disable every enabled version of the key, not only the current one. Data and backups written before a rotation are still protected by the earlier versions, so disabling only the newest version leaves them decryptable. Record which versions you disable so that you can re-enable them when you restore access.
+    >
+    > Disabling a key version and removing a role binding are eventually consistent changes. A disabled key version typically stops working within 1 minute, but can remain usable for several hours in exceptional cases. A removed role binding typically takes effect within 2 minutes, and can take 7 minutes or longer. Pausing the clusters in Step 2 does not confirm that the change has taken effect. Wait for the change to take effect before you treat access as revoked.
 
 2. In the TiDB Cloud console, pause the clusters that use this key, that is, the clusters in the region of the key. Clusters in other regions use their own regional keys and are not affected.
 
Committable suggestion

IMPORTANT
Review the replacement and indentation, then test before committing.

Suggested change
> Removing the key-level role bindings revokes access to all versions of the key at once, provided that neither service agent also holds a decrypt-capable role granted at the key ring or project level. If such an inherited grant exists, remove it at that level as well. Alternatively, disable every enabled version of the key, not only the current one. Data and backups written before a rotation are still protected by the earlier versions, so disabling only the newest version leaves them decryptable. Record which versions you disable so that you can re-enable them when you restore access.
> Removing the key-level role bindings revokes access to all versions of the key at once, provided that neither service agent also holds a decrypt-capable role granted at the key ring or project level. If such an inherited grant exists, remove it at that level as well. Alternatively, disable every enabled version of the key, not only the current one. Data and backups written before a rotation are still protected by the earlier versions, so disabling only the newest version leaves them decryptable. Record which versions you disable so that you can re-enable them when you restore access.
>
> Disabling a key version and removing a role binding are eventually consistent changes. A disabled key version typically stops working within 1 minute, but can remain usable for several hours in exceptional cases. A removed role binding typically takes effect within 2 minutes, and can take 7 minutes or longer. Pausing the clusters in Step 2 does not confirm that the change has taken effect. Wait for the change to take effect before you treat access as revoked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tidb-cloud This PR relates to the area of TiDB Cloud. for-cloud-release This PR is related to TiDB Cloud release. missing-translation-status This PR does not have translation status info. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. translation/no-need No need to translate this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants