reporter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package reporter collects edge resource status and reports it to controller manager.

Index

Constants

View Source
const (
	ResourceTypeNode = iota + 1
	ResourceTypePod
	ResourceTypeDeployment
	ResourceTypeDaemonset
	ResourceTypeService
	ResourceTypeStatefulset
	ResourceTypeClusterStatus
	ResourceTypeEvent

	ClusterLabel     = "ote-cluster"
	EdgeVersionLabel = "edge-version"
	EdgeNodeName     = "node-name"
)

Variables

This section is empty.

Functions

func NewReporterInitializers

func NewReporterInitializers() map[string]InitFunc

NewReporterInitializers returns a public map of named reporter groups paired to their InitFunc.

Types

type ClusterStatusReporter

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

ClusterStatusReporter is responsible for synchronizing information about the status of a cluster.

func (*ClusterStatusReporter) Run

func (c *ClusterStatusReporter) Run(stopCh <-chan struct{})

Run starts a cron job that synchronizes information of the cluster.

type DaemonsetReporter

type DaemonsetReporter struct {
	SyncChan chan clustermessage.ClusterMessage
	// contains filtered or unexported fields
}

type DaemonsetResourceStatus

type DaemonsetResourceStatus struct {
	// UpdateMap stores created/updated resource obj.
	UpdateMap map[string]*appsv1.DaemonSet `json:"updateMap"`
	// DelMap stores deleted resource obj.
	DelMap map[string]*appsv1.DaemonSet `json:"delMap"`
	// FullList stores full resource obj.
	FullList []*appsv1.DaemonSet `json:"fullList"`
}

DaemonsetResourceStatus defines daemonset resource status.

type DeploymentReporter

type DeploymentReporter struct {
	SyncChan chan clustermessage.ClusterMessage
	// contains filtered or unexported fields
}

type DeploymentResourceStatus

type DeploymentResourceStatus struct {
	// UpdateMap stores created/updated resource obj.
	UpdateMap map[string]*appsv1.Deployment `json:"updateMap"`
	// DelMap stores deleted resource obj.
	DelMap map[string]*appsv1.Deployment `json:"delMap"`
	// FullList stores full resource obj.
	FullList []*appsv1.Deployment `json:"fullList"`
}

DeploymentResourceStatus defines deployment resource status.

type EventReporter

type EventReporter struct {
	SyncChan chan clustermessage.ClusterMessage
	// contains filtered or unexported fields
}

type EventResourceStatus

type EventResourceStatus struct {
	// UpdateMap stores created/updated resource obj.
	UpdateMap map[string]*corev1.Event `json:"updateMap"`
	// DelMap stores deleted resource obj.
	DelMap map[string]*corev1.Event `json:"delMap"`
	// FullList stores full resource obj.
	FullList []*corev1.Event `json:"fullList"`
}

EventResourceStatus defines event resource status.

type InitFunc

type InitFunc func(ctx *ReporterContext) error

InitFunc is used to launch a particular reporter.

type NodeReporter

type NodeReporter struct {
	SyncChan chan clustermessage.ClusterMessage
	// contains filtered or unexported fields
}

NodeReporter is responsible for synchronizing node status of edge cluster.

type NodeResourceStatus

type NodeResourceStatus struct {
	// UpdateMap stores created/updated resource obj.
	UpdateMap map[string]*corev1.Node `json:"updateMap"`
	// DelMap stores deleted resource obj.
	DelMap map[string]*corev1.Node `json:"delMap"`
	// FullList stores full resource obj.
	FullList []*corev1.Node `json:"fullList"`
}

NodeResourceStatus defines node resource status.

type PodReporter

type PodReporter struct {
	SyncChan chan clustermessage.ClusterMessage
	// contains filtered or unexported fields
}

PodReporter is responsible for synchronizing pod status of edge cluster.

func (*PodReporter) Run

func (pr *PodReporter) Run(stopCh <-chan struct{}) error

Run begins watching and syncing.

func (*PodReporter) SetDelMap

func (pr *PodReporter) SetDelMap(name string, pod *corev1.Pod)

SetDelMap adds pod objects to DelMap.

func (*PodReporter) SetUpdateMap

func (pr *PodReporter) SetUpdateMap(name string, pod *corev1.Pod)

SetUpdateMap adds pod objects to UpdateMap.

type PodResourceStatus

type PodResourceStatus struct {
	// UpdateMap stores created/updated resource obj.
	UpdateMap map[string]*corev1.Pod `json:"updateMap"`
	// DelMap stores deleted resource obj.
	DelMap map[string]*corev1.Pod `json:"delMap"`
	// FullList stores full resource obj.
	FullList []*corev1.Pod `json:"fullList"`
}

PodResourceStatus defines pod resource status.

type Report

type Report struct {
	ResourceType int `json:"resourceType"`
	// Body defines different resource status.
	Body []byte `json:"body"`
}

Report defines edge report content.

type ReporterContext

type ReporterContext struct {
	// InformerFactory gives access to informers for the reporter.
	InformerFactory informers.SharedInformerFactory
	// ClusterName gets the cluster name.
	ClusterName func() string
	// SyncChan is used for synchronizing status of the edge cluster.
	SyncChan chan clustermessage.ClusterMessage
	// StopChan is the stop channel.
	StopChan <-chan struct{}
	// KubeClient is the kubernetes client interface for the reporter to use.
	KubeClient kubernetes.Interface
}

ReporterContext defines the context object for reporter.

func (*ReporterContext) IsValid

func (ctx *ReporterContext) IsValid() bool

IsValid returns the ReporterContext validation result.

type Reports

type Reports []Report

Reports is a collection of resource report.

func (Reports) ToClusterMessage

func (r Reports) ToClusterMessage(clusterName string) (*clustermessage.ClusterMessage, error)

ToClusterMessage packs the Report infomation into clustermessage.

type ServiceReporter

type ServiceReporter struct {
	SyncChan chan clustermessage.ClusterMessage
	// contains filtered or unexported fields
}

type ServiceResourceStatus

type ServiceResourceStatus struct {
	// UpdateMap stores created/updated resource obj.
	UpdateMap map[string]*corev1.Service `json:"updateMap"`
	// DelMap stores deleted resource obj.
	DelMap map[string]*corev1.Service `json:"delMap"`
	// FullList stores full resource obj.
	FullList []*corev1.Service `json:"fullList"`
}

ServiceResourceStatus defines service resource status.

Jump to

Keyboard shortcuts

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