feat(cluster): support using FQDN#6627
Conversation
Signed-off-by: liubo02 <liubo02@pingcap.com>
[LGTM Timeline notifier]Timeline:
|
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| ), | ||
|
|
||
| // register tso client | ||
| tasks.TaskContextTSOClient(state, r.TSOClientManager), |
There was a problem hiding this comment.
Why re-order the task, does the order matter?
There was a problem hiding this comment.
If the group is deleting, register may always fail. It blocks the deletion of this tso group.
There was a problem hiding this comment.
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
DNSspecification to the Cluster CRD withMode(FQDN or InCluster) andClusterDomainfields - 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. |
There was a problem hiding this comment.
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".
| // 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. |
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Uh oh!
There was an error while loading. Please reload this page.