Documentation
¶
Index ¶
- Constants
- func CreateOrUpdateWithStatus[T client.Object](ctx context.Context, cli client.Client, obj T, fun func(obj T) error) error
- func EncodeToX509Pair(in tls.Certificate) ([]byte, []byte)
- func RenderManifets(uid string, image string, edgehubaddress string, certs v1beta1.Certs) []client.Object
- func SignCertificate(caPEMBlock, certPEMBlock, keyPEMBlock []byte, options CertOptions) ([]byte, []byte, error)
- type CertOptions
- type CreateClusterRequest
- type CreateClusterResponse
- type EdgeClusterAPI
- func (a *EdgeClusterAPI) GetEdgeCluster(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) GetEdgeHub(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) InstallAgentTemplate(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) ListEdgeClusters(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) ListEdgeHubs(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) PreCreateEdgeCluster(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) Proxy(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) RegisterRoute(r *route.Group)
- func (a *EdgeClusterAPI) RemoveEdgeCluster(req *restful.Request, resp *restful.Response)
- func (a *EdgeClusterAPI) UpdateEdgeCluster(req *restful.Request, resp *restful.Response)
- type EdgeClusterK8sStore
- func (s EdgeClusterK8sStore) Delete(ctx context.Context, name string) (*v1beta1.EdgeCluster, error)
- func (s EdgeClusterK8sStore) Get(ctx context.Context, name string) (*v1beta1.EdgeCluster, error)
- func (s EdgeClusterK8sStore) List(ctx context.Context, options ListOptions) (int, []v1beta1.EdgeCluster, error)
- func (s EdgeClusterK8sStore) Update(ctx context.Context, name string, fun func(cluster *v1beta1.EdgeCluster) error) (*v1beta1.EdgeCluster, error)
- type EdgeClusterStore
- type EdgeHubItem
- type EdgeHubK8sStore
- func (s EdgeHubK8sStore) Delete(ctx context.Context, name string) (*v1beta1.EdgeHub, error)
- func (s EdgeHubK8sStore) Get(ctx context.Context, name string) (*v1beta1.EdgeHub, error)
- func (s EdgeHubK8sStore) List(ctx context.Context, options ListOptions) (int, []v1beta1.EdgeHub, error)
- func (s EdgeHubK8sStore) Update(ctx context.Context, name string, fun func(cluster *v1beta1.EdgeHub) error) (*v1beta1.EdgeHub, error)
- type EdgeHubStore
- type EdgeManager
- func (m *EdgeManager) ListPage(ctx context.Context, page, size int, search string, ...) (response.TypedPage[v1beta1.EdgeCluster], error)
- func (m *EdgeManager) OnTunnelConnectedStatusChange(ctx context.Context, connected bool, isrefresh bool, fromname string, ...) error
- func (m *EdgeManager) PreCreate(ctx context.Context, example *v1beta1.EdgeCluster) (*v1beta1.EdgeCluster, error)
- func (m *EdgeManager) RenderInstallManifests(ctx context.Context, uid, token string) ([]byte, error)
- func (s *EdgeManager) SyncTunnelStatusFrom(ctx context.Context, server *tunnel.TunnelServer) error
- type InstallerTemplateValues
- type ListOptions
- type PrecreateOptions
Constants ¶
View Source
const (
AnnotationKeyEdgeHubAddress = "edge.kubegems.io/edge-hub-address"
AnnotationKeyEdgeHubCert = "edge.kubegems.io/edge-hub-key"
AnnotationKeyEdgeHubCA = "edge.kubegems.io/edge-hub-ca"
AnnotationKeyEdgeHubKey = "edge.kubegems.io/edge-hub-cert"
LabelKeIsyEdgeHub = "edge.kubegems.io/is-edge-hub"
AnnotationKeyEdgeAgentAddress = "edge.kubegems.io/edge-agent-address"
AnnotationKeyEdgeAgentKeepaliveInterval = "edge.kubegems.io/edge-agent-keepalive-interval"
AnnotationKeyEdgeAgentRegisterAddress = "edge.kubegems.io/edge-agent-register-address"
AnnotationKeyKubernetesVersion = "edge.kubegems.io/kubernetes-version"
AnnotationKeyAPIserverAddress = "edge.kubegems.io/apiserver-address"
AnnotationKeyNodesCount = "edge.kubegems.io/nodes-count"
AnnotationKeyDeviceID = "edge.kubegems.io/device-id"
// temporary connection do not write to database
AnnotationIsTemporaryConnect = "edge.kubegems.io/temporary-connect"
)
View Source
const DefaultAgentAddress = "http://127.0.0.1:8080"
View Source
const DefaultEdgeAgentImage = "docker.io/kubegems/kubegems-edge-agent:latest"
View Source
const (
DurationYear = time.Hour * 24 * 365
)
Variables ¶
This section is empty.
Functions ¶
func CreateOrUpdateWithStatus ¶
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 EncodeToX509Pair ¶
func EncodeToX509Pair(in tls.Certificate) ([]byte, []byte)
func RenderManifets ¶
func RenderManifets(uid string, image string, edgehubaddress string, certs v1beta1.Certs) []client.Object
nolint: gomnd,funlen
func SignCertificate ¶
func SignCertificate(caPEMBlock, certPEMBlock, keyPEMBlock []byte, options CertOptions) ([]byte, []byte, error)
nolint: gomnd,funlen
Types ¶
type CertOptions ¶
type CertOptions struct {
CommonName string
Hosts []string
ExpireAt *time.Time
}
type CreateClusterRequest ¶
type CreateClusterRequest struct {
PrecreateOptions
}
type CreateClusterResponse ¶
type CreateClusterResponse struct {
UID string `json:"uid,omitempty"`
ManifestAddress string `json:"manifestAddress,omitempty"`
}
type EdgeClusterAPI ¶
type EdgeClusterAPI struct {
Cluster *EdgeManager
Tunnel *tunnel.TunnelServer
}
func (*EdgeClusterAPI) GetEdgeCluster ¶
func (a *EdgeClusterAPI) GetEdgeCluster(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) GetEdgeHub ¶
func (a *EdgeClusterAPI) GetEdgeHub(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) InstallAgentTemplate ¶
func (a *EdgeClusterAPI) InstallAgentTemplate(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) ListEdgeClusters ¶
func (a *EdgeClusterAPI) ListEdgeClusters(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) ListEdgeHubs ¶
func (a *EdgeClusterAPI) ListEdgeHubs(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) PreCreateEdgeCluster ¶
func (a *EdgeClusterAPI) PreCreateEdgeCluster(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) Proxy ¶
func (a *EdgeClusterAPI) Proxy(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) RegisterRoute ¶
func (a *EdgeClusterAPI) RegisterRoute(r *route.Group)
func (*EdgeClusterAPI) RemoveEdgeCluster ¶
func (a *EdgeClusterAPI) RemoveEdgeCluster(req *restful.Request, resp *restful.Response)
func (*EdgeClusterAPI) UpdateEdgeCluster ¶
func (a *EdgeClusterAPI) UpdateEdgeCluster(req *restful.Request, resp *restful.Response)
type EdgeClusterK8sStore ¶
type EdgeClusterK8sStore struct {
// contains filtered or unexported fields
}
func (EdgeClusterK8sStore) Delete ¶
func (s EdgeClusterK8sStore) Delete(ctx context.Context, name string) (*v1beta1.EdgeCluster, error)
func (EdgeClusterK8sStore) Get ¶
func (s EdgeClusterK8sStore) Get(ctx context.Context, name string) (*v1beta1.EdgeCluster, error)
type EdgeClusterStore ¶
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 ¶
type EdgeHubItem struct {
Name string `json:"name"`
Address string `json:"address"`
Connected bool `json:"connected"`
}
type EdgeHubK8sStore ¶
type EdgeHubK8sStore struct {
// contains filtered or unexported fields
}
func (EdgeHubK8sStore) Delete ¶
func (s EdgeHubK8sStore) Delete(ctx context.Context, name string) (*v1beta1.EdgeHub, error)
func (EdgeHubK8sStore) Get ¶
func (s EdgeHubK8sStore) Get(ctx context.Context, name string) (*v1beta1.EdgeHub, error)
type EdgeHubStore ¶
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 ¶
type EdgeManager struct {
SelfAddress string
ClusterStore EdgeClusterStore
HubStore EdgeHubStore
}
func NewClusterManager ¶
func NewClusterManager(ctx context.Context, namespace string, selfhost string) (*EdgeManager, error)
func (*EdgeManager) ListPage ¶
func (m *EdgeManager) ListPage(
ctx context.Context,
page, size int,
search string, labels, manufacture labels.Selector,
) (response.TypedPage[v1beta1.EdgeCluster], error)
func (*EdgeManager) OnTunnelConnectedStatusChange ¶
func (m *EdgeManager) OnTunnelConnectedStatusChange(ctx context.Context,
connected bool, isrefresh bool,
fromname string, fromannotations map[string]string,
name string, anno map[string]string,
) error
func (*EdgeManager) PreCreate ¶
func (m *EdgeManager) PreCreate(ctx context.Context, example *v1beta1.EdgeCluster) (*v1beta1.EdgeCluster, error)
return a register address
func (*EdgeManager) RenderInstallManifests ¶
func (m *EdgeManager) RenderInstallManifests(ctx context.Context, uid, token string) ([]byte, error)
func (*EdgeManager) SyncTunnelStatusFrom ¶
func (s *EdgeManager) SyncTunnelStatusFrom(ctx context.Context, server *tunnel.TunnelServer) error
type InstallerTemplateValues ¶
type InstallerTemplateValues struct {
EdgeAddress string
AgentImage string
TLSCert []byte
TLSKey []byte
TLSCA []byte
}
type ListOptions ¶
type ListOptions struct {
Page int
Size int
Search string // name regexp
Selector labels.Selector
Manufacture labels.Selector
}
type PrecreateOptions ¶
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
}
Click to show internal directories.
Click to hide internal directories.