Skip to content

Commit 467fee6

Browse files
committed
WIP: gui, mpc + update dataflow single pod for manifest
1 parent 7d75d08 commit 467fee6

354 files changed

Lines changed: 10619 additions & 61980 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/mcp-dataflow.yml

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
name: Build and Push MCP DataFlow Server
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'mcp-dataflow/**'
9+
- '.github/workflows/mcp-dataflow.yml'
10+
tags:
11+
- 'mcp-v*'
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- 'mcp-dataflow/**'
17+
- '.github/workflows/mcp-dataflow.yml'
18+
workflow_dispatch:
19+
20+
env:
21+
REGISTRY: ghcr.io
22+
IMAGE_NAME: ilyario/mcp-dataflow
23+
GO_VERSION: '1.21'
24+
25+
jobs:
26+
test:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version: ${{ env.GO_VERSION }}
36+
37+
- name: Install Task
38+
uses: arduino/setup-task@v1
39+
with:
40+
version: 3.x
41+
42+
- name: Download dependencies
43+
working-directory: ./mcp-dataflow
44+
run: task deps
45+
46+
- name: Run tests
47+
working-directory: ./mcp-dataflow
48+
run: task test
49+
50+
- name: Run linter
51+
working-directory: ./mcp-dataflow
52+
run: task lint || true
53+
54+
build-binaries:
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
goos: [linux, darwin, windows]
59+
goarch: [amd64, arm64]
60+
exclude:
61+
- goos: windows
62+
goarch: arm64
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v4
66+
67+
- name: Set up Go
68+
uses: actions/setup-go@v5
69+
with:
70+
go-version: ${{ env.GO_VERSION }}
71+
72+
- name: Install Task
73+
uses: arduino/setup-task@v1
74+
with:
75+
version: 3.x
76+
77+
- name: Download dependencies
78+
working-directory: ./mcp-dataflow
79+
run: task deps
80+
81+
- name: Build binary
82+
working-directory: ./mcp-dataflow
83+
env:
84+
GOOS: ${{ matrix.goos }}
85+
GOARCH: ${{ matrix.goarch }}
86+
run: |
87+
OUTPUT="dist/mcp-dataflow-${GOOS}-${GOARCH}"
88+
if [ "$GOOS" = "windows" ]; then
89+
OUTPUT="${OUTPUT}.exe"
90+
fi
91+
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go build -a -installsuffix cgo -o ${OUTPUT} cmd/server/main.go
92+
93+
- name: Upload binaries
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
97+
path: mcp-dataflow/dist/mcp-dataflow-${{ matrix.goos }}-${{ matrix.goarch }}*
98+
99+
build-and-push:
100+
runs-on: ubuntu-latest
101+
needs: [test]
102+
permissions:
103+
contents: read
104+
packages: write
105+
106+
steps:
107+
- name: Checkout repository
108+
uses: actions/checkout@v4
109+
with:
110+
fetch-depth: 0
111+
112+
- name: Set up Docker Buildx
113+
uses: docker/setup-buildx-action@v3
114+
115+
- name: Log in to Container Registry
116+
uses: docker/login-action@v3
117+
with:
118+
registry: ${{ env.REGISTRY }}
119+
username: ${{ github.actor }}
120+
password: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Extract metadata (tags, labels) for Docker
123+
id: meta
124+
uses: docker/metadata-action@v5
125+
with:
126+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
127+
tags: |
128+
type=ref,event=branch
129+
type=ref,event=pr
130+
type=semver,pattern={{version}}
131+
type=semver,pattern={{major}}.{{minor}}
132+
type=semver,pattern={{major}}
133+
type=sha,prefix={{branch}}-
134+
type=raw,value=latest,enable={{is_default_branch}}
135+
type=raw,value=mcp-latest,enable={{is_default_branch}}
136+
137+
- name: Build and push Docker image
138+
uses: docker/build-push-action@v5
139+
with:
140+
context: ./mcp-dataflow
141+
file: ./mcp-dataflow/Dockerfile
142+
push: ${{ github.event_name != 'pull_request' }}
143+
tags: ${{ steps.meta.outputs.tags }}
144+
labels: ${{ steps.meta.outputs.labels }}
145+
cache-from: type=gha
146+
cache-to: type=gha,mode=max
147+
148+
create-release:
149+
needs: [build-binaries, build-and-push]
150+
runs-on: ubuntu-latest
151+
if: startsWith(github.ref, 'refs/tags/mcp-v')
152+
permissions:
153+
contents: write
154+
155+
steps:
156+
- name: Checkout repository
157+
uses: actions/checkout@v4
158+
with:
159+
fetch-depth: 0
160+
161+
- name: Get tag name
162+
id: tag
163+
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
164+
165+
- name: Download all artifacts
166+
uses: actions/download-artifact@v4
167+
with:
168+
path: dist
169+
170+
- name: Prepare release assets
171+
run: |
172+
mkdir -p release-assets
173+
find dist -type f -executable -o -name "*.exe" | while read file; do
174+
cp "$file" release-assets/
175+
done
176+
177+
- name: Generate release notes
178+
id: release_notes
179+
run: |
180+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
181+
if [ -z "$PREVIOUS_TAG" ]; then
182+
NOTES=$(git log --pretty=format:"- %s (%h)" --no-merges)
183+
else
184+
NOTES=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
185+
fi
186+
echo "notes<<EOF" >> $GITHUB_OUTPUT
187+
echo "$NOTES" >> $GITHUB_OUTPUT
188+
echo "EOF" >> $GITHUB_OUTPUT
189+
190+
- name: Create Release
191+
uses: softprops/action-gh-release@v2
192+
with:
193+
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
194+
name: MCP DataFlow Server ${{ steps.tag.outputs.TAG_NAME }}
195+
body: |
196+
## Что нового в ${{ steps.tag.outputs.TAG_NAME }}
197+
198+
${{ steps.release_notes.outputs.notes }}
199+
200+
## Docker образ
201+
202+
Docker образ доступен по адресу:
203+
```
204+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG_NAME }}
205+
```
206+
207+
## Установка
208+
209+
### Docker
210+
```bash
211+
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG_NAME }}
212+
```
213+
214+
### Бинарник
215+
216+
Скачайте бинарник для вашей платформы из раздела Assets ниже.
217+
files: release-assets/*
218+
draft: false
219+
prerelease: false
220+
generate_release_notes: true

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ RUN apk add --no-cache git make
1010
COPY go.mod go.mod
1111
COPY go.sum go.sum
1212

13-
# Copy nessie-client directory (required for replace directive)
14-
COPY pkg/nessie-client/go.mod pkg/nessie-client/go.mod
15-
1613
# Download dependencies
1714
RUN go mod download
1815

1916
# Copy source code
2017
COPY . .
2118

22-
# Build
19+
# Build manager (operator)
2320
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
2421

22+
# Build processor
23+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o processor cmd/processor/main.go
24+
25+
# Build GUI server
26+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o gui-server cmd/gui-server/main.go
27+
2528
# Final stage
2629
FROM alpine:latest
2730

@@ -30,6 +33,8 @@ WORKDIR /
3033
RUN apk --no-cache add ca-certificates
3134

3235
COPY --from=builder /workspace/manager .
36+
COPY --from=builder /workspace/processor .
37+
COPY --from=builder /workspace/gui-server .
3338

3439
ENTRYPOINT ["/manager"]
3540

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ Kubernetes operator for streaming data between different sources (Kafka, Postgre
1616
- SnakeCase - convert field names to snake_case
1717
- CamelCase - convert field names to CamelCase
1818
- **Kubernetes Secrets Support**: Configure connectors using `SecretRef` for secure credential management
19+
- **Per-Resource Pod Deployment**: Each DataFlow resource creates a separate pod (Deployment) for processing
20+
- **Resource Management**: Configure CPU and memory resources for processor pods
21+
- **Pod Placement Control**: Configure nodeSelector, affinity, and tolerations for fine-grained pod placement
1922

2023
## Quick Start
2124

@@ -189,6 +192,35 @@ make test
189192
make test-integration
190193
```
191194

195+
## Web GUI
196+
197+
DataFlow включает веб-интерфейс для управления манифестами, просмотра логов и мониторинга метрик.
198+
199+
### Запуск GUI сервера
200+
201+
```bash
202+
go run cmd/gui-server/main.go --bind-address :8080
203+
```
204+
205+
Или с параметрами:
206+
207+
```bash
208+
go run cmd/gui-server/main.go \
209+
--bind-address :8080 \
210+
--kubeconfig ~/.kube/config \
211+
--log-level info
212+
```
213+
214+
### Использование
215+
216+
1. Откройте браузер и перейдите на `http://localhost:8080`
217+
2. Используйте вкладки для:
218+
- **Манифесты**: Управление DataFlow ресурсами (создание, просмотр, обновление, удаление)
219+
- **Логи**: Просмотр логов обработки в реальном времени
220+
- **Метрики**: Мониторинг статуса обработки, количества обработанных сообщений и ошибок
221+
222+
Подробнее см. [cmd/gui-server/README.md](cmd/gui-server/README.md)
223+
192224
## Security
193225

194226
DataFlow Operator supports configuring connectors from Kubernetes Secrets through `SecretRef` fields. This allows:

api/v1/dataflow_types.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -31,6 +32,26 @@ type DataFlowSpec struct {
3132
// Transformations is a list of transformations to apply to messages
3233
// +optional
3334
Transformations []TransformationSpec `json:"transformations,omitempty"`
35+
36+
// Errors defines the error sink for messages that failed to be written to the main sink
37+
// +optional
38+
Errors *SinkSpec `json:"errors,omitempty"`
39+
40+
// Resources defines the resource requirements for the processor pod
41+
// +optional
42+
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
43+
44+
// NodeSelector is a selector which must be true for the pod to fit on a node
45+
// +optional
46+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
47+
48+
// Affinity is a group of affinity scheduling rules
49+
// +optional
50+
Affinity *corev1.Affinity `json:"affinity,omitempty"`
51+
52+
// Tolerations are attached to tolerate any taint that matches the triple <key,value,effect>
53+
// +optional
54+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
3455
}
3556

3657
// SourceSpec defines the source configuration

api/v1/zz_generated.deepcopy.go

Lines changed: 40 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)