server

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEdgeAgentImage = "docker.io/kubegems/kubegems-edge-agent:latest"

Variables

This section is empty.

Functions

func CreateOrUpdateWithStatus added in v1.23.8

func CreateOrUpdateWithStatus[T client.Object](ctx context.Context, cli client.Client, obj T, fun func(obj T) error) error

nolint: nestif,funlen,gocognit,forcetypeassert

func RenderManifets added in v1.23.8

func RenderManifets(uid string, image string, edgehubaddress string, certs v1beta1.Certs) []client.Object

nolint: gomnd,funlen

func Run

func Run(ctx context.Context, options *Options) error

Types

type CreateClusterRequest added in v1.23.8

type CreateClusterRequest struct {
	PrecreateOptions
}

type CreateClusterResponse added in v1.23.8

type CreateClusterResponse struct {
	UID             string `json:"uid,omitempty"`
	ManifestAddress string `json:"manifestAddress,omitempty"`
}

type EdgeClusterAPI added in v1.23.8

type EdgeClusterAPI struct {
	Cluster *EdgeManager
	Tunnel  *tunnel.TunnelServer
}

func (*EdgeClusterAPI) GetEdgeCluster added in v1.23.8

func (a *EdgeClusterAPI) GetEdgeCluster(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) GetEdgeHub added in v1.23.8

func (a *EdgeClusterAPI) GetEdgeHub(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) InstallAgentTemplate added in v1.23.8

func (a *EdgeClusterAPI) InstallAgentTemplate(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) ListEdgeClusters added in v1.23.8

func (a *EdgeClusterAPI) ListEdgeClusters(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) ListEdgeHubs added in v1.23.8

func (a *EdgeClusterAPI) ListEdgeHubs(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) PreCreateEdgeCluster added in v1.23.8

func (a *EdgeClusterAPI) PreCreateEdgeCluster(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) Proxy added in v1.23.8

func (a *EdgeClusterAPI) Proxy(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) RegisterRoute added in v1.23.8

func (a *EdgeClusterAPI) RegisterRoute(r *route.Group)

func (*EdgeClusterAPI) RemoveEdgeCluster added in v1.23.8

func (a *EdgeClusterAPI) RemoveEdgeCluster(req *restful.Request, resp *restful.Response)

func (*EdgeClusterAPI) UpdateEdgeCluster added in v1.23.8

func (a *EdgeClusterAPI) UpdateEdgeCluster(req *restful.Request, resp *restful.Response)

type EdgeClusterK8sStore added in v1.23.8

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

func (EdgeClusterK8sStore) Delete added in v1.23.8

func (EdgeClusterK8sStore) Get added in v1.23.8

func (EdgeClusterK8sStore) List added in v1.23.8

func (EdgeClusterK8sStore) Update added in v1.23.8

func (s EdgeClusterK8sStore) Update(ctx context.Context, name string, fun func(cluster *v1beta1.EdgeCluster) error) (*v1beta1.EdgeCluster, error)

type EdgeClusterStore added in v1.23.8

type EdgeClusterStore interface {
	List(ctx context.Context, options ListOptions) (int, []v1beta1.EdgeCluster, error)
	Get(ctx context.Context, name string) (*v1beta1.EdgeCluster, error)
	Update(ctx context.Context, name string, fun func(cluster *v1beta1.EdgeCluster) error) (*v1beta1.EdgeCluster, error)
	Delete(ctx context.Context, name string) (*v1beta1.EdgeCluster, error)
}

type EdgeHubItem added in v1.23.8

type EdgeHubItem struct {
	Name      string `json:"name"`
	Address   string `json:"address"`
	Connected bool   `json:"connected"`
}

type EdgeHubK8sStore added in v1.23.8

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

func (EdgeHubK8sStore) Delete added in v1.23.8

func (s EdgeHubK8sStore) Delete(ctx context.Context, name string) (*v1beta1.EdgeHub, error)

func (EdgeHubK8sStore) Get added in v1.23.8

func (s EdgeHubK8sStore) Get(ctx context.Context, name string) (*v1beta1.EdgeHub, error)

func (EdgeHubK8sStore) List added in v1.23.8

func (s EdgeHubK8sStore) List(ctx context.Context, options ListOptions) (int, []v1beta1.EdgeHub, error)

func (EdgeHubK8sStore) Update added in v1.23.8

func (s EdgeHubK8sStore) Update(ctx context.Context, name string, fun func(cluster *v1beta1.EdgeHub) error) (*v1beta1.EdgeHub, error)

type EdgeHubStore added in v1.23.8

type EdgeHubStore interface {
	List(ctx context.Context, options ListOptions) (int, []v1beta1.EdgeHub, error)
	Get(ctx context.Context, name string) (*v1beta1.EdgeHub, error)
	Update(ctx context.Context, name string, fun func(cluster *v1beta1.EdgeHub) error) (*v1beta1.EdgeHub, error)
	Delete(ctx context.Context, name string) (*v1beta1.EdgeHub, error)
}

type EdgeManager added in v1.23.8

type EdgeManager struct {
	SelfAddress  string
	ClusterStore EdgeClusterStore
	HubStore     EdgeHubStore
}

func NewClusterManager added in v1.23.8

func NewClusterManager(ctx context.Context, namespace string, selfhost string) (*EdgeManager, error)

func (*EdgeManager) ListPage added in v1.23.8

func (m *EdgeManager) ListPage(
	ctx context.Context,
	opts request.ListOptions,
	labels, manufacture labels.Selector,
) (response.Page[v1beta1.EdgeCluster], error)

func (*EdgeManager) OnTunnelConnectedStatusChange added in v1.23.8

func (m *EdgeManager) OnTunnelConnectedStatusChange(ctx context.Context,
	connected bool, isrefresh bool,
	fromname string, fromannotations map[string]string,
	name string, anno map[string]string,
) error

OnTunnelConnectedStatusChange is called when tunnel connected status changed nolint: funlen

func (*EdgeManager) PreCreate added in v1.23.8

func (m *EdgeManager) PreCreate(ctx context.Context, example *v1beta1.EdgeCluster) (*v1beta1.EdgeCluster, error)

return a register address

func (*EdgeManager) RenderInstallManifests added in v1.23.8

func (m *EdgeManager) RenderInstallManifests(ctx context.Context, uid, token string) ([]byte, error)

func (*EdgeManager) SyncTunnelStatusFrom added in v1.23.8

func (s *EdgeManager) SyncTunnelStatusFrom(ctx context.Context, server *tunnel.TunnelServer) error

type EdgeServer

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

func NewEdgeServer

func NewEdgeServer(ctx context.Context, options *Options) (*EdgeServer, error)

func (*EdgeServer) HTTPAPI

func (s *EdgeServer) HTTPAPI() http.Handler

func (*EdgeServer) Run

func (s *EdgeServer) Run(ctx context.Context) error

type InstallerTemplateValues added in v1.23.8

type InstallerTemplateValues struct {
	EdgeAddress string
	AgentImage  string
	TLSCert     []byte
	TLSKey      []byte
	TLSCA       []byte
}

type ListOptions added in v1.23.8

type ListOptions struct {
	Page        int
	Size        int
	Search      string // name regexp
	Selector    labels.Selector
	Manufacture labels.Selector
}

type Options added in v1.23.8

type Options struct {
	Listen     string           `json:"listen,omitempty"`
	Host       string           `json:"host,omitempty"`
	ListenGrpc string           `json:"listenGrpc,omitempty"`
	ServerID   string           `json:"serverID,omitempty"`
	TLS        *system.TLS      `json:"tls,omitempty"`
	Database   database.Options `json:"database,omitempty"`
}

func NewDefaultOptions added in v1.23.8

func NewDefaultOptions() *Options

type PrecreateOptions added in v1.23.8

type PrecreateOptions struct {
	UID          string            `json:"uid,omitempty"`
	HubName      string            `json:"hubName,omitempty"`      // hub name edge cluster registered to
	Annotations  map[string]string `json:"annotations,omitempty"`  // edge annotations
	Labels       map[string]string `json:"labels,omitempty"`       // edge labels
	AgentImage   string            `json:"agentImage,omitempty"`   // agent image edge cluster used to register
	CreateCert   bool              `json:"createCert,omitempty"`   // pre generated edge certificate
	CertExpireAt *time.Time        `json:"certExpireAt,omitempty"` // the expiration of the certificate
}

Jump to

Keyboard shortcuts

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