Skip to content

Commit 688f3fb

Browse files
committed
update pf proto
1 parent a31bf42 commit 688f3fb

File tree

9 files changed

+705
-774
lines changed

9 files changed

+705
-774
lines changed

.dockerignore.protogen

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Git files
2+
.git
3+
.gitignore
4+
5+
# Documentation
6+
*.md
7+
docs/
8+
9+
# Build artifacts
10+
bin/
11+
artifacts/
12+
dist/
13+
14+
# IDE files
15+
.vscode/
16+
.idea/
17+
*.swp
18+
*.swo
19+
20+
# OS files
21+
.DS_Store
22+
Thumbs.db
23+
24+
# Docker files (except the ones we need)
25+
Dockerfile
26+
*.dockerfile
27+
.dockerignore
28+
29+
# Test files
30+
*_test.go
31+
testdata/
32+
33+
# CI/CD
34+
.github/
35+
.travis.yml
36+
.circleci/
37+
38+
# Other unnecessary files for protobuf generation
39+
charts/
40+
config/
41+
hack/
42+
images/
43+
manifests/
44+
mesh-worker-service/
45+
tools/
46+
LICENSE
47+
install.sh
48+
bump_version.sh
49+
*.sh
50+
!controllers/proto/generate.sh

Dockerfile.protogen

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Build environment for protobuf generation
2+
# Requirements: protoc 3.17.3, protoc-gen-go v1.3.5
3+
# Using Debian base to avoid musl/glibc compatibility issues with protoc x86_64 binaries
4+
FROM golang:1.24.2
5+
6+
# Install system dependencies
7+
RUN apt-get update && apt-get install -y \
8+
bash \
9+
curl \
10+
unzip \
11+
git \
12+
make \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
# Set environment variables
16+
ENV PROTOC_VERSION=3.17.3
17+
ENV PROTOC_GEN_GO_VERSION=v1.3.5
18+
19+
# Install protoc 3.17.3
20+
RUN set -eux; \
21+
PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip"; \
22+
curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}"; \
23+
unzip -o "$PROTOC_ZIP" -d /usr/local; \
24+
rm -f "$PROTOC_ZIP"
25+
26+
# Install protoc-gen-go 1.25.0
27+
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
28+
29+
# Verify installations
30+
RUN protoc --version
31+
32+
# Set working directory
33+
WORKDIR /workspace
34+
35+
# Copy the entire project
36+
COPY . .
37+
38+
# Make sure generate.sh is executable
39+
RUN chmod +x controllers/proto/generate.sh
40+
41+
# Default command: run the generate script
42+
CMD ["/workspace/controllers/proto/generate.sh", "/workspace"]

README-protogen.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Protobuf Generation Docker Environment
2+
3+
This Docker environment contains the tools and environment required to generate function-mesh protobuf Go definitions.
4+
5+
## Requirements
6+
7+
- protoc: v3.17.3
8+
- protoc-gen-go: v1.25.0
9+
- protoc-gen-go-grpc: v1.0.0
10+
- Go: 1.24.2+
11+
12+
**Note**: This image uses a Debian base (not Alpine) to ensure compatibility with the protoc x86_64 binary, which is compiled for glibc rather than musl libc.
13+
14+
## Build and Usage
15+
16+
### 1. Build Docker Image
17+
18+
```bash
19+
docker build -f Dockerfile.protogen -t function-mesh-protogen .
20+
```
21+
22+
### 2. Run Protobuf Generation
23+
24+
```bash
25+
# Run container and generate protobuf files
26+
docker run --rm -v $(pwd):/workspace function-mesh-protogen
27+
28+
# Or run interactively for debugging
29+
docker run --rm -it -v $(pwd):/workspace function-mesh-protogen bash
30+
```
31+
32+
### 3. Manual Script Execution
33+
34+
If you need manual control over the generation process:
35+
36+
```bash
37+
# Enter container
38+
docker run --rm -it -v $(pwd):/workspace function-mesh-protogen bash
39+
40+
# Execute manually inside container
41+
cd /workspace
42+
./controllers/proto/generate.sh /workspace
43+
```
44+
45+
## Generated Files
46+
47+
The script will update the following files:
48+
- `controllers/proto/Function.pb.go`
49+
50+
## Environment Verification
51+
52+
You can verify tool versions inside the container:
53+
54+
```bash
55+
protoc --version # Should show libprotoc 3.17.3
56+
go version # Should show go1.24.2+
57+
```
58+
59+
## Troubleshooting
60+
61+
If you encounter permission issues, ensure the generate.sh script has execute permissions:
62+
63+
```bash
64+
chmod +x controllers/proto/generate.sh
65+
```
66+
67+
If you encounter protoc-gen-go not found issues, ensure $GOPATH/bin is in PATH:
68+
69+
```bash
70+
export PATH=$PATH:$(go env GOPATH)/bin
71+
```

api/compute/v1alpha1/common.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,16 @@ type ProducerConfig struct {
315315
CryptoConfig *CryptoConfig `json:"cryptoConfig,omitempty"`
316316
BatchBuilder string `json:"batchBuilder,omitempty"`
317317
CompressionType CompressionType `json:"compressionType,omitempty"`
318+
BatchingConfig *BatchingConfig `json:"batchingConfig,omitempty"`
319+
}
320+
321+
type BatchingConfig struct {
322+
Enabled bool `json:"enabled,omitempty"`
323+
BatchingMaxPublishDelayMs int32 `json:"batchingMaxPublishDelayMs,omitempty"`
324+
RoundRobinRouterBatchingPartitionSwitchFrequency int32 `json:"roundRobinRouterBatchingPartitionSwitchFrequency,omitempty"`
325+
BatchingMaxMessages int32 `json:"batchingMaxMessages,omitempty"`
326+
BatchingMaxBytes int32 `json:"batchingMaxBytes,omitempty"`
327+
BatchBuilder string `json:"batchBuilder,omitempty"`
318328
}
319329

320330
type CryptoConfig struct {

0 commit comments

Comments
 (0)