Documentation
¶
Index ¶
- Constants
- Variables
- func IngressHTTPServerSpec(port int, rules []*IngressRule) (*supervisor.Spec, error)
- type Admin
- type Canary
- type CanaryRule
- type GlobalCanaryHeaders
- type Ingress
- type IngressPath
- type IngressRule
- type LoadBalance
- type Observability
- type ObservabilityMetrics
- type ObservabilityMetricsDetail
- type ObservabilityOutputServer
- type ObservabilityTracings
- type ObservabilityTracingsDetail
- type ObservabilityTracingsOutputConfig
- type Resilience
- type Service
- func (s *Service) ApplicationEndpoint(port uint32) string
- func (s *Service) EgressEndpoint() string
- func (s *Service) EgressHTTPServerName() string
- func (s *Service) EgressHandlerName() string
- func (s *Service) EgressPipelineName() string
- func (s *Service) IngressEndpoint() string
- func (s *Service) IngressHTTPServerName() string
- func (s *Service) IngressHandlerName() string
- func (s *Service) IngressPipelineName() string
- func (s *Service) IngressPipelineSpec(instanceSpecs []*ServiceInstanceSpec) (*supervisor.Spec, error)
- func (s *Service) SideCarEgressHTTPServerSpec() (*supervisor.Spec, error)
- func (s *Service) SideCarEgressPipelineSpec(instanceSpecs []*ServiceInstanceSpec) (*supervisor.Spec, error)
- func (s *Service) SideCarIngressHTTPServerSpec() (*supervisor.Spec, error)
- func (s *Service) SideCarIngressPipelineSpec(applicationPort uint32) (*supervisor.Spec, error)
- func (s *Service) UniqueCanaryHeaders() []string
- type ServiceInstanceSpec
- type ServiceInstanceStatus
- type Sidecar
- type Tenant
Constants ¶
const ( // RegistryTypeConsul is the consul registry type. RegistryTypeConsul = "consul" // RegistryTypeEureka is the eureka registry type. RegistryTypeEureka = "eureka" // RegistryTypeNacos is the eureka registry type. RegistryTypeNacos = "nacos" // GlobalTenant is the reserved name of the system scope tenant, // its services can be accessible in mesh wide. GlobalTenant = "global" // ServiceStatusUp indicates this service instance can accept ingress traffic ServiceStatusUp = "UP" // ServiceStatusOutOfService indicates this service instance can't accept ingress traffic ServiceStatusOutOfService = "OUT_OF_SERVICE" // WorkerAPIPort is the default port for worker's API server WorkerAPIPort = 13009 // IngressPort is the default port for ingress controller IngressPort = 13010 // HeartbeatInterval is the default heartbeat interval for checking service heartbeat HeartbeatInterval = "5s" )
Variables ¶
var ( // ErrParamNotMatch means RESTful request URL's object name or other fields are not matched in this request's body ErrParamNotMatch = fmt.Errorf("param in url and body's spec not matched") // ErrAlreadyRegistered indicates this instance has already been registered ErrAlreadyRegistered = fmt.Errorf("service already registered") // ErrNoRegisteredYet indicates this instance haven't registered successfully yet ErrNoRegisteredYet = fmt.Errorf("service not registered yet") // ErrServiceNotFound indicates could find target service in its tenant or in global tenant ErrServiceNotFound = fmt.Errorf("can't find service in its tenant or in global tenant") // ErrServiceNotavailable indicates could find target service's available instances. ErrServiceNotavailable = fmt.Errorf("can't find service available instances") )
Functions ¶
func IngressHTTPServerSpec ¶
func IngressHTTPServerSpec(port int, rules []*IngressRule) (*supervisor.Spec, error)
IngressHTTPServerSpec generates HTTP server spec for ingress. as ingress does not belong to a service, it is not a method of 'Service'
Types ¶
type Admin ¶
type Admin struct {
// HeartbeatInterval is the interval for one service instance reporting its heartbeat.
HeartbeatInterval string `yaml:"heartbeatInterval" jsonschema:"required,format=duration"`
// RegistryTime indicates which protocol the registry center accepts.
RegistryType string `yaml:"registryType" jsonschema:"required"`
// APIPort is the port for worker's API server
APIPort int `yaml:"apiPort" jsonschema:"omitempty"`
// IngressPort is the port for http server in mesh ingress
IngressPort int `yaml:"ingressPort" jsonschema:"omitempty"`
}
Admin is the spec of MeshController.
type Canary ¶
type Canary struct {
CanaryRules []*CanaryRule `yaml:"canaryRules" jsonschema:"omitempty"`
}
Canary is the spec of service canary.
type CanaryRule ¶
type CanaryRule struct {
ServiceInstanceLabels map[string]string `yaml:"serviceInstanceLabels" jsonschema:"required"`
Headers map[string]*urlrule.StringMatch `yaml:"headers" jsonschema:"required"`
URLs []*urlrule.URLRule `yaml:"urls" jsonschema:"required"`
}
CanaryRule is one matching rule for canary.
type GlobalCanaryHeaders ¶
type GlobalCanaryHeaders struct {
ServiceHeaders map[string][]string `yaml:"serviceHeaders" jsonschema:"omitempty"`
}
GlobalCanaryLabels is the spec of global service
type Ingress ¶
type Ingress struct {
Name string `yaml:"name" jsonschema:"required"`
Rules []*IngressRule `yaml:"rules" jsonschema:"required"`
}
Ingress is the spec of mesh ingress
type IngressPath ¶
type IngressPath struct {
Path string `yaml:"path" jsonschema:"required"`
RewriteTarget string `yaml:"rewriteTarget" jsonschema:"omitempty"`
Backend string `yaml:"backend" jsonschema:"required"`
}
IngressPath is the path for a mesh ingress rule
type IngressRule ¶
type IngressRule struct {
Host string `yaml:"host" jsonschema:"omitempty"`
Paths []*IngressPath `yaml:"paths" jsonschema:"required"`
}
IngressRule is the rule for mesh ingress
type LoadBalance ¶
type LoadBalance = proxy.LoadBalance
LoadBalance is the spec of service load balance.
type Observability ¶
type Observability struct {
OutputServer *ObservabilityOutputServer `yaml:"outputServer" jsonschema:"omitempty"`
Tracings *ObservabilityTracings `yaml:"tracings" jsonschema:"omitempty"`
Metrics *ObservabilityMetrics `yaml:"metrics" jsonschema:"omitempty"`
}
Observability is the spec of service observability.
type ObservabilityMetrics ¶
type ObservabilityMetrics struct {
Enabled bool `yaml:"enabled" jsonschema:"required"`
Access ObservabilityMetricsDetail `yaml:"access" jsonschema:"required"`
Request ObservabilityMetricsDetail `yaml:"request" jsonschema:"required"`
JdbcStatement ObservabilityMetricsDetail `yaml:"jdbcStatement" jsonschema:"required"`
JdbcConnection ObservabilityMetricsDetail `yaml:"jdbcConnection" jsonschema:"required"`
Rabbit ObservabilityMetricsDetail `yaml:"rabbit" jsonschema:"required"`
Kafka ObservabilityMetricsDetail `yaml:"kafka" jsonschema:"required"`
Redis ObservabilityMetricsDetail `yaml:"redis" jsonschema:"required"`
JvmGC ObservabilityMetricsDetail `yaml:"jvmGc" jsonschema:"required"`
JvmMemory ObservabilityMetricsDetail `yaml:"jvmMemory" jsonschema:"required"`
Md5Dictionary ObservabilityMetricsDetail `yaml:"md5Dictionary" jsonschema:"required"`
}
ObservabilityMetrics is the metrics of observability.
type ObservabilityMetricsDetail ¶
type ObservabilityMetricsDetail struct {
Enabled bool `yaml:"enabled" jsonschema:"required"`
Interval int `yaml:"interval" jsonschema:"required"`
Topic string `yaml:"topic" jsonschema:"required"`
}
ObservabilityMetricsDetail is the metrics detail of observability.
type ObservabilityOutputServer ¶
type ObservabilityOutputServer struct {
Enabled bool `yaml:"enabled" jsonschema:"required"`
BootstrapServer string `yaml:"bootstrapServer" jsonschema:"required"`
Timeout int `yaml:"timeout" jsonschema:"required"`
}
ObservabilityOutputServer is the output server of observability.
type ObservabilityTracings ¶
type ObservabilityTracings struct {
Enabled bool `yaml:"enabled" jsonschema:"required"`
SampleByQPS int `yaml:"sampleByQPS" jsonschema:"required"`
Output ObservabilityTracingsOutputConfig `yaml:"output" jsonschema:"required"`
Request ObservabilityTracingsDetail `yaml:"request" jsonschema:"required"`
RemoteInvoke ObservabilityTracingsDetail `yaml:"remoteInvoke" jsonschema:"required"`
Kafka ObservabilityTracingsDetail `yaml:"kafka" jsonschema:"required"`
Jdbc ObservabilityTracingsDetail `yaml:"jdbc" jsonschema:"required"`
Redis ObservabilityTracingsDetail `yaml:"redis" jsonschema:"required"`
Rabbit ObservabilityTracingsDetail `yaml:"rabbit" jsonschema:"required"`
}
ObservabilityTracings is the tracings of observability.
type ObservabilityTracingsDetail ¶
type ObservabilityTracingsDetail struct {
Enabled bool `yaml:"enabled" jsonschema:"required"`
ServicePrefix string `yaml:"servicePrefix" jsonschema:"required"`
}
ObservabilityTracingsDetail is the tracing detail of observability.
type ObservabilityTracingsOutputConfig ¶
type ObservabilityTracingsOutputConfig struct {
Enabled bool `yaml:"enabled" jsonschema:"required"`
ReportThread int `yaml:"reportThread" jsonschema:"required"`
Topic string `yaml:"topic" jsonschema:"required"`
MessageMaxBytes int `yaml:"messageMaxBytes" jsonschema:"required"`
QueuedMaxSpans int `yaml:"queuedMaxSpans" jsonschema:"required"`
QueuedMaxSize int `yaml:"queuedMaxSize" jsonschema:"required"`
MessageTimeout int `yaml:"messageTimeout" jsonschema:"required"`
}
type Resilience ¶
type Resilience struct {
RateLimiter *ratelimiter.Spec `yaml:"rateLimiter" jsonschema:"omitempty"`
CircuitBreaker *circuitbreaker.Spec `yaml:"circuitBreaker" jsonschema:"omitempty"`
Retryer *retryer.Spec `yaml:"retryer" jsonschema:"omitempty"`
TimeLimiter *timelimiter.Spec `yaml:"timeLimiter" jsonschema:"omitempty"`
}
Resilience is the spec of service resilience.
type Service ¶
type Service struct {
Name string `yaml:"name" jsonschema:"required"`
RegisterTenant string `yaml:"registerTenant" jsonschema:"required"`
Sidecar *Sidecar `yaml:"sidecar" jsonschema:"required"`
Resilience *Resilience `yaml:"resilience" jsonschema:"omitempty"`
Canary *Canary `yaml:"canary" jsonschema:"omitempty"`
LoadBalance *LoadBalance `yaml:"loadBalance" jsonschema:"omitempty"`
Observability *Observability `yaml:"observability" jsonschema:"omitempty"`
}
Service contains the information of service.
func (*Service) ApplicationEndpoint ¶
func (*Service) EgressEndpoint ¶
func (*Service) EgressHTTPServerName ¶
func (*Service) EgressHandlerName ¶
func (*Service) EgressPipelineName ¶
func (*Service) IngressEndpoint ¶
func (*Service) IngressHTTPServerName ¶
func (*Service) IngressHandlerName ¶
func (*Service) IngressPipelineName ¶
func (*Service) IngressPipelineSpec ¶
func (s *Service) IngressPipelineSpec(instanceSpecs []*ServiceInstanceSpec) (*supervisor.Spec, error)
func (*Service) SideCarEgressHTTPServerSpec ¶
func (s *Service) SideCarEgressHTTPServerSpec() (*supervisor.Spec, error)
func (*Service) SideCarEgressPipelineSpec ¶
func (s *Service) SideCarEgressPipelineSpec(instanceSpecs []*ServiceInstanceSpec) (*supervisor.Spec, error)
func (*Service) SideCarIngressHTTPServerSpec ¶
func (s *Service) SideCarIngressHTTPServerSpec() (*supervisor.Spec, error)
func (*Service) SideCarIngressPipelineSpec ¶
func (s *Service) SideCarIngressPipelineSpec(applicationPort uint32) (*supervisor.Spec, error)
func (*Service) UniqueCanaryHeaders ¶
UniqueCanaryHeaders returns the unique headers in canary filter rules.
type ServiceInstanceSpec ¶
type ServiceInstanceSpec struct {
// Provide by registry client
ServiceName string `yaml:"serviceName" jsonschema:"required"`
InstanceID string `yaml:"instanceID" jsonschema:"required"`
IP string `yaml:"ip" jsonschema:"required"`
Port uint32 `yaml:"port" jsonschema:"required"`
RegistryTime string `yaml:"registryTime" jsonschema:"omitempty"`
Labels map[string]string `yaml:"labels" jsonschema:"omitempty"`
// Set by heartbeat timer event or API
Status string `yaml:"status" jsonschema:"omitempty"`
}
ServiceInstanceSpec is the spec of service instance.
type ServiceInstanceStatus ¶
type ServiceInstanceStatus struct {
ServiceName string `yaml:"serviceName" jsonschema:"required"`
InstanceID string `yaml:"instanceID" jsonschema:"required"`
// RFC3339 format
LastHeartbeatTime string `yaml:"lastHeartbeatTime" jsonschema:"required,format=timerfc3339"`
}
ServiceInstanceStatus is the status of service instance.
type Sidecar ¶
type Sidecar struct {
DiscoveryType string `yaml:"discoveryType" jsonschema:"required"`
Address string `yaml:"address" jsonschema:"required"`
IngressPort int `yaml:"ingressPort" jsonschema:"required"`
IngressProtocol string `yaml:"ingressProtocol" jsonschema:"required"`
EgressPort int `yaml:"egressPort" jsonschema:"required"`
EgressProtocol string `yaml:"egressProtocol" jsonschema:"required"`
}
Sidecar is the spec of service sidecar.