manager

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeRoleKey   = "node-role.kubernetes.io/edge"
	NodeRoleValue = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachePod

type CachePod struct {
	metav1.ObjectMeta
	Spec v1.PodSpec
}

CachePod is the struct save pod data for check pod is really changed

type CommonResourceEventHandler

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

CommonResourceEventHandler can be used by configmapManager and podManager

func NewCommonResourceEventHandler

func NewCommonResourceEventHandler(events chan watch.Event) *CommonResourceEventHandler

NewCommonResourceEventHandler create CommonResourceEventHandler used by configmapManager and podManager

func (*CommonResourceEventHandler) OnAdd

func (c *CommonResourceEventHandler) OnAdd(obj interface{})

OnAdd handle Add event

func (*CommonResourceEventHandler) OnDelete

func (c *CommonResourceEventHandler) OnDelete(obj interface{})

OnDelete handle Delete event

func (*CommonResourceEventHandler) OnUpdate

func (c *CommonResourceEventHandler) OnUpdate(oldObj, newObj interface{})

OnUpdate handle Update event

type ConfigMapManager

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

ConfigMapManager manage all events of configmap by SharedInformer

func NewConfigMapManager

func NewConfigMapManager(kubeClient *kubernetes.Clientset, namespace string) (*ConfigMapManager, error)

NewConfigMapManager create ConfigMapManager by kube clientset and namespace

func (*ConfigMapManager) Events

func (cmm *ConfigMapManager) Events() chan watch.Event

Events return the channel save events from watch configmap change

type EndpointsManager added in v1.0.0

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

EndpointsManager manage all events of endpoints by SharedInformer

func NewEndpointsManager added in v1.0.0

func NewEndpointsManager(kubeClient *kubernetes.Clientset, namespace string) (*EndpointsManager, error)

NewEndpointsManager create EndpointsManager by kube clientset and namespace

func (*EndpointsManager) Events added in v1.0.0

func (sm *EndpointsManager) Events() chan watch.Event

Events return the channel save events from watch endpoints change

type LocationCache

type LocationCache struct {
	// EdgeNodes is a map, key is nodeName, value is Status
	EdgeNodes sync.Map
	// contains filtered or unexported fields
}

LocationCache cache the map of node, pod, configmap, secret

func (*LocationCache) AddOrUpdateEndpoints added in v1.0.0

func (lc *LocationCache) AddOrUpdateEndpoints(endpoints v1.Endpoints)

AddOrUpdateEndpoints in cache

func (*LocationCache) AddOrUpdatePod

func (lc *LocationCache) AddOrUpdatePod(pod v1.Pod)

AddOrUpdatePod add pod to node, pod to configmap, configmap to pod, pod to secret, secret to pod relation

func (*LocationCache) AddOrUpdateService added in v1.0.0

func (lc *LocationCache) AddOrUpdateService(service v1.Service)

AddOrUpdateService in cache

func (*LocationCache) AddOrUpdateServicePods added in v1.0.0

func (lc *LocationCache) AddOrUpdateServicePods(name string, value []v1.Pod)

AddOrUpdateServicePods in cache

func (*LocationCache) ConfigMapNodes

func (lc *LocationCache) ConfigMapNodes(namespace, name string) (nodes []string)

ConfigMapNodes return all nodes which deploy pod on with configmap

func (*LocationCache) DeleteConfigMap

func (lc *LocationCache) DeleteConfigMap(namespace, name string)

DeleteConfigMap from cache

func (*LocationCache) DeleteEndpoints added in v1.0.0

func (lc *LocationCache) DeleteEndpoints(endpoints v1.Endpoints)

DeleteEndpoints in cache

func (*LocationCache) DeleteNode added in v1.0.0

func (lc *LocationCache) DeleteNode(nodeName string)

DeleteNode from cache

func (*LocationCache) DeleteSecret

func (lc *LocationCache) DeleteSecret(namespace, name string)

DeleteSecret from cache

func (*LocationCache) DeleteService added in v1.0.0

func (lc *LocationCache) DeleteService(service v1.Service)

DeleteService from cache

func (*LocationCache) DeleteServicePods added in v1.0.0

func (lc *LocationCache) DeleteServicePods(endpoints v1.Endpoints)

DeleteServicePods from cache

func (*LocationCache) GetAllEndpoints added in v1.0.0

func (lc *LocationCache) GetAllEndpoints() []v1.Endpoints

GetAllEndpoints from cache

func (*LocationCache) GetAllServices added in v1.0.0

func (lc *LocationCache) GetAllServices() []v1.Service

GetAllServices from cache

func (*LocationCache) GetNodeStatus added in v1.0.0

func (lc *LocationCache) GetNodeStatus(nodeName string) (string, bool)

func (*LocationCache) GetService added in v1.0.0

func (lc *LocationCache) GetService(name string) (v1.Service, bool)

GetService from cache

func (*LocationCache) GetServicePods added in v1.0.0

func (lc *LocationCache) GetServicePods(name string) ([]v1.Pod, bool)

GetServicePods from cache

func (*LocationCache) IsEdgeNode added in v1.0.0

func (lc *LocationCache) IsEdgeNode(nodeName string) bool

IsEdgeNode checks weather node is edge node or not

func (*LocationCache) IsEndpointsUpdated added in v1.0.0

func (lc *LocationCache) IsEndpointsUpdated(new v1.Endpoints) bool

IsEndpointsUpdated checks if endpoints is actually updated

func (*LocationCache) PodConfigMapsAndSecrets

func (lc *LocationCache) PodConfigMapsAndSecrets(pod v1.Pod) (configMaps, secrets []string)

PodConfigMapsAndSecrets return configmaps and secrets used by pod

func (*LocationCache) SecretNodes

func (lc *LocationCache) SecretNodes(namespace, name string) (nodes []string)

SecretNodes return all nodes which deploy pod on with secret

func (*LocationCache) UpdateEdgeNode added in v1.0.0

func (lc *LocationCache) UpdateEdgeNode(nodeName string, status string)

UpdateEdgeNode is to maintain edge nodes name upto-date by querying kubernetes client

type Manager

type Manager interface {
	Events() chan watch.Event
}

Manager define the interface of a Manager, configmapManager and podManager implement it

type NodesManager added in v1.0.0

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

NodesManager manage all events of nodes by SharedInformer

func NewNodesManager added in v1.0.0

func NewNodesManager(kubeClient *kubernetes.Clientset, namespace string) (*NodesManager, error)

NewNodesManager create NodesManager by kube clientset and namespace

func (*NodesManager) Events added in v1.0.0

func (nm *NodesManager) Events() chan watch.Event

Events return the channel save events from watch nodes change

type PodManager

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

PodManager is a manager watch pod change event

func NewPodManager

func NewPodManager(kubeClient *kubernetes.Clientset, namespace, nodeName string) (*PodManager, error)

NewPodManager create PodManager from config

func (*PodManager) Events

func (pm *PodManager) Events() chan watch.Event

Events return a channel, can receive all pod event

type SecretManager

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

SecretManager manage all events of secret by SharedInformer

func NewSecretManager

func NewSecretManager(kubeClient *kubernetes.Clientset, namespace string) (*SecretManager, error)

NewSecretManager create SecretManager by kube clientset and namespace

func (*SecretManager) Events

func (sm *SecretManager) Events() chan watch.Event

Events return the channel save events from watch secret change

type ServiceManager added in v1.0.0

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

ServiceManager manage all events of service by SharedInformer

func NewServiceManager added in v1.0.0

func NewServiceManager(kubeClient *kubernetes.Clientset, namespace string) (*ServiceManager, error)

NewServiceManager create ServiceManager by kube clientset and namespace

func (*ServiceManager) Events added in v1.0.0

func (sm *ServiceManager) Events() chan watch.Event

Events return the channel save events from watch service change

Jump to

Keyboard shortcuts

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