Git Product home page Git Product logo

api's Introduction

MOSN logo

Build Status codecov Go Report Card license

中文

MOSN (Modular Open Smart Network) is a cloud-native network proxy written in Go language. It is open sourced by Ant Group and verified by hundreds of thousands of production containers in 11.11 global shopping festival. MOSN provides the capabilities of multiple protocol, modularity, intelligent and security. It integrates a large number of cloud-native components, and also integrates a Envoy network library, which is high-performance and easy to expand. MOSN and Istio can be integrated to build Service Mesh, and can also be used as independent L4/L7 load balancers, API gateways, cloud native Ingress, and etc.

Core capabilities

  • Istio integration
    • Integrates Istio 1.10 to run in full dynamic resource configuration mode
  • Core forwarding
    • Supports a self-contained server
    • Supports the TCP proxy
    • Supports the UDP proxy
    • Supports transparent traffic hijack mode
  • Multi-protocol
    • Supports HTTP/1.1 and HTTP/2
    • Supports protocol extension based on XProtocol framework
    • Supports protocol automatic identification
    • Supports gRPC
  • Core routing
    • Supports virtual host-based routing
    • Supports headers/URL/prefix/variable/dsl routing
    • Supports redirect/direct response/traffic mirror routing
    • Supports host metadata-based subset routing
    • Supports weighted routing.
    • Supports retries and timeout configuration
    • Supports request and response headers to add/remove
  • Back-end management & load balancing
    • Supports connection pools
    • Supports persistent connection's heart beat handling
    • Supports circuit breaker
    • Supports active back-end health check
    • Supports load balancing policies: random/rr/wrr/edf
    • Supports host metadata-based subset load balancing policies
    • Supports different cluster types: original dst/dns/simple
    • Supports cluster type extension
  • Observability
    • Support trace module extension
    • Integrates jaeger/skywalking
    • Support metrics with prometheus style
    • Support configurable access log
    • Support admin API extension
    • Integrates Holmes to automatic trigger pprof
  • TLS
    • Support multiple certificates matches, and TLS inspector mode.
    • Support SDS for certificate get and update
    • Support extensible certificate get, update and verify
    • Support CGo-based cipher suites: SM3/SM4
  • Process management
    • Supports hot upgrades
    • Supports graceful shutdown
  • Extension capabilities
    • Supports go-plugin based extension
    • Supports process based extension
    • Supports WASM based extension
    • Supports custom extensions configuration
    • Supports custom extensions at the TCP I/O layer and protocol layer

Download&Install

Use go get -u mosn.io/mosn, or you can git clone the repository to $GOPATH/src/mosn.io/mosn.

Documentation

Contributing

See our contributor guide.

Partners

Partners participate in MOSN co-development to make MOSN better.

End Users

The MOSN users. Please leave a comment here to tell us your scenario to make MOSN better!

Ecosystem

The MOSN community actively embraces the open source ecosystem and has established good relationships with the following open source communities.

Community

See our community materials on https://github.com/mosn/community.

Visit the MOSN website for more information on working groups, roadmap, community meetings, MOSN tutorials, and more.

Scan the QR code below with DingTalk(钉钉) to join the MOSN user group.

Community meeting

MOSN community holds regular meetings.

Landscapes

  

MOSN enriches the CNCF CLOUD NATIVE Landscape.

api's People

Contributors

antjack avatar bryce-huang avatar cch-4321 avatar champly avatar codefromthecrypt avatar dengqian avatar doujiang24 avatar fdingiit avatar jizhuozhi avatar knight42 avatar machine3 avatar nejisama avatar tanc010 avatar taoyuanyuan avatar trainyao avatar wangfakang avatar wenxuwan avatar yidwang avatar zonghaishang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api's Issues

route plugin support

背景

路由、负载均衡等都属于扩展SPI,目前客户的路由策略都是写死在mosn中,通过将路由能力抽象成插件的机制,允许根据不同的场景去做灵活的定制。

写死在mosn中有一些弊端:

  • 需要单独维护定制的分支,并且需要重新build mosn,客户增长,代码膨胀不利维护
  • 客户自定义策略,需要原厂研发去编写

什么是路由?

通俗来讲,就是根据一定算法,去筛选目标地址集合得到期望目标地址子集。路由插件化要做的事情:
将编写筛选的算法 开放出去,让客户自行决策,给定目标地址集合,返回目标地址子集。

收益:

  1. 完善Sofa Mesh插件扩展产品矩阵,丰富扩展场景
  2. 支持灵活路由策略,配合智能代码生成,增加产品差异化竞争能力

目标

  • 支持路由plugin级别扩展
  • 支持路由动态配置推送: 动态路由
  • 支持router chain机制

思路
开源侧提供route api, 商业版提供插件装载,形成产品能力,实现灵活扩展

方案设计

开源侧Route SPI ( 放到extensions,api无异议,商业版做完验证,提交pr

package router

import (
	"context"
	"mosn.io/api"
)

// RouteFactory create router handler for filter hosts
type RouteFactory interface {
	// Name router factory name
	// Route factory will be registered as unique component
	Name() string

	// Order parameter is used to sort multiple route plugins.
	// The default value is 0. The smaller the value, the earlier the route plugin is executed.
	Order() int

	// Configurator Dynamic route configuration push is supported
	Configurator() Configurator

	// CreateRouter create route handler with config
	// Configurator returns the latest route configuration for conf
	CreateRouter(ctx context.Context, conf map[string]interface{}) Handler
}

// Handler host list filter handler
type Handler interface {
	// Route filtering by request and invokers address list returns the final list of available services
	// meta: All hosts must contain the same tag, if any
	Route(ctx context.Context, request api.HeaderMap, invokers []api.HostInfo) (meta api.Metadata, hosts []api.HostInfo)
}

// Configurator Route configuration dynamic push feature
type Configurator interface {
	// Configure Transform dynamic configuration into programmable objects
	// The transformed object is passed to the RouterFactory CreateRouter
	// When dynamic configuration is pushed, Configure will be invoked.
	Configure(factory string, config string)

	// Configuration This is the route configuration after the latest conversion
	Configuration() map[string]interface{}
}

------ 以下在商业版mosn中实现, 开源无需关注-----

商业版脚手架支持

yiji@yiji-2 build % tree
.
├── codecs
│   ├── bolt
│   │   ├── codec-bolt-fa3442c8.so
│   │   ├── codec-bolt.md5
│   │   ├── egress_bolt.json
│   │   ├── ingress_bolt.json
│   │   └── metadata.json
│   └── bundle			
│       └── support     
│           └── routers	  // 会在插件包包含激活的 路由插件so和配置
├── image
│   └── Dockerfile
└── sidecar
    └── binary
        ├── mosn
        └── mosn-1.26.0-fdc2aa702.md5

商业版mosn route适配

  • mosn启动会装载包含路由插件的大包,启动期间注册RouteFactory
  • mosn去对接动态配置中心,收到动态推送 会查找RouteFactory 触发 Configurator配置解析,当下一次请求能够感知到最新的路由配置

因为mosn框架要实现路由必须满足RouteHandler接口,但是ClusterManager、ClusterSnapshot、HandlerStatus 开源api、pkg迁不出去:

type RouteHandler interface {
	// IsAvailable returns HandlerStatus represents the handler will be used/not used/stop next handler check
	IsAvailable(context.Context, ClusterManager) (ClusterSnapshot, HandlerStatus)
	// Route returns handler's route
	Route() api.Route
}

目前商业版是通过CloudRouteHandlerCreator去生成RouteHandler:

type CloudRouteHandlerCreator interface {
	RouterSpec
	CreateRouterHandler(ctx context.Context, headers types.HeaderMap, routers types.Routers) types.RouteHandler
}

因此需要针对插件的RouteFactory创建对应的factory.name -> CloudRouteHandlerCreator:

// 支持插件路由handler包装
// 负责解析路由动态配置,并且在实例化RouteHandler进行配置传递
type ConfiguratorRouteHandler interface {
    CloudRouteHandlerCreator

    // 返回关联的plugin factory
    // CloudRouteHandlerCreator返回的RouteHandler 会调用 RouteFactory创建的plugin handler
    RouteFactory() RouteFactory
}

// 实现RouteHandler接口,负责调用RouteFactory的plugin handler
type RouteHandlerAdaptor struct {
    
    conf map[string]interface{} // dynamic conf

    pluginHandler router.Handler // user extension router spi
    
    routers types.Routers		// routers
    headers types.HeaderMap		// request

    route    api.Route				// match header key-value route
    snapshot types.ClusterSnapshot	// cluster snapshot
}

func (r *RouteHandlerAdaptor) IsAvailable(ctx context.Context, manager types.ClusterManager) (types.ClusterSnapshot, types.HandlerStatus) {
	// invoke plugin route here...
    r.pluginHandler.Route(ctx context.Context, request api.HeaderMap, invokers []api.HostInfo)
}

Weekly Digest (10 April, 2020 - 17 April, 2020)

Here's the Weekly Digest for mosn/api:


ISSUES

Last week 1 issue was created.
It is closed now.

CLOSED ISSUES

❤️ #7 Feature protocol var., by wangfakang


PULL REQUESTS

Last week, 1 pull request was created, updated or merged.

MERGED PULL REQUEST

Last week, 1 pull request was merged.
💜 #7 Feature protocol var., by wangfakang


COMMITS

Last week there were 3 commits.
🛠️ Merge pull request #7 from wangfakang/feature-protocol_var Feature protocol var. by nejisama
🛠️ Add protocol var for flow. by wangfakang
🛠️ Merge pull request #4 from mosn/master sync from master. by wangfakang


CONTRIBUTORS

Last week there were 2 contributors.
👤 nejisama
👤 wangfakang


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository mosn/api to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.