easegress

module
v2.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: Apache-2.0

README

Easegress

Go Report Card GitHub Workflow Status (branch) codecov Docker pulls License GitHub go.mod Go version Join Easegress Slack OpenSSF Best Practices FOSSA Status

Easegress logo

What is Easegress

Easegress is a Cloud Native traffic orchestration system designed for:

  • High Availability: Built-in Raft consensus & leader election provides 99.99% availability.
  • Traffic Orchestration: Simple orchestration of various filters for each traffic pipeline.
  • High Performance: Lightweight and essential features speed up the performance.
  • Observability: There are many meaningful statistics periodically in a readable way.
  • Extensibility: It's easy to develop your own filter or controller with high-level programming language.
  • Integration: The simple interfaces make it easy to integrate with other systems, such as Kubernetes Ingress, EaseMesh sidecar, Workflow, etc.

The architecture of Easegress:

architecture

Features

  • Service Management
    • Multiple protocols:
      • HTTP/1.1
      • HTTP/2
      • HTTP/3(QUIC)
      • MQTT
    • Rich Routing Rules: exact path, path prefix, regular expression of the path, method, headers, clientIPs.
    • Resilience&Fault Tolerance
      • CircuitBreaker: temporarily blocks possible failures.
      • RateLimiter: limits the rate of incoming requests.
      • Retry: repeats failed executions.
      • TimeLimiter: limits the duration of execution.
    • Deployment Management
      • Blue-green Strategy: switches traffic at one time.
      • Canary Strategy: schedules traffic slightly.
    • API Management
      • API Aggregation: aggregates results of multiple APIs.
      • API Orchestration: orchestrates the flow of APIs.
    • Security
      • IP Filter: Limits access to IP addresses.
      • Static HTTPS: static certificate files.
      • API Signature: supports HMAC verification.
      • JWT Verification: verifies JWT Token.
      • OAuth2: validates OAuth/2 requests.
      • Let's Encrypt: automatically manage certificate files.
    • Pipeline-Filter Mechanism
      • Filter Management: makes it easy to develop new filters.
    • Service Mesh
      • Mesh Master: is the control plane to manage the lifecycle of mesh services.
      • Mesh Sidecar: is the data plane as the endpoint to do traffic interception and routing.
      • Mesh Ingress Controller: is the mesh-specific ingress controller to route external traffic to mesh services.

        Notes: This feature is leveraged by EaseMesh

    • Third-Part Integration
      • FaaS integrates with the serverless platform Knative.
      • Service Discovery integrates with Eureka, Consul, Etcd, and Zookeeper.
      • Ingress Controller integrates with Kubernetes as an ingress controller.
  • Extensibility
    • WebAssembly executes user developed WebAssembly code.
  • High Performance and Availability
    • Adaption: adapts request, response in the handling chain.
    • Validation: headers validation, OAuth2, JWT, and HMAC verification.
    • Load Balance: round-robin, random, weighted random, IP hash, header hash and support sticky sessions.
    • Cache: for the backend servers.
    • Compression: compresses body for the response.
    • Hot-Update: updates both config and binary of Easegress in place without losing connections.
  • Operation
    • Easy to Integrate: command line(egctl), Easegress Portal, HTTP clients such as curl, postman, etc.
    • Distributed Tracing
    • Observability
      • Node: role(primary, secondary), raft leader status, healthy or not, last heartbeat time, and so on
      • Traffic: in multi-dimension: server and backend.
        • Throughput: total and error statistics of request count, TPS/m1, m5, m15, and error percent, etc.
        • Latency: p25, p50, p75, p95, p98, p99, p999.
        • Data Size: request and response size.
        • Status Codes: HTTP status codes.
        • TopN: sorted by aggregated APIs(only in server dimension).

Getting Started

The basic usage of Easegress is to quickly set up a proxy for the backend servers.

Launch Easegress

Easegress can be installed from pre-built binaries or from source. For details, see Install.

Then we can execute the server:

$ easegress-server
2023-09-06T15:12:49.256+08:00   INFO    cluster/config.go:110   config: advertise-client-urls: ...
...

By default, Easegress opens ports 2379, 2380, and 2381; however, you can modify these settings along with other arguments either in the configuration file or via command-line arguments. For a complete list of arguments, please refer to the easegress-server --help command.

After launching successfully, we could check the status of the one-node cluster.

$ egctl get member
...

$ egctl describe member
...
Reverse Proxy

Assuming you have two backend HTTP services running at 127.0.0.1:9095 and 127.0.0.1:9096, you can initiate an HTTP proxy from port 10080 to these backends using the following command:

$ egctl create httpproxy demo --port 10080 \
  --rule="/pipeline=http://127.0.0.1:9095,http://127.0.0.1:9096"

Then try it:

$ curl -v 127.0.0.1:10080/pipeline

The request will be forwarded to either 127.0.0.1:9095/pipeline or 127.0.0.1:9096/pipeline, utilizing a round-robin load-balancing policy.

More about getting started with Easegress:

Use Cases

The following examples show how to use Easegress for different scenarios.

For full list, see Tutorials and Cookbook.

Documentation

Easegress Portal

Easegress Portal is an intuitive, open-source user interface for the Easegress traffic orchestration system. Developed with React.js, this portal provides config management, metrics, and visualizations, enhancing the overall Easegress experience.

Screenshots

1. Cluster Management

cluster

2. Traffic Management

traffic http server

3. Pipeline Management

pipeline detail

Community

Contributing

See Contributing guide. The project welcomes contributions and suggestions that abide by the CNCF Code of Conduct.

License

Easegress is under the Apache 2.0 license. See the LICENSE file for details.

FOSSA Status

Directories

Path Synopsis
build
test
Package test is for integration testing.
Package test is for integration testing.
cmd
Package cmd contains useful functions for Easegress server and client.
Package cmd contains useful functions for Easegress server and client.
builder
Package main is the entry point of egbuilder.
Package main is the entry point of egbuilder.
builder/build
Package build contains utils for egbuilder build command.
Package build contains utils for egbuilder build command.
builder/command
Package command contains commands for egbuilder.
Package command contains commands for egbuilder.
builder/gen
Package gen generates codes for egbuilder.
Package gen generates codes for egbuilder.
builder/utils
* Copyright (c) 2017, The Easegress Authors * All rights reserved.
* Copyright (c) 2017, The Easegress Authors * All rights reserved.
client
Package main is the entry point of Easegress client.
Package main is the entry point of Easegress client.
client/command
Package command provides the commands.
Package command provides the commands.
client/commandv2
Package commandv2 provides the new version of commands.
Package commandv2 provides the new version of commands.
client/commandv2/create
Package create provides create commands.
Package create provides create commands.
client/general
Package general provides the general utilities for the client.
Package general provides the general utilities for the client.
client/resources
Package resources provides the resources utilities for the client.
Package resources provides the resources utilities for the client.
server
Package main is the entry point of Easegress server.
Package main is the entry point of Easegress server.
example
backend-service/echo
Package main is the entry point of the simple echo server.
Package main is the entry point of the simple echo server.
backend-service/mirror
Package main is the entry point of the simple mirror server.
Package main is the entry point of the simple mirror server.
backend-service/remote
Package main is the entry point of the simple Easegress remote server.
Package main is the entry point of the simple Easegress remote server.
pkg
api
Package api implements the HTTP API of Easegress.
Package api implements the HTTP API of Easegress.
cluster
Package cluster provides the cluster management.
Package cluster provides the cluster management.
cluster/clustertest
Package clustertest provides a mocked cluster for testing.
Package clustertest provides a mocked cluster for testing.
cluster/customdata
Package customdata provides a way to store custom data in Easegress cluster.
Package customdata provides a way to store custom data in Easegress cluster.
common
Package common provides several common utilities for other packages.
Package common provides several common utilities for other packages.
context
Package context provides the context for traffic handlers.
Package context provides the context for traffic handlers.
context/contexttest
Package contexttest provides utilities for testing context.
Package contexttest provides utilities for testing context.
env
Package env provides functions for environment variables.
Package env provides functions for environment variables.
filters
Package filters implements common functionality of filters.
Package filters implements common functionality of filters.
filters/builder
Package builder implements builder filters.
Package builder implements builder filters.
filters/certextractor
Package certextractor implements a filter to extract given field from TLS.
Package certextractor implements a filter to extract given field from TLS.
filters/connectcontrol
Package connectcontrol implements filter for controlling connections of MQTT clients
Package connectcontrol implements filter for controlling connections of MQTT clients
filters/corsadaptor
Package corsadaptor implements a filter that adapts CORS stuff.
Package corsadaptor implements a filter that adapts CORS stuff.
filters/fallback
Package fallback implements the fallback filter.
Package fallback implements the fallback filter.
filters/headerlookup
Package headerlookup implements a filter that enriches request headers per request, looking up values from etcd.
Package headerlookup implements a filter that enriches request headers per request, looking up values from etcd.
filters/headertojson
Package headertojson implements a filter to convert HTTP request header to json.
Package headertojson implements a filter to convert HTTP request header to json.
filters/kafka
Package kafka implements a kafka proxy for MQTT requests.
Package kafka implements a kafka proxy for MQTT requests.
filters/kafkabackend
Package kafka implements a kafka proxy for HTTP requests.
Package kafka implements a kafka proxy for HTTP requests.
filters/meshadaptor
Package meshadaptor provides MeshAdaptor filter.
Package meshadaptor provides MeshAdaptor filter.
filters/mock
Package mock provides Mock filter.
Package mock provides Mock filter.
filters/mqttclientauth
Package mqttclientauth implements authentication for MQTT clients.
Package mqttclientauth implements authentication for MQTT clients.
filters/oidcadaptor
Package oidcadaptor implements OpenID Connect authorization.
Package oidcadaptor implements OpenID Connect authorization.
filters/opafilter
Package opafilter implements OpenPolicyAgent function.
Package opafilter implements OpenPolicyAgent function.
filters/proxies
Package proxies provides the common interface and implementation of proxies.
Package proxies provides the common interface and implementation of proxies.
filters/proxies/grpcproxy
Package grpcproxy provides the proxy filter of gRPC.
Package grpcproxy provides the proxy filter of gRPC.
filters/proxies/httpproxy
Package httpproxy provides the Proxy of HTTP.
Package httpproxy provides the Proxy of HTTP.
filters/ratelimiter
Package ratelimiter implements a rate limiter.
Package ratelimiter implements a rate limiter.
filters/redirector
Package redirector implements a filter to handle HTTP redirects.
Package redirector implements a filter to handle HTTP redirects.
filters/redirectorv2
Package redirector implements a filter to handle HTTP redirects.
Package redirector implements a filter to handle HTTP redirects.
filters/remotefilter
Package remotefilter implements the RemoteFilter filter to invokes remote apis.
Package remotefilter implements the RemoteFilter filter to invokes remote apis.
filters/topicmapper
Package topicmapper maps MQTT topic to Kafka topics and key-value headers
Package topicmapper maps MQTT topic to Kafka topics and key-value headers
filters/validator
Package validator provides Validator filter to validates HTTP requests.
Package validator provides Validator filter to validates HTTP requests.
filters/wasmhost
Package wasmhost implements a host environment for WebAssembly.
Package wasmhost implements a host environment for WebAssembly.
graceupdate
Package graceupdate provides graceful update for easegress.
Package graceupdate provides graceful update for easegress.
logger
Package logger provides logger for Easegress.
Package logger provides logger for Easegress.
object/autocertmanager
Package autocertmanager provides AutoCertManager to manage certificates automatically.
Package autocertmanager provides AutoCertManager to manage certificates automatically.
object/consulserviceregistry
Package consulserviceregistry provides ConsulServiceRegistry.
Package consulserviceregistry provides ConsulServiceRegistry.
object/easemonitormetrics
Package easemonitormetrics provides EaseMonitorMetrics.
Package easemonitormetrics provides EaseMonitorMetrics.
object/etcdserviceregistry
Package eserviceregistry provides EtcdServiceRegistry.
Package eserviceregistry provides EtcdServiceRegistry.
object/eurekaserviceregistry
Package eurekaserviceregistry provides EurekaServiceRegistry.
Package eurekaserviceregistry provides EurekaServiceRegistry.
object/function
Package function provides FaasController.
Package function provides FaasController.
object/function/provider
Package provider defines and implements FaasProvider interface.
Package provider defines and implements FaasProvider interface.
object/function/spec
Package spec provides the spec for FaaS.
Package spec provides the spec for FaaS.
object/function/storage
Package storage provides the storage for FaaS.
Package storage provides the storage for FaaS.
object/function/worker
Package worker provides the worker for FaaSController.
Package worker provides the worker for FaaSController.
object/gatewaycontroller
Package gateway implements k8s gateway API.
Package gateway implements k8s gateway API.
object/globalfilter
Package globalfilter provides GlobalFilter.
Package globalfilter provides GlobalFilter.
object/grpcserver
Package grpcserver implements the GRPCServer.
Package grpcserver implements the GRPCServer.
object/httpserver
Package httpserver implements the HTTPServer.
Package httpserver implements the HTTPServer.
object/httpserver/routers
Package routers provides the router interface and the implementation of different routing policies.
Package routers provides the router interface and the implementation of different routing policies.
object/httpserver/routers/ordered
Package ordered provides the router implementation of ordered routing policy.
Package ordered provides the router implementation of ordered routing policy.
object/httpserver/routers/radixtree
Package radixtree provides the router implementation of radix tree routing policy.
Package radixtree provides the router implementation of radix tree routing policy.
object/ingresscontroller
Package ingresscontroller implements a K8s ingress controller.
Package ingresscontroller implements a K8s ingress controller.
object/meshcontroller
Package meshcontroller provides the service mesh controller.
Package meshcontroller provides the service mesh controller.
object/meshcontroller/api
Package api provides the API for mesh controller.
Package api provides the API for mesh controller.
object/meshcontroller/certmanager
Package certmanager provides the cert manager for mesh controller.
Package certmanager provides the cert manager for mesh controller.
object/meshcontroller/informer
Package informer provides the informer for mesh controller.
Package informer provides the informer for mesh controller.
object/meshcontroller/ingresscontroller
Package ingresscontroller implements the ingress controller for service mesh.
Package ingresscontroller implements the ingress controller for service mesh.
object/meshcontroller/label
Package label defines labels.
Package label defines labels.
object/meshcontroller/layout
Package layout defines the layout of the data in etcd.
Package layout defines the layout of the data in etcd.
object/meshcontroller/master
Package master provides master role of Easegress for mesh control plane.
Package master provides master role of Easegress for mesh control plane.
object/meshcontroller/registrycenter
Package registrycenter provides registry center server.
Package registrycenter provides registry center server.
object/meshcontroller/service
Package service provides business layer between mesh and store.
Package service provides business layer between mesh and store.
object/meshcontroller/spec
Package spec defines the spec for various objects in mesh.
Package spec defines the spec for various objects in mesh.
object/meshcontroller/storage
Package storage provides the storage APIs.
Package storage provides the storage APIs.
object/meshcontroller/worker
Package worker provides the worker for mesh controller.
Package worker provides the worker for mesh controller.
object/mock
Package mock implements some mock objects.
Package mock implements some mock objects.
object/mqttproxy
Package mqttproxy implements the MQTTProxy.
Package mqttproxy implements the MQTTProxy.
object/nacosserviceregistry
Package nacosserviceregistry provides the NacosServiceRegistry.
Package nacosserviceregistry provides the NacosServiceRegistry.
object/pipeline
Package pipeline provides the pipeline of Easegress.
Package pipeline provides the pipeline of Easegress.
object/rawconfigtrafficcontroller
Package rawconfigtrafficcontroller implements the RawConfigTrafficController.
Package rawconfigtrafficcontroller implements the RawConfigTrafficController.
object/serviceregistry
Package serviceregistry provides the service registry.
Package serviceregistry provides the service registry.
object/statussynccontroller
Package statussynccontroller implements the StatusSyncController.
Package statussynccontroller implements the StatusSyncController.
object/trafficcontroller
Package trafficcontroller implements the TrafficController.
Package trafficcontroller implements the TrafficController.
object/zookeeperserviceregistry
Package zookeeperserviceregistry implements the ZookeeperServiceRegistry.
Package zookeeperserviceregistry implements the ZookeeperServiceRegistry.
option
Package option implements the start-up options.
Package option implements the start-up options.
pidfile
Package pidfile provides pidfile related functions.
Package pidfile provides pidfile related functions.
profile
Package profile provides profile related functions.
Package profile provides profile related functions.
protocols
Package protocols defines the common interface of protocols used in Easegress.
Package protocols defines the common interface of protocols used in Easegress.
protocols/grpcprot
Package grpcprot implements the grpc protocol.
Package grpcprot implements the grpc protocol.
protocols/httpprot
Package httpprot implements the HTTP protocol.
Package httpprot implements the HTTP protocol.
protocols/httpprot/httpheader
Package httpheader provides HTTP Header related functions.
Package httpheader provides HTTP Header related functions.
protocols/httpprot/httpstat
Package httpstat implements the statistics tool for HTTP traffic.
Package httpstat implements the statistics tool for HTTP traffic.
protocols/mqttprot
Package mqttprot implements the MQTT protocol.
Package mqttprot implements the MQTT protocol.
registry
Package registry is the registry of filters and objects in Easegress.
Package registry is the registry of filters and objects in Easegress.
resilience
Package resilience implements the resilience policies.
Package resilience implements the resilience policies.
supervisor
Package supervisor implements the supervisor of all objects.
Package supervisor implements the supervisor of all objects.
tracing
Package tracing implements the tracing.
Package tracing implements the tracing.
util/circuitbreaker
Package circuitbreaker implements the circuit breaker logic.
Package circuitbreaker implements the circuit breaker logic.
util/codecounter
Package codecounter provides a goroutine unsafe HTTP status code counter.
Package codecounter provides a goroutine unsafe HTTP status code counter.
util/codectool
Package codectool provides some codec tools for JSON and YAML marshaling.
Package codectool provides some codec tools for JSON and YAML marshaling.
util/dynamicobject
Package dynamicobject provides a dynamic object.
Package dynamicobject provides a dynamic object.
util/easemonitor
Package easemonitor provides the common fields and interfaces for EaseMonitor metrics.
Package easemonitor provides the common fields and interfaces for EaseMonitor metrics.
util/fasttime
Package fasttime provides fast time.Now() and time.Since() and time.Format().
Package fasttime provides fast time.Now() and time.Since() and time.Format().
util/filterwriter
Package filterwriter provides a filter writer.
Package filterwriter provides a filter writer.
util/ipfilter
Package ipfilter provides IPFilter.
Package ipfilter provides IPFilter.
util/jmxtool
Package jmxtool provides some tools for jmx
Package jmxtool provides some tools for jmx
util/k8s
Package k8s provides kubernetes utilities.
Package k8s provides kubernetes utilities.
util/limitlistener
Package limitlistener provides a Listener that accepts at most n simultaneous.
Package limitlistener provides a Listener that accepts at most n simultaneous.
util/objectpool
Package objectpool provides Pool of interface PoolObject
Package objectpool provides Pool of interface PoolObject
util/pathadaptor
Package pathadaptor provides a path adaptor.
Package pathadaptor provides a path adaptor.
util/prometheushelper
Package prometheushelper provides helper functions for prometheus.
Package prometheushelper provides helper functions for prometheus.
util/ratelimiter
Package ratelimiter provides a rate limiter
Package ratelimiter provides a rate limiter
util/readers
Package readers provides several readers.
Package readers provides several readers.
util/sampler
Package sampler provides utilities for sampling.
Package sampler provides utilities for sampling.
util/sem
Package sem provides a semaphore with a max capacity.
Package sem provides a semaphore with a max capacity.
util/signer
Package signer provides a signer for HTTP requests.
Package signer provides a signer for HTTP requests.
util/stringtool
Package stringtool provides string utilities.
Package stringtool provides string utilities.
util/timetool
Package timetool provides time utilities.
Package timetool provides time utilities.
util/urlclusteranalyzer
Package urlclusteranalyzer provides url cluster analyzer.
Package urlclusteranalyzer provides url cluster analyzer.
util/urlrule
Package urlrule impelments match rule for HTTP requests.
Package urlrule impelments match rule for HTTP requests.
v
Package v implements the common validation logic of Easegress.
Package v implements the common validation logic of Easegress.
version
Package version defines the version of Easegress.
Package version defines the version of Easegress.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL