Skip to content

Commit ab9ebf3

Browse files
committed
update docs
1 parent b0f5a5f commit ab9ebf3

22 files changed

Lines changed: 859 additions & 446 deletions

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# DataFlow Operator Documentation
2+
3+
Documentation site for [DataFlow Operator](https://github.com/dataflow-operator/dataflow), built with [MkDocs Material](https://squidfunk.github.io/mkdocs-material/).
4+
5+
**Live site**: https://dataflow-operator.github.io/docs/
6+
7+
## Languages
8+
9+
- English (`docs/en/`)
10+
- Russian (`docs/ru/`)
11+
12+
## Local development
13+
14+
```bash
15+
pip install -r requirements.txt
16+
mkdocs serve
17+
```
18+
19+
Open http://localhost:8000.
20+
21+
## Build
22+
23+
```bash
24+
mkdocs build
25+
```
26+
27+
Output goes to `site/`.
28+
29+
## Structure
30+
31+
```
32+
docs/
33+
├── mkdocs.yml # MkDocs configuration
34+
├── requirements.txt # Python dependencies
35+
├── docs/
36+
│ ├── en/ # English documentation
37+
│ ├── ru/ # Russian documentation
38+
│ ├── images/ # Logo, favicon
39+
│ ├── stylesheets/ # Custom CSS
40+
│ └── javascripts/ # Custom JS
41+
└── .github/workflows/
42+
└── docs.yml # CI: deploy to GitHub Pages
43+
```
44+
45+
## Topics covered
46+
47+
- Getting Started
48+
- Architecture
49+
- Connectors (Kafka, PostgreSQL, ClickHouse, Trino, Nessie)
50+
- Transformations
51+
- Configuration examples
52+
- Error handling and fault tolerance
53+
- Prometheus metrics
54+
- Web GUI
55+
- MCP server
56+
- Development guide
57+
- Connector development
58+
- Semantic versioning and releases

docs/en/connector-development.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Used when the connector performs long-running read operations (e.g., SQL queries
4141

4242
## Step-by-Step Guide: Adding a New Connector
4343

44-
### Step 1. Define Types in API
44+
### Step 1. Define Types
4545

46-
Add the spec to `api/v1/dataflow_types.go`:
46+
Define your connector's config struct (it will be parsed from `Config json.RawMessage` at runtime):
4747

4848
```go
4949
// MyDBSourceSpec defines MyDB source configuration
@@ -52,14 +52,20 @@ type MyDBSourceSpec struct {
5252
Table string `json:"table"`
5353
// ...
5454
}
55+
```
5556

56-
// In SourceSpec:
57-
type SourceSpec struct {
58-
// ...
59-
MyDB *MyDBSourceSpec `json:"myDB,omitempty"`
60-
}
57+
Users will specify the connector in a DataFlow manifest using the unified `type` + `config` format:
58+
59+
```yaml
60+
source:
61+
type: mydb
62+
config:
63+
connectionString: "mydb://localhost:3306/db"
64+
table: my_table
6165
```
6266
67+
The `SourceSpec` and `SinkSpec` structs use `Type string` + `Config json.RawMessage`. The factory parses `Config` into your spec struct.
68+
6369
### Step 2. Choose baseConnector or baseConnectorRWMutex
6470

6571
**Use `baseConnector`** when:
@@ -233,17 +239,18 @@ Note: rawMode is supported only in sink connectors. Sources always emit plain co
233239

234240
### Step 6. Register in Factory
235241

236-
In `internal/connectors/factory.go`:
242+
In `internal/connectors/factory.go`, parse `Config` into your spec struct:
237243

238244
```go
239245
func CreateSourceConnector(source *v1.SourceSpec) (SourceConnector, error) {
240246
switch source.Type {
241247
// ...
242248
case "mydb":
243-
if source.MyDB == nil {
244-
return nil, fmt.Errorf("mydb source configuration is required")
249+
var cfg MyDBSourceSpec
250+
if err := json.Unmarshal(source.Config.Raw, &cfg); err != nil {
251+
return nil, fmt.Errorf("invalid mydb source config: %w", err)
245252
}
246-
return NewMyDBSourceConnector(source.MyDB), nil
253+
return NewMyDBSourceConnector(&cfg), nil
247254
default:
248255
return nil, fmt.Errorf("unknown source type: %s", source.Type)
249256
}
@@ -253,10 +260,11 @@ func CreateSinkConnector(sink *v1.SinkSpec) (SinkConnector, error) {
253260
switch sink.Type {
254261
// ...
255262
case "mydb":
256-
if sink.MyDB == nil {
257-
return nil, fmt.Errorf("mydb sink configuration is required")
263+
var cfg MyDBSinkSpec
264+
if err := json.Unmarshal(sink.Config.Raw, &cfg); err != nil {
265+
return nil, fmt.Errorf("invalid mydb sink config: %w", err)
258266
}
259-
return NewMyDBSinkConnector(sink.MyDB), nil
267+
return NewMyDBSinkConnector(&cfg), nil
260268
default:
261269
return nil, fmt.Errorf("unknown sink type: %s", sink.Type)
262270
}
@@ -266,9 +274,9 @@ func CreateSinkConnector(sink *v1.SinkSpec) (SinkConnector, error) {
266274
### Step 7. Generate and Test
267275

268276
```bash
269-
make generate
270-
make manifests
271-
make test-unit
277+
task generate
278+
task manifests
279+
task test-unit
272280
```
273281

274282
## Important Notes

docs/en/connectors.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ metadata:
106106
spec:
107107
source:
108108
type: kafka
109-
kafka:
109+
config:
110110
brokersSecretRef:
111111
name: kafka-credentials
112112
key: brokers
@@ -146,7 +146,7 @@ metadata:
146146
spec:
147147
source:
148148
type: postgresql
149-
postgresql:
149+
config:
150150
connectionStringSecretRef:
151151
name: postgres-credentials
152152
key: connectionString
@@ -213,7 +213,7 @@ metadata:
213213
spec:
214214
source:
215215
type: kafka
216-
kafka:
216+
config:
217217
brokers:
218218
- secure-kafka:9093
219219
topic: secure-topic
@@ -299,7 +299,7 @@ The Kafka connector supports reading and writing messages from/to Apache Kafka t
299299
```yaml
300300
source:
301301
type: kafka
302-
kafka:
302+
config:
303303
brokers:
304304
- kafka1:9092
305305
topic: input-topic
@@ -354,7 +354,7 @@ source:
354354
```yaml
355355
sink:
356356
type: kafka
357-
kafka:
357+
config:
358358
brokers:
359359
- kafka1:9092
360360
topic: output-topic
@@ -370,7 +370,7 @@ The PostgreSQL connector supports reading from and writing to PostgreSQL tables.
370370
```yaml
371371
source:
372372
type: postgresql
373-
postgresql:
373+
config:
374374
# Connection string (required, or use connectionStringSecretRef)
375375
connectionString: "postgres://user:password@localhost:5432/dbname?sslmode=disable"
376376
# Table to read from (required if query not specified). Supports schema.table (e.g. public.products)
@@ -411,7 +411,7 @@ source:
411411
```yaml
412412
sink:
413413
type: postgresql
414-
postgresql:
414+
config:
415415
connectionString: "postgres://user:password@localhost:5432/dbname?sslmode=disable"
416416
# Table to write to. Supports schema.table (e.g. public.products_clone)
417417
table: target_table
@@ -470,15 +470,15 @@ metadata:
470470
spec:
471471
source:
472472
type: postgresFull
473-
postgresFull:
473+
config:
474474
connectionString: "postgres://user:pass@source-pg:5432/db?sslmode=disable"
475475
syncMode: full
476476
dataMode: schema_and_data # or schema_only
477477
# databases: ["public.users", "analytics.mv_report"] # optional filter
478478
# excludeObjects: ["view", "function"] # optional exclude
479479
sink:
480480
type: postgresFull
481-
postgresFull:
481+
config:
482482
connectionString: "postgres://user:pass@target-pg:5432/db?sslmode=disable"
483483
```
484484

@@ -517,7 +517,7 @@ The ClickHouse connector supports reading from and writing to ClickHouse tables.
517517
```yaml
518518
source:
519519
type: clickhouse
520-
clickhouse:
520+
config:
521521
# Connection string (required)
522522
# Native: clickhouse://host:9000?username=default&password=xxx&database=default
523523
# HTTP: http://host:8123/default?username=default&password=xxx
@@ -546,7 +546,7 @@ source:
546546
```yaml
547547
sink:
548548
type: clickhouse
549-
clickhouse:
549+
config:
550550
connectionString: "clickhouse://default@clickhouse:9000/default?dial_timeout=10s"
551551
table: output_table
552552
@@ -589,14 +589,14 @@ metadata:
589589
spec:
590590
source:
591591
type: kafka
592-
kafka:
592+
config:
593593
brokers:
594594
- kafka:9092
595595
topic: input-topic
596596
consumerGroup: dataflow-group
597597
sink:
598598
type: clickhouse
599-
clickhouse:
599+
config:
600600
connectionString: "clickhouse://default@clickhouse:9000/default"
601601
table: output_table
602602
batchSize: 100
@@ -615,13 +615,13 @@ metadata:
615615
spec:
616616
source:
617617
type: clickhouse
618-
clickhouse:
618+
config:
619619
connectionString: "clickhouse://dataflow:dataflow@localhost:9000/dataflow?dial_timeout=10s"
620620
table: products
621621
pollInterval: 5
622622
sink:
623623
type: clickhouse
624-
clickhouse:
624+
config:
625625
connectionString: "clickhouse://dataflow:dataflow@localhost:9000/dataflow?dial_timeout=10s"
626626
table: products_clone
627627
batchSize: 100
@@ -637,7 +637,7 @@ The Trino connector supports reading from and writing to Trino (formerly PrestoS
637637
```yaml
638638
source:
639639
type: trino
640-
trino:
640+
config:
641641
# Trino server URL (required)
642642
serverURL: "http://trino:8080"
643643
@@ -719,7 +719,7 @@ The response will contain an `access_token` field. Use this token value in the `
719719
```yaml
720720
sink:
721721
type: trino
722-
trino:
722+
config:
723723
# Trino server URL (required)
724724
serverURL: "http://trino:8080"
725725
@@ -774,14 +774,14 @@ metadata:
774774
spec:
775775
source:
776776
type: kafka
777-
kafka:
777+
config:
778778
brokers:
779779
- kafka:9092
780780
topic: input-topic
781781
consumerGroup: dataflow-group
782782
sink:
783783
type: trino
784-
trino:
784+
config:
785785
serverURL: "http://trino:8080"
786786
catalog: hive
787787
schema: default
@@ -809,7 +809,7 @@ The Nessie connector reads from and writes to Apache Iceberg tables via the [Nes
809809
```yaml
810810
source:
811811
type: nessie
812-
nessie:
812+
config:
813813
# Nessie server base URL (required), e.g. https://nessie:19120
814814
baseURL: "http://nessie:19120"
815815
@@ -847,7 +847,7 @@ source:
847847
```yaml
848848
sink:
849849
type: nessie
850-
nessie:
850+
config:
851851
baseURL: "http://nessie:19120"
852852
branch: main
853853
warehouse: ""
@@ -883,14 +883,14 @@ metadata:
883883
spec:
884884
source:
885885
type: kafka
886-
kafka:
886+
config:
887887
brokers:
888888
- kafka:9092
889889
topic: input-topic
890890
consumerGroup: dataflow-group
891891
sink:
892892
type: nessie
893-
nessie:
893+
config:
894894
baseURL: "http://nessie:19120"
895895
branch: main
896896
namespace: analytics

0 commit comments

Comments
 (0)