configuration provider like Istio, Kuma or files, we call it provisoner.
configuration translator to translate data formats from xDS to APISIX, we call it adaptor.
the core server of the apisix-mesh-agent, we call it controller.
configuration (in the form of APISIX) in memory storage, we call it cache.
etcd server, gets configuration from cache and adds metadata to client (APISIX), we call it etcd server.
provisoner
It's a generic concept, which doesn't care the configuration source type, it can be xDS or UDPA or whatever anything else. It just defines the most basic behavior that a configuration provider should have.
type Provisioner interface {
Channel() <- chan Event
}
It only provides a method Channel that returns a read only channel, one can watch this channel and got events from there.
For xDS, which is the first provisioner we must implement, will define a function NewXDSProvisioner to initialize a xDS typed provisioner.
The Event contains the event type, event source (useful for logging), event data.
type Event struct {
Type string
Value interface{}
Source string
}
adaptor
adaptor is also a generic concept which embedded inside the provisioner, before a provisioner sends event to the channel, it converts the data from the original type to the APISIX form.
For the xDS provisioner, we'll have a XDSAdaptor interface.
type XDSAdaptor interface {
AdaptRoute()
AdaptUpstream()
AdaptSSL()
......
}
cache
cache defines how apisix-mesh-agent maintains the data, we'll provide an in-memory solution.
type Cache interface {
Add()
Update()
Delete()
Get()
List()
}
etcd server
The etcd server exposes HTTP endpoints and accepts requests to get data from cache. Since there'll so many watch requests there, etcd server should also maintains a channel to accepts changes and reflects them to clients.
type EtcdServer interface {
Channel() chan interface{}
....
}
controller
The controller, which watches on the provisioner channel and gets data there and reflects them to cache, then it sends these changes to the channel of etcd server (watch).
It also exposes other HTTP APIs to let administrator to know the internal states, like cache, metrics.
The big five parts of apisix-mesh-agent are:
provisoner
It's a generic concept, which doesn't care the configuration source type, it can be xDS or UDPA or whatever anything else. It just defines the most basic behavior that a configuration provider should have.
It only provides a method
Channel
that returns a read only channel, one can watch this channel and got events from there.For xDS, which is the first provisioner we must implement, will define a function
NewXDSProvisioner
to initialize a xDS typed provisioner.The
Event
contains the event type, event source (useful for logging), event data.adaptor
adaptor
is also a generic concept which embedded inside theprovisioner
, before aprovisioner
sends event to the channel, it converts the data from the original type to the APISIX form.For the xDS
provisioner
, we'll have aXDSAdaptor
interface.cache
cache
defines how apisix-mesh-agent maintains the data, we'll provide an in-memory solution.etcd server
The etcd server exposes HTTP endpoints and accepts requests to get data from cache. Since there'll so many watch requests there, etcd server should also maintains a channel to accepts changes and reflects them to clients.
controller
The
controller
, which watches on theprovisioner
channel and gets data there and reflects them to cache, then it sends these changes to the channel of etcd server (watch).It also exposes other HTTP APIs to let administrator to know the internal states, like cache, metrics.