app

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter uses for converting bkbcs service discovery information to inner register data structures

func NewAdapter

func NewAdapter(option *ServerOptions, standardModules []string) *Adapter

NewAdapter create service data convertion

func (*Adapter) GetGrpcService

func (adp *Adapter) GetGrpcService(module string, svc *registry.Service) (*register.Service, error)

GetGrpcService interface for go-micro grpc module data convertion @param: module, all kind module name, such as logmanager, usermanager @param: svc, go-micro service definition, came form etcd registry

func (*Adapter) GetHTTPService

func (adp *Adapter) GetHTTPService(module string, svc *registry.Service) (*register.Service, error)

GetHTTPService interface for go-micro http module data convertion only support standard new module api registration

func (*Adapter) GetService

func (adp *Adapter) GetService(module string, svcs []*types.ServerInfo) (*register.Service, error)

GetService interface for all service data convertion

type DiscoveryServer

type DiscoveryServer struct {
	// contains filtered or unexported fields
}

DiscoveryServer holds all resources for services discovery

func New

func New() *DiscoveryServer

New create

func (*DiscoveryServer) Init

func (s *DiscoveryServer) Init(option *ServerOptions) error

Init init all running resources, including 1. configuration validation 2. connecting gateway admin api 3. init backend service information adapter

func (*DiscoveryServer) Run

func (s *DiscoveryServer) Run() error

Run running all necessary convertion logic, block

func (*DiscoveryServer) Stop

func (s *DiscoveryServer) Stop()

Stop all backgroup routines

type EtcdRegistry

type EtcdRegistry struct {
	Feature     bool   `json:"etcd_feature" value:"false" usage:"switch that turn on etcd registry feature"`
	GrpcModules string `` /* 139-byte string literal not displayed */
	HTTPModules string `` /* 139-byte string literal not displayed */
	Address     string `json:"etcd_address" value:"127.0.0.1:2379" usage:"etcd registry feature, multiple ip addresses splited by comma"`
	CA          string `json:"etcd_ca" value:"" usage:"etcd registry CA"`
	Cert        string `json:"etcd_cert" value:"" usage:"etcd registry tls cert file"`
	Key         string `json:"etcd_key" value:"" usage:"etcd registry tls key file"`
}

EtcdRegistry config item for etcd discovery

type Handler

type Handler func(module string, svcs []*types.ServerInfo) (*register.Service, error)

Handler for module automatic reflection @param: module, bkbcs module name, like usermanager, logmanager @param: svcs, bkbcs service instance definition

type MicroHandler

type MicroHandler func(module string, svc *registry.Service) (*register.Service, error)

MicroHandler compatible for old module that registe in micro registry

type ModuleEvent

type ModuleEvent struct {
	// Module name
	Module string
	// GoMicro flag for go-micro registry
	GoMicro bool
	// flag for delete
	Deletion bool
	// Svc api-gateway service definition
	Svc *register.Service
}

ModuleEvent event

type ServerOptions

type ServerOptions struct {
	conf.FileConfig
	conf.ServiceConfig
	conf.MetricConfig
	conf.ZkConfig
	conf.CertConfig
	conf.LogConfig
	conf.ProcessConfig
	IPv6Mode bool `` /* 196-byte string literal not displayed */
	//gateway admin api info
	AdminAPI string `` /* 266-byte string literal not displayed */
	//new standard modules
	/*
		types.BCS_MODULE_STORAGE,
		types.BCS_MODULE_MESOSDRIVER,
		types.BCS_MODULE_KUBERNETEDRIVER,
		types.BCS_MODULE_NETWORKDETECTION,
		types.BCS_MODULE_USERMANAGER,
		types.BCS_MODULE_KUBEAGENT,
	*/
	Modules   string `` /* 170-byte string literal not displayed */
	AuthToken string `json:"auth_token" usage:"token for request bcs-user-manager" mapstructure:"auth_token" `

	Etcd EtcdRegistry `json:"etcdRegistry"`
}

ServerOptions command flags for gateway-discovery

func NewServerOptions

func NewServerOptions() *ServerOptions

NewServerOptions create default ServerOptions

func (*ServerOptions) GetClientTLS

func (opt *ServerOptions) GetClientTLS() (*tls.Config, error)

GetClientTLS construct client tls configuration

func (*ServerOptions) GetEtcdRegistryTLS

func (opt *ServerOptions) GetEtcdRegistryTLS() (*tls.Config, error)

GetEtcdRegistryTLS get specified etcd registry tls config

func (*ServerOptions) Valid

func (opt *ServerOptions) Valid() error

Valid check if necessary paramter is setting correctly

Jump to

Keyboard shortcuts

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