endpoint

package
v0.0.0-...-c46a175 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSchemeInValid invalid scheme
	ErrSchemeInValid = errors.New("scheme invalid, should be http/https")
	// ErrHealthConfigNotInited show HealthConfig not inited
	ErrHealthConfigNotInited = errors.New("healthConfig not inited")
)
View Source
var (
	// ErrEndpointsClientNotInited show endpointsClient not inited
	ErrEndpointsClientNotInited = errors.New("endpointsClient not inited")
)
View Source
var (
	// ErrK8sConfigNotInited show K8sConfig not inited
	ErrK8sConfigNotInited = errors.New("k8sConfig not inited")
)

Functions

This section is empty.

Types

type ClusterEndpointsIP

type ClusterEndpointsIP interface {
	GetClusterEndpoints() ([]utils.EndPoint, error)
	SyncClusterEndpoints(ctx context.Context)
	Stop()
}

ClusterEndpointsIP is a interface for sync kubernetes master endpointIPs

func NewEndpointsClient

func NewEndpointsClient(opts ...EndpointsClientOption) (ClusterEndpointsIP, error)

NewEndpointsClient init endpoints client

type EndpointsClientOption

type EndpointsClientOption func(options *EndpointsClientOptions)

EndpointsClientOption func for set EndpointsClientOptions

func WithDebug

func WithDebug(debug bool) EndpointsClientOption

WithDebug set debug for unit test

func WithHealthConfig

func WithHealthConfig(healthConfig EndpointsHealthOptions) EndpointsClientOption

WithHealthConfig set health check options

func WithInterval

func WithInterval(interval time.Duration) EndpointsClientOption

WithInterval set interval

func WithK8sConfig

func WithK8sConfig(ks8Config K8sConfig) EndpointsClientOption

WithK8sConfig set k8sConfig

type EndpointsClientOptions

type EndpointsClientOptions struct {
	K8sConfig    K8sConfig
	HealthConfig EndpointsHealthOptions
	Interval     time.Duration
	Debug        bool
}

EndpointsClientOptions conf options

type EndpointsHealthOptions

type EndpointsHealthOptions struct {
	Scheme string
	Path   string
}

EndpointsHealthOptions show health check scheme&path

type HealthCheck

type HealthCheck interface {
	IsHTTPAPIHealth(addr string, port uint32) bool
}

HealthCheck is interface for check addr:port health

func NewHealthConfig

func NewHealthConfig(scheme string, path string) (HealthCheck, error)

NewHealthConfig init HealthConfig

type HealthConfig

type HealthConfig struct {
	Shem string
	Path string
}

HealthConfig conf immutable schem/path

func (*HealthConfig) IsHTTPAPIHealth

func (hc *HealthConfig) IsHTTPAPIHealth(addr string, port uint32) bool

IsHTTPAPIHealth for check schem://addr:port/Path health

type K8sConfig

type K8sConfig struct {
	Mater      string `json:"master"`
	KubeConfig string `json:"kubeConfig"`
}

K8sConfig ...

func (*K8sConfig) GetKubernetesClient

func (c *K8sConfig) GetKubernetesClient() (kubernetes.Interface, error)

GetKubernetesClient init kubernetes clientSet by k8sConfig

Jump to

Keyboard shortcuts

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