edgepipeline_register

package
v1.3.0-rc.0...-d217119 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// center pipeline could receive edge event after edge side pipeline registered
	EdgeHookApiPath = "/api/pipeline-edge/actions/hook"
)

Functions

This section is empty.

Types

type Config

type Config struct {
	IsEdge                       bool          `env:"DICE_IS_EDGE" default:"false"`
	ErdaNamespace                string        `env:"DICE_NAMESPACE"`
	ClusterName                  string        `env:"DICE_CLUSTER_NAME"`
	AllowedSources               []string      `file:"allowed_sources" env:"EDGE_ALLOWED_SOURCES"` // env support comma-seperated string
	PipelineAddr                 string        `env:"PIPELINE_ADDR"`
	PipelineHost                 string        `env:"PIPELINE_HOST"`
	ClusterManagerEndpoint       string        `file:"cluster_manager_endpoint" desc:"cluster manager endpoint"`
	ClusterAccessKey             string        `file:"cluster_access_key" desc:"cluster access key, if specified will doesn't start watcher"`
	RetryConnectDialerInterval   time.Duration `file:"retry_cluster_hook_interval" default:"1s"`
	EtcdPrefixOfClusterAccessKey string        `file:"cluster_access_key_etcd_prefix" env:"EDGE_PIPELINE_CLUSTER_ACCESS_KEY_ETCD_PREFIX"`
	UpdateClientInterval         time.Duration `file:"update_client_interval" env:"UPDATE_CLIENT_INTERVAL" default:"60s"`
}

type EventHandler

type EventHandler func(ctx context.Context, eventDetail apistructs.ClusterManagerClientDetail)

type Interface

type Interface interface {
	ClusterAccessKey() string
	GetAccessToken(req apistructs.OAuth2TokenGetRequest) (*apistructs.OAuth2Token, error)
	GetOAuth2Token(req apistructs.OAuth2TokenGetRequest) (*apistructs.OAuth2Token, error)
	GetEdgePipelineEnvs() apistructs.ClusterManagerClientDetail
	CheckAccessToken(token string) error
	CheckAccessTokenFromHttpRequest(req *http.Request) error

	// CheckAccessTokenFromCtx is used for pb provider, get token from content and check access
	CheckAccessTokenFromCtx(ctx context.Context) error
	IsEdge() bool
	IsCenter() bool

	CanProxyToEdge(source apistructs.PipelineSource, clusterName string) bool
	GetEdgeBundleByClusterName(clusterName string) (*bundle.Bundle, error)
	ClusterIsEdge(clusterName string) (bool, error)

	// CreateMessageEvent edge-side pipeline send events by event-dispatcher
	CreateMessageEvent(event *apistructs.EventCreateRequest) error

	// OnEdge register hook that will be invoked if you are running on edge.
	// Could register multi hooks as you need.
	// All hooks executed asynchronously.
	OnEdge(func(context.Context))

	// OnCenter register hook that will be invoked if you are running on center.
	// Could register multi hooks as you need.
	// All hooks executed asynchronously.
	OnCenter(func(context.Context))

	// RegisterEventHandler register edge event handler.
	// Now only support update-operation event.
	// All handlers executed asynchronously.
	RegisterEventHandler(handler EventHandler)

	// ListAllClients list all edge pipelines that are registered in center.
	ListAllClients() []apistructs.ClusterManagerClientDetail
}

type MockEdgeRegister

type MockEdgeRegister struct{}

func (*MockEdgeRegister) CanProxyToEdge

func (m *MockEdgeRegister) CanProxyToEdge(source apistructs.PipelineSource, clusterName string) bool

func (*MockEdgeRegister) CheckAccessToken

func (m *MockEdgeRegister) CheckAccessToken(token string) error

func (*MockEdgeRegister) CheckAccessTokenFromCtx

func (m *MockEdgeRegister) CheckAccessTokenFromCtx(ctx context.Context) error

func (*MockEdgeRegister) CheckAccessTokenFromHttpRequest

func (m *MockEdgeRegister) CheckAccessTokenFromHttpRequest(req *http.Request) error

func (*MockEdgeRegister) ClusterAccessKey

func (m *MockEdgeRegister) ClusterAccessKey() string

func (*MockEdgeRegister) ClusterIsEdge

func (m *MockEdgeRegister) ClusterIsEdge(clusterName string) (bool, error)

func (*MockEdgeRegister) CreateMessageEvent

func (m *MockEdgeRegister) CreateMessageEvent(event *apistructs.EventCreateRequest) error

func (*MockEdgeRegister) GetAccessToken

func (*MockEdgeRegister) GetEdgeBundleByClusterName

func (m *MockEdgeRegister) GetEdgeBundleByClusterName(clusterName string) (*bundle.Bundle, error)

func (*MockEdgeRegister) GetEdgePipelineEnvs

func (m *MockEdgeRegister) GetEdgePipelineEnvs() apistructs.ClusterManagerClientDetail

func (*MockEdgeRegister) GetOAuth2Token

func (*MockEdgeRegister) IsCenter

func (m *MockEdgeRegister) IsCenter() bool

func (*MockEdgeRegister) IsEdge

func (m *MockEdgeRegister) IsEdge() bool

func (*MockEdgeRegister) ListAllClients

func (*MockEdgeRegister) OnCenter

func (m *MockEdgeRegister) OnCenter(f func(context.Context))

func (*MockEdgeRegister) OnEdge

func (m *MockEdgeRegister) OnEdge(f func(context.Context))

func (*MockEdgeRegister) RegisterEventHandler

func (m *MockEdgeRegister) RegisterEventHandler(handler EventHandler)

type MockKV

type MockKV struct{}

func (MockKV) Compact

func (o MockKV) Compact(ctx context.Context, rev int64, opts ...clientv3.CompactOption) (*clientv3.CompactResponse, error)

func (MockKV) Delete

func (o MockKV) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)

func (MockKV) Do

func (MockKV) Get

func (o MockKV) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)

func (MockKV) Put

func (o MockKV) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

func (MockKV) Txn

func (o MockKV) Txn(ctx context.Context) clientv3.Txn

Jump to

Keyboard shortcuts

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