Skip to content

feat(cluster): support using FQDN#6627

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:mainfrom
liubog2008:liubo02/support-fqdn
Dec 25, 2025
Merged

feat(cluster): support using FQDN#6627
ti-chi-bot[bot] merged 3 commits intopingcap:mainfrom
liubog2008:liubo02/support-fqdn

Conversation

@liubog2008
Copy link
Member

@liubog2008 liubog2008 commented Dec 25, 2025

  • support using FQDN in the tidb cluster

Signed-off-by: liubo02 <liubo02@pingcap.com>
@ti-chi-bot ti-chi-bot bot requested a review from shonge December 25, 2025 11:41
@github-actions github-actions bot added the v2 for operator v2 label Dec 25, 2025
@ti-chi-bot ti-chi-bot bot added the size/XXL label Dec 25, 2025
@liubog2008 liubog2008 changed the title feat(cluster): support using fqdn feat(cluster): support using FQDN Dec 25, 2025
Signed-off-by: liubo02 <liubo02@pingcap.com>
@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 25, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 25, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-12-25 11:53:19.053787026 +0000 UTC m=+2337943.867564598: ☑️ agreed by srstack.

@ti-chi-bot ti-chi-bot bot added the approved label Dec 25, 2025
Signed-off-by: liubo02 <liubo02@pingcap.com>
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 24.86188% with 136 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.26%. Comparing base (24157a9) to head (7c92721).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6627      +/-   ##
==========================================
- Coverage   39.43%   39.26%   -0.17%     
==========================================
  Files         351      351              
  Lines       20717    20679      -38     
==========================================
- Hits         8169     8119      -50     
- Misses      12548    12560      +12     
Flag Coverage Δ
unittest 39.26% <24.86%> (-0.17%) ⬇️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

),

// register tso client
tasks.TaskContextTSOClient(state, r.TSOClientManager),
Copy link
Member

Choose a reason for hiding this comment

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

Why re-order the task, does the order matter?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the group is deleting, register may always fail. It blocks the deletion of this tso group.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for using Fully Qualified Domain Names (FQDN) in TiDB cluster DNS configurations. The changes introduce a new DNS configuration option that allows clusters to use complete DNS names in the format *.${svc}.${ns}.svc.${clusterDomain} instead of the default in-cluster format *.${svc}.${ns}.

Key Changes

  • Added new DNS specification to the Cluster CRD with Mode (FQDN or InCluster) and ClusterDomain fields
  • Refactored URL/address generation utilities to centralize DNS name construction based on cluster DNS mode
  • Updated all component configurations (PD, TiKV, TiFlash, TiDB, TiCDC, TiProxy, TSO, Scheduling, Scheduler) to use the new address generation functions
  • Enhanced certificate generation to include FQDN entries in Subject Alternative Names

Reviewed changes

Copilot reviewed 53 out of 53 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
api/core/v1alpha1/cluster_types.go Added DNS type with DNSMode enum and ClusterDomain field to support FQDN configuration
api/core/v1alpha1/zz_generated.deepcopy.go Auto-generated DeepCopy methods for the new DNS type
manifests/crd/core.pingcap.com_clusters.yaml Updated CRD schema to include DNS configuration fields with validation
pkg/apiutil/core/v1alpha1/cluster.go Added ServiceHost, ListenAddress, and ListenURL helper functions for DNS resolution
pkg/apiutil/core/v1alpha1/instance.go Added generic InstanceHost, InstanceAdvertiseURL, and InstanceAdvertiseAddress functions
pkg/apiutil/core/v1alpha1/util.go Refactored URL building utilities with urlScheme, urlPort, and hostToURL helpers
pkg/apiutil/core/v1alpha1/{pd,tikv,tiflash,ticdc,tso,tikv_worker}.go Removed component-specific URL functions, now using centralized generic functions
pkg/configs/{pd,tikv,tiflash,tidb,ticdc,tiproxy,tso,scheduling,scheduler,tikvworker}/config.go Updated configuration overlays to use new address generation functions
pkg/configs/{pd,tikv,tiflash,tidb,ticdc,tiproxy}/config_test.go Added cluster metadata (namespace/name) to test cases required by new functions
pkg/controllers/tsogroup/tasks/svc.go Added internal service creation for TSO groups alongside headless service
pkg/controllers/tsogroup/builder.go Moved TSO client registration after service creation to ensure service exists
pkg/controllers/{tikv,tiflash,tidb,ticdc,tiproxy}/tasks/ctx.go Updated client initialization to use new address generation functions
pkg/controllers/{tikv,tiflash}/handler.go Updated store event handlers to fetch cluster and use new address functions
pkg/timanager/{tso,tiflash}/tso.go Refactored to use centralized URL generation and eliminate redundant code
pkg/tiproxyapi/v1/client.go Changed NewTiProxyClient to accept address instead of URL and construct URL internally
pkg/tiproxyapi/v1/client_test.go Updated tests to use address extraction utility before creating clients
pkg/ticdcapi/v1/client.go Changed WithURL to private withURL function and moved URL field to private in Options
pkg/ticdcapi/v1/client_test.go Updated test code to use private withURL function
tests/e2e/utils/cert/certv2.go Added FQDN entries to certificate Subject Alternative Names
tests/e2e/suite/cluster/tls.go Added FQDN option to TLS test configuration
tests/e2e/framework/framework.go Added support for Focus option in test framework
tests/e2e/framework/desc/options.go Added FQDN and Focus options for test descriptors
tests/e2e/framework/desc/patch.go Added FQDN cluster patch support
tests/e2e/data/cluster.go Added WithFQDN patch function to set DNS mode in test clusters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

DNSModeFQDN DNSMode = "FQDN"
// This mode is the default mode,
// the format is "*.${svc}.${ns}"
// The cluster in this mode will produce many dns queries than other modes.
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

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

Grammar issue in the comment. The sentence should read "will produce more dns queries than other modes" instead of "will produce many dns queries than other modes".

Suggested change
// The cluster in this mode will produce many dns queries than other modes.
// The cluster in this mode will produce more dns queries than other modes.

Copilot uses AI. Check for mistakes.
@fgksgf
Copy link
Member

fgksgf commented Dec 25, 2025

/lgtm

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fgksgf, srstack

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

The pull request process is described 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 merged commit a4ed39b into pingcap:main Dec 25, 2025
16 checks passed
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.

6 participants