Skip to content

Commit 124f9ab

Browse files
authored
cdc support private link (#311)
1 parent 18fe724 commit 124f9ab

File tree

11 files changed

+614
-31
lines changed

11 files changed

+614
-31
lines changed

internal/cli/serverless/changefeed/template.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ import (
2929
const (
3030
KafkaInfoTemplateWithExplain = `{
3131
"network": {
32+
// networkType: "PUBLIC", "PRIVATE"
3233
"networkType": "PUBLIC",
3334
"publicEndpoints": "broker1:9092,broker2:9092"
35+
"privateLink":{
36+
"id": "plc-xxx",
37+
"port": 9092
38+
}
3439
},
3540
"broker": {
3641
// "kafkaVersion": "VERSION_2XX", "VERSION_3XX"
@@ -47,6 +52,7 @@ const (
4752
"password": "",
4853
"enableTls": false
4954
},
55+
"outputRawChangeEvent": false,
5056
"dataFormat": {
5157
// "protocol": "CANAL_JSON", "AVRO", "OPEN_PROTOCOL", "DEBEZIUM"
5258
"protocol": "CANAL_JSON",
@@ -112,7 +118,11 @@ const (
112118
KafkaInfoTemplate = `{
113119
"network": {
114120
"networkType": "PUBLIC",
115-
"publicEndpoints": "broker1:9092,broker2:9092"
121+
"publicEndpoints": "broker1:9092,broker2:9092",
122+
"privateLink":{
123+
"id": "plc-xxx",
124+
"port": 9092
125+
}
116126
},
117127
"broker": {
118128
"kafkaVersion": "VERSION_2XX",
@@ -124,6 +134,7 @@ const (
124134
"password": "",
125135
"enableTls": false
126136
},
137+
"outputRawChangeEvent": false,
127138
"dataFormat": {
128139
"protocol": "CANAL_JSON",
129140
"enableTidbExtension": false,
@@ -178,7 +189,8 @@ const (
178189
"matcher": ["test.t1", "test.t2"],
179190
"ignoreEvent": ["all dml", "all ddl"]
180191
}
181-
]
192+
],
193+
"caseSensitive": false
182194
}`
183195

184196
CDCFilterTemplate = `{
@@ -189,14 +201,19 @@ const (
189201
"matcher": ["test.t1", "test.t2"],
190202
"ignoreEvent": ["all dml", "all ddl"]
191203
}
192-
]
204+
],
205+
"caseSensitive": false
193206
}`
194207

195208
MySQLTemplateWithExplain = `{
196209
"network": {
197210
// required "PUBLIC", "PRIVATE"
198211
"networkType": "PUBLIC",
199-
"publicEndpoint": "127.0.0.1:3306"
212+
"publicEndpoint": "127.0.0.1:3306",
213+
"privateLink":{
214+
"privateLinkConnectionId": "plc-xxx",
215+
"port": 3306
216+
}
200217
},
201218
"authentication": {
202219
// required the user name for MySQL
@@ -211,7 +228,11 @@ const (
211228
MySQLTemplate = `{
212229
"network": {
213230
"networkType": "PUBLIC",
214-
"publicEndpoint": "127.0.0.1:3306"
231+
"publicEndpoint": "127.0.0.1:3306",
232+
"privateLink":{
233+
"privateLinkConnectionId": "plc-xxx",
234+
"port": 3306
235+
}
215236
},
216237
"authentication": {
217238
"userName": "",

pkg/tidbcloud/v1beta1/serverless/cdc.swagger.json

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,9 @@
663663
"type": "object",
664664
"$ref": "#/definitions/EventFilterRule"
665665
}
666+
},
667+
"caseSensitive": {
668+
"type": "boolean"
666669
}
667670
}
668671
},
@@ -1036,6 +1039,9 @@
10361039
"type": "object",
10371040
"$ref": "#/definitions/Kafka.ColumnSelector"
10381041
}
1042+
},
1043+
"outputRawChangeEvent": {
1044+
"type": "boolean"
10391045
}
10401046
}
10411047
},
@@ -1108,8 +1114,8 @@
11081114
"networkType": {
11091115
"$ref": "#/definitions/KafkaNetworkType.Enum"
11101116
},
1111-
"privateLinkServiceName": {
1112-
"type": "string"
1117+
"privateLink": {
1118+
"$ref": "#/definitions/Kafka.PrivateLink"
11131119
},
11141120
"publicEndpoints": {
11151121
"type": "string"
@@ -1139,6 +1145,18 @@
11391145
}
11401146
}
11411147
},
1148+
"Kafka.PrivateLink": {
1149+
"type": "object",
1150+
"properties": {
1151+
"privateLinkConnectionId": {
1152+
"type": "string"
1153+
},
1154+
"port": {
1155+
"type": "integer",
1156+
"format": "int32"
1157+
}
1158+
}
1159+
},
11421160
"Kafka.TopicPartitionConfig": {
11431161
"type": "object",
11441162
"properties": {
@@ -1307,12 +1325,31 @@
13071325
},
13081326
"publicEndpoint": {
13091327
"type": "string"
1328+
},
1329+
"privateLink": {
1330+
"$ref": "#/definitions/MySQL.PrivateLink"
13101331
}
13111332
},
13121333
"required": [
13131334
"networkType"
13141335
]
13151336
},
1337+
"MySQL.PrivateLink": {
1338+
"type": "object",
1339+
"properties": {
1340+
"privateLinkConnectionId": {
1341+
"type": "string"
1342+
},
1343+
"port": {
1344+
"type": "integer",
1345+
"format": "int32"
1346+
}
1347+
},
1348+
"required": [
1349+
"privateLinkConnectionId",
1350+
"port"
1351+
]
1352+
},
13161353
"MySQLNetworkType.Enum": {
13171354
"type": "string",
13181355
"enum": [

pkg/tidbcloud/v1beta1/serverless/cdc/.openapi-generator/FILES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ model_kafka_endpoint.go
3939
model_kafka_network.go
4040
model_kafka_network_type_enum.go
4141
model_kafka_partition_dispatcher_config.go
42+
model_kafka_private_link.go
4243
model_kafka_protocol_enum.go
4344
model_kafka_topic_partition_config.go
4445
model_kafka_type_enum.go
@@ -47,6 +48,7 @@ model_my_sql.go
4748
model_my_sql_authentication.go
4849
model_my_sql_network.go
4950
model_my_sql_network_type_enum.go
51+
model_my_sql_private_link.go
5052
model_partition_dispatcher_enum.go
5153
model_private_link_endpoint.go
5254
model_private_link_endpoint_state_enum.go

pkg/tidbcloud/v1beta1/serverless/cdc/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Class | Method | HTTP request | Description
126126
- [KafkaNetwork](docs/KafkaNetwork.md)
127127
- [KafkaNetworkTypeEnum](docs/KafkaNetworkTypeEnum.md)
128128
- [KafkaPartitionDispatcherConfig](docs/KafkaPartitionDispatcherConfig.md)
129+
- [KafkaPrivateLink](docs/KafkaPrivateLink.md)
129130
- [KafkaProtocolEnum](docs/KafkaProtocolEnum.md)
130131
- [KafkaTopicPartitionConfig](docs/KafkaTopicPartitionConfig.md)
131132
- [KafkaTypeEnum](docs/KafkaTypeEnum.md)
@@ -134,6 +135,7 @@ Class | Method | HTTP request | Description
134135
- [MySQLAuthentication](docs/MySQLAuthentication.md)
135136
- [MySQLNetwork](docs/MySQLNetwork.md)
136137
- [MySQLNetworkTypeEnum](docs/MySQLNetworkTypeEnum.md)
138+
- [MySQLPrivateLink](docs/MySQLPrivateLink.md)
137139
- [PartitionDispatcherEnum](docs/PartitionDispatcherEnum.md)
138140
- [PrivateLinkEndpoint](docs/PrivateLinkEndpoint.md)
139141
- [PrivateLinkEndpointStateEnum](docs/PrivateLinkEndpointStateEnum.md)

pkg/tidbcloud/v1beta1/serverless/cdc/api/openapi.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,8 @@ components:
535535
items:
536536
$ref: '#/components/schemas/EventFilterRule'
537537
type: array
538+
caseSensitive:
539+
type: boolean
538540
type: object
539541
ChangefeedService.CreateChangefeedBody:
540542
properties:
@@ -842,6 +844,8 @@ components:
842844
items:
843845
$ref: '#/components/schemas/Kafka.ColumnSelector'
844846
type: array
847+
outputRawChangeEvent:
848+
type: boolean
845849
type: object
846850
Kafka.Authentication:
847851
properties:
@@ -888,8 +892,8 @@ components:
888892
properties:
889893
networkType:
890894
$ref: '#/components/schemas/KafkaNetworkType.Enum'
891-
privateLinkServiceName:
892-
type: string
895+
privateLink:
896+
$ref: '#/components/schemas/Kafka.PrivateLink'
893897
publicEndpoints:
894898
type: string
895899
type: object
@@ -908,6 +912,14 @@ components:
908912
type: string
909913
type: array
910914
type: object
915+
Kafka.PrivateLink:
916+
properties:
917+
privateLinkConnectionId:
918+
type: string
919+
port:
920+
format: int32
921+
type: integer
922+
type: object
911923
Kafka.TopicPartitionConfig:
912924
properties:
913925
dispatchType:
@@ -1042,9 +1054,22 @@ components:
10421054
$ref: '#/components/schemas/MySQLNetworkType.Enum'
10431055
publicEndpoint:
10441056
type: string
1057+
privateLink:
1058+
$ref: '#/components/schemas/MySQL.PrivateLink'
10451059
required:
10461060
- networkType
10471061
type: object
1062+
MySQL.PrivateLink:
1063+
properties:
1064+
privateLinkConnectionId:
1065+
type: string
1066+
port:
1067+
format: int32
1068+
type: integer
1069+
required:
1070+
- port
1071+
- privateLinkConnectionId
1072+
type: object
10481073
MySQLNetworkType.Enum:
10491074
description: |2-
10501075
- PUBLIC: Public network.

pkg/tidbcloud/v1beta1/serverless/cdc/model_changefeed_filter.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/tidbcloud/v1beta1/serverless/cdc/model_kafka.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)