Contributing to Meshery Adapters
Meshery Adapters are the Extension Points in Mesheryโs architecture. Their design, the process of creating a new adapter is documented in Extensibility: Meshery Adapters.
With the CONTRIBUTING.md in mind, understand that development follows the usual fork-and-pull request workflow described here, see also GitHub Process. On forking GitHub deactivates all workflows. It is safe and good practice to activate them such that the code is validated on each push. This requires that branches filter for โon pushโ is set to โ**โ to be triggered also on branches containing โ/โ in their name. The actions are parameterized using secrets (see Build & Release Strategy). The Docker image is only built and pushed to Docker Hub if a tag is pushed and the corresponding authentication information is configured. The only secret that should be set in each fork is GO_VERSION, specified in Build & Release Strategy, otherwise, the corresponding actionโs default version is used.
Each commit has to be signed off, see Contributing Overview.
Running an adapter as a container
Testing your local changes running as a container can be accomplished in two ways:
- Define the adapterโs address in the UI: Unless the running container is named as specified in the docker-run target in the Makefile, the container has to be removed manually first. Then, run
make docker
followed bymake docker-run
. Then, connect to the adapter in the UI in โSettings > Adaptersโ usinglocalhost:<port>
if the meshery server is running as a binary, or: if it is running as a docker container. - Using mesheryctl: In
~/.meshery/meshery.yaml
, change the tag specifying the image of the adapter to โlatestโ. Run make docker, followed bymesheryctl system start --skip-update
. This assumes mesheryctl system start has been executed at least once before.
Running an adapter as a process
Another way to test your local changes is to run the adapter as a process. To do this, clone the meshery/meshery
repository, and start Meshery Server using make server
. Start the adapter from your IDE, or by executing make run
. Then, in Meshery UI, add the adapter using โlocalhost:
Creating a new Meshery Adapter
Meshery uses adapters to manage and interact with different cloud native infrastructure. Meshery adapters are written in Go. Whether you are creating a new adapter or modifying an existing adapter, be sure to read the Meshery Adapters design specification. For new adapters, start with the Repository Template(https://github.com/meshery/meshery).
- Get the proto buf spec file from Meshery repo:
wget https://raw.githubusercontent.com/meshery/meshery/master/meshes/meshops.proto
- Generate code
- Using Go as an example, do the following:
- adding GOPATH to PATH:
export PATH=$PATH:$GOPATH/bin
- install grpc:
go get -u google.golang.org/grpc
- install protoc plugin for go:
go get -u github.com/golang/protobuf/protoc-gen-go
- Generate Go code:
protoc -I meshes/ meshes/meshops.proto --go_out=plugins=grpc:./meshes/
- adding GOPATH to PATH:
- For other languages, please refer to gRPC.io for language-specific guides.
- Using Go as an example, do the following:
- Implement the service methods and expose the gRPC server on a port of your choice (e.g. 10000).
Tip: The Meshery Adapter for Istio is a good reference adapter to use as an example of a Meshery Adapter.
Suggested Reading
- Build & Release (CI) - Details of Meshery's build and release strategy.
- Contributing to Meshery CLI - How to contribute to Meshery Command Line Interface.
- Contributing to Meshery's End-to-End Tests using Cypress - How to contribute to End-to-End Tests using Cypress.
- Contributing to Meshery Docker Extension - How to contribute to Meshery Docker Extension
- Contributing to Meshery Docs - How to contribute to Meshery Docs.
- How to write MeshKit compatible errors - How to declare errors in Meshery components.
- Contributing to Meshery using git - How to contribute to Meshery using git
- Meshery CLI Contributing Guidelines - Design principles and code conventions.
- Contributing to Model Components - How to contribute to Meshery Model Components
- Contributing to Model Relationships - How to contribute to Meshery Models Relationships, Policies...
- Contributing to Models Quick Start - A no-fluff guide to creating your own Meshery Models quickly.
- Contributing to Models - How to contribute to Meshery Models, Components, Relationships, Policies...
- Contributing to Meshery Policies - How to contribute to Meshery Policies
- Contributing to Meshery Server Events - Guide is to help backend contributors send server events using Golang.
- Contributing to Meshery UI - Notification Center - How to contribute to the Notification Center in Meshery's web-based UI.
- Contributing to Meshery UI - Sistent - How to contribute to the Meshery's web-based UI using sistent design system.
- Contributing to Meshery's End-to-End Tests - How to contribute to End-to-End Tests using Playwright.
- Contributing to Meshery UI - How to contribute to Meshery UI (web-based user interface).
- Contributing to Meshery Server - How to contribute to Meshery Server
- Setting up Meshery Development Environment on Windows - How to set up Meshery Development Environment on Windows