meshops.proto, enabling consistent lifecycle management, configuration, and operations.
Adapter Architecture
Adapters communicate with Meshery Server using gRPC and expose a set of standard RPCs for service mesh management:gRPC Protocol Definition
All adapters implement theMeshService interface defined in server/meshes/meshops.proto:
Message Types
ApplyRuleRequest
Used to execute operations on the service mesh:ApplyRuleResponse
SupportedOperation
Defines operations the adapter can perform:EventsResponse
Streamed events during operations:ComponentInfoResponse
Adapter metadata returned byComponentInfo RPC:
Creating an Adapter
1. Project Structure
2. Implement the gRPC Server
3. Implement MeshService Interface
4. Implement ApplyOperation
5. Stream Events
6. Dockerfile
Connecting to Meshery Server
Meshery Server creates gRPC clients to connect to adapters:Configuration
Adapters are configured via environment variables and command-line flags:| Variable | Description | Default |
|---|---|---|
PORT | gRPC server port | 10000 |
KUBECONFIG | Path to kubeconfig | ~/.kube/config |
ADAPTER_VERSION | Adapter version | - |
Testing
Unit Tests
Integration Tests
Use a test Kubernetes cluster (kind, minikube) to test actual operations.Best Practices
- Error Handling: Always return descriptive errors with probable causes and remediation steps
- Event Streaming: Stream progress events for long-running operations
- Idempotency: Make operations idempotent where possible
- Version Support: Support multiple versions of the service mesh
- Cleanup: Implement proper cleanup for failed operations
- Logging: Use structured logging with appropriate verbosity levels
- Health Checks: Implement health check endpoints
- Graceful Shutdown: Handle SIGTERM for graceful termination
Example Adapters
Reference implementations:Next Steps
Provider Plugins
Learn about provider plugin system
UI Extensions
Create custom UI components