go~istio加載wasm的步驟

參考

mse網關及插件的測試

網關轉發到上游服務

test

istio中加載wasm插件

istio-wasm

go語言通過tinygo編譯wasm文件

TinyGo 是一個 Go 編譯器,旨在用於微控制器,WebAssembly(WASM)和命令行工具等小型場景。它重用了 Go 語言工具和 LLVM 一起使用的庫,以提供編譯用 Go 編程語言編寫的程序的另一種方法。

tinygo build -o main.wasm -scheduler=none -target=wasi -gc=custom -tags='custommalloc nottinygc_finalizer' ./main.go

本地測試wasm具體步驟

Here is a brief explanation of the effective mechanism of the plugin:(下面對插件的有效機制作簡要說明:)

  1. The user compiles the code into a Wasm file(用戶編譯代碼爲wasm文件)
  2. The user builds the Wasm file into a Docker image(用戶將wasm文件構建爲Docker鏡像)
  3. The user pushes the Docker image to the image registry(用戶將Docker鏡像推送到鏡像倉庫)
  4. The user creates the WasmPlugin resource(用戶創建WasmPlugin資源)
  5. Istio watches changes of the WasmPlugin resource(Istio監聽WasmPlugin資源的變化)
  6. The xDS proxy process in Higress Gateway obtains the configuration from Istio and finds the image address of the plugin.(Higress Gateway中的xDS代理進程從Istio獲取配置,並找到插件的鏡像地址)
  7. xDS proxy pulls images from the image registry.(xDS代理從鏡像倉庫拉取鏡像)
  8. xDS proxy extracts the Wasm file from the image.(xDS代理從鏡像中提取wasm文件)
  9. The envoy process in the Higress Gateway obtains the configuration from the xDS proxy and discovers the local path of the Wasm file.(Higress Gateway中的envoy進程從xDS代理獲取配置,並發現wasm文件的本地路徑)
  10. Envoy loads the Wasm file from the local file.(Envoy從本地文件加載wasm文件)

Here, Envoy uses the Extension Config Discovery Service (ECDS) mechanism to obtain the configuration and load the Wasm file, which realizes the update of the Wasm file and direct hot loading without causing any connection interruption, and the business traffic is completely lossless.(這裏Envoy使用Extension Config Discovery Service(ECDS)機制獲取配置並加載wasm文件,實現了wasm文件的更新和直接熱加載,不會造成任何連接中斷,業務流量完全無損。)

xDS代理是一種用於管理服務發現和負載均衡的代理程序。在微服務架構中,服務之間需要相互通信,而xDS代理則可以幫助實現這種通信。xDS代理通過與服務註冊中心進行交互,獲取當前可用的服務實例信息,並根據負載均衡策略將請求分發到合適的服務實例上。同時,xDS代理還能夠監控服務實例的健康狀態,及時更新服務列表,確保服務的高可用性和穩定性。常見的xDS代理有Envoy、Nginx等。

TinyGo 是一個 Go 編譯器,旨在用於微控制器,WebAssembly(WASM)和命令行工具等小型場景。它重用了 Go 語言工具和 LLVM 一起使用的庫,以提供編譯用 Go 編程語言編寫的程序的另一種方法。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章