1. Overview
This document defines the structure and building method of Higress Wasm Plugin images. When preparing, we referred to Wasm Image Specification.
2. Image Structure
Each image needs to be build in OCI Image Specification based on scratch
, and shall only contain following files:
- spec.yaml: Required. Metadata file of the plugin. Please refer to section 3 below for its format.
- README.md: Required. Readme file describing the usage of the plugin. Markdown format. Written in English or Chinese.
- README_{lang}.md: Optional. Readme file describing the usage of the plugin. Markdown format.
lang
can beZH
orEN
. - icon.png: Optional. Icon file of the plugin. A URL of the plugin icon can also be specified in spec.yaml. If both the file and the URL are configured, the file will be used for display.
- plugin.wasm: Required. The binary file of the plugin.
Each layer of the image can only contain a single file.
Except the layer containing plugin.wasm, the media type of other layers shall be set according to the file inside:
- spec.yaml: application/vnd.module.wasm.spec.v1+yaml
- README.md: application/vnd.module.wasm.doc.v1+markdown
- README_{lang}.md: application/vnd.module.wasm.doc.v1.{lang}+markdown
- icon.png: application/vnd.module.wasm.icon.v1+png
plugin.wasm must be placed in the last layer of the image, with the media type of application/vnd.oci.image.layer.v1.tar+gzip.
3. Metadata File Format
The format of metadata file, spec.yaml
, is as following, using the metadata of basic-auth
plugin as an example:
4. How to Build an Image
- Start the builder container from the Higress root folder
- Build Wasm file inside the container
- Build and push an OCI image
5. Appendix
5.1 Default Icon for Each Plugin Category
- Custom: https://img.alicdn.com/imgextra/i1/O1CN018iKKih1iVx287RltL_!!6000000004419-2-tps-42-42.png
- Authentication and Authorization: https://img.alicdn.com/imgextra/i4/O1CN01BPFGlT1pGZ2VDLgaH_!!6000000005333-2-tps-42-42.png
- Flow Control: https://img.alicdn.com/imgextra/i3/O1CN01bAFa9k1t1gdQcVTH0_!!6000000005842-2-tps-42-42.png
- Flow Monitor: https://img.alicdn.com/imgextra/i4/O1CN01aet3s61MoLOEEhRIo_!!6000000001481-2-tps-42-42.png
- Security Protection: https://img.alicdn.com/imgextra/i1/O1CN01jKT9vC1O059vNaq5u_!!6000000001642-2-tps-42-42.png
- Protocol Transformation: https://img.alicdn.com/imgextra/i2/O1CN01xIywow1mVGuRUjbhe_!!6000000004959-2-tps-42-42.png