Documentation
¶
Index ¶
- Constants
- type CachePod
- type CommonResourceEventHandler
- type ConfigMapManager
- type EndpointsManager
- type LocationCache
- func (lc *LocationCache) AddOrUpdateEndpoints(endpoints v1.Endpoints)
- func (lc *LocationCache) AddOrUpdatePod(pod v1.Pod)
- func (lc *LocationCache) ConfigMapNodes(namespace, name string) (nodes []string)
- func (lc *LocationCache) DeleteConfigMap(namespace, name string)
- func (lc *LocationCache) DeleteEndpoints(endpoints v1.Endpoints)
- func (lc *LocationCache) DeleteNode(nodeName string)
- func (lc *LocationCache) DeleteSecret(namespace, name string)
- func (lc *LocationCache) GetAllEndpoints() []v1.Endpoints
- func (lc *LocationCache) GetNodeStatus(nodeName string) (string, bool)
- func (lc *LocationCache) IsEdgeNode(nodeName string) bool
- func (lc *LocationCache) IsEndpointsUpdated(new v1.Endpoints) bool
- func (lc *LocationCache) PodConfigMapsAndSecrets(pod v1.Pod) (configMaps, secrets []string)
- func (lc *LocationCache) SecretNodes(namespace, name string) (nodes []string)
- func (lc *LocationCache) UpdateEdgeNode(nodeName string, status string)
- type Manager
- type NodesManager
- type PodManager
- type RuleEndpointManager
- type RuleManager
- type SecretManager
- type ServiceManager
Constants ¶
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(si cache.SharedIndexInformer) (*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 ¶
type EndpointsManager struct {
// contains filtered or unexported fields
}
EndpointsManager manage all events of endpoints by SharedInformer
func NewEndpointsManager ¶
func NewEndpointsManager(si cache.SharedIndexInformer) (*EndpointsManager, error)
NewEndpointsManager create EndpointsManager by kube clientset and namespace
func (*EndpointsManager) Events ¶
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 ¶
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) 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 ¶
func (lc *LocationCache) DeleteEndpoints(endpoints v1.Endpoints)
DeleteEndpoints in cache
func (*LocationCache) DeleteNode ¶
func (lc *LocationCache) DeleteNode(nodeName string)
DeleteNode from cache
func (*LocationCache) DeleteSecret ¶
func (lc *LocationCache) DeleteSecret(namespace, name string)
DeleteSecret from cache
func (*LocationCache) GetAllEndpoints ¶
func (lc *LocationCache) GetAllEndpoints() []v1.Endpoints
GetAllEndpoints from cache
func (*LocationCache) GetNodeStatus ¶
func (lc *LocationCache) GetNodeStatus(nodeName string) (string, bool)
func (*LocationCache) IsEdgeNode ¶
func (lc *LocationCache) IsEdgeNode(nodeName string) bool
IsEdgeNode checks weather node is edge node or not
func (*LocationCache) IsEndpointsUpdated ¶
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 ¶
func (lc *LocationCache) UpdateEdgeNode(nodeName string, status string)
UpdateEdgeNode is to maintain edge nodes name upto-date by querying kubernetes client
type Manager ¶
Manager define the interface of a Manager, configmapManager and podManager implement it
type NodesManager ¶
type NodesManager struct {
// contains filtered or unexported fields
}
NodesManager manage all events of nodes by SharedInformer
func NewNodesManager ¶
func NewNodesManager(si cache.SharedIndexInformer) (*NodesManager, error)
NewNodesManager create NodesManager by kube clientset and namespace
func (*NodesManager) Events ¶
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(si cache.SharedIndexInformer) (*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 RuleEndpointManager ¶ added in v1.6.0
type RuleEndpointManager struct {
// contains filtered or unexported fields
}
RuleEndpointManager manage all events of rule by SharedInformer
func NewRuleEndpointManager ¶ added in v1.6.0
func NewRuleEndpointManager(si cache.SharedIndexInformer) (*RuleEndpointManager, error)
NewRuleEndpointManager create RuleEndpointManager by SharedIndexInformer
func (*RuleEndpointManager) Events ¶ added in v1.6.0
func (rem *RuleEndpointManager) Events() chan watch.Event
Events return the channel save events from watch secret change
type RuleManager ¶ added in v1.6.0
type RuleManager struct {
// contains filtered or unexported fields
}
RuleManager manage all events of rule by SharedInformer
func NewRuleManager ¶ added in v1.6.0
func NewRuleManager(si cache.SharedIndexInformer) (*RuleManager, error)
NewRuleManager create RuleManager by SharedIndexInformer
func (*RuleManager) Events ¶ added in v1.6.0
func (rm *RuleManager) Events() chan watch.Event
Events return the channel save events from watch secret change
type SecretManager ¶
type SecretManager struct {
// contains filtered or unexported fields
}
SecretManager manage all events of secret by SharedInformer
func NewSecretManager ¶
func NewSecretManager(si cache.SharedIndexInformer) (*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 ¶
type ServiceManager struct {
// contains filtered or unexported fields
}
ServiceManager manage all events of service by SharedInformer
func NewServiceManager ¶
func NewServiceManager(si cache.SharedIndexInformer) (*ServiceManager, error)
NewServiceManager create ServiceManager by kube clientset and namespace
func (*ServiceManager) Events ¶
func (sm *ServiceManager) Events() chan watch.Event
Events return the channel save events from watch service change