Documentation ¶
Index ¶
- Constants
- Variables
- func NewNodeList(_ resource.ResType, resList []*resource.Resource) resource.ResHandler
- func NewPodList(_ resource.ResType, resList []*resource.Resource) resource.ResHandler
- func NewServiceList(_ resource.ResType, resList []*resource.Resource) resource.ResHandler
- func SetupCacheMap(cacheMap CacheMap)
- type CacheMap
- type ClusterCacheMap
- func (b *ClusterCacheMap) AddResHandler(clusterId string, resType resource.ResType, handler resource.ResHandler)
- func (b *ClusterCacheMap) AddResHandlers(clusterId string, handlers *HandlerMap)
- func (b *ClusterCacheMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool)
- func (b *ClusterCacheMap) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool)
- type HandlerMap
- type IQuery
- type Node
- type NodeList
- type NonCacheMap
- func (n *NonCacheMap) AddResHandler(clusterId string, resType resource.ResType, handler resource.ResHandler)
- func (n *NonCacheMap) AddResHandlers(clusterId string, handlers *HandlerMap)
- func (n *NonCacheMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool)
- func (n *NonCacheMap) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool)
- type OwnerReferences
- type Pod
- func (p *Pod) ContainerIDs() []string
- func (p *Pod) GetOwnerReferences(guessDeployment bool) []OwnerReferences
- func (p *Pod) HostIP() string
- func (p *Pod) IsHostNetWork() bool
- func (p *Pod) Labels() map[string]string
- func (p *Pod) NS() string
- func (p *Pod) NodeName() string
- func (p *Pod) Phase() string
- func (p *Pod) PodIP() string
- type PodList
- type PodServiceMap
- type Query
- func (q *Query) GetNodeByIP(clusterID string, IP string) (*Node, bool)
- func (q *Query) GetPodByContainerId(clusterID string, containerId string) (*Pod, bool)
- func (q *Query) GetPodByIP(clusterID string, podIP string) (*Pod, bool)
- func (q *Query) GetPodByNSAndName(clusterID string, namespace string, name string) (*Pod, bool)
- func (q *Query) GetPodByUID(clusterID string, UID resource.ResUID) (*Pod, bool)
- func (q *Query) GetServiceByIP(clusterID string, serviceIP string) (*Service, bool)
- func (q *Query) ListPod(clusterID string) (pods []*Pod)
- func (q *Query) ListService(clusterID string) (services []*Service)
- func (q *Query) QueryResource(w http.ResponseWriter, r *http.Request)
- func (q *Query) SetCacheMap(cacheMap CacheMap)
- type QueryResRequest
- type ResInfo
- type Service
- func (s *Service) AddEndpoint(pod *Pod)
- func (s *Service) DeleteEndpoint(oldPod *Pod)
- func (s *Service) EndPoints() []string
- func (s *Service) IP() string
- func (s *Service) MatchPod(pod *Pod) bool
- func (s *Service) MatchedPods() []*resource.ResUID
- func (s *Service) NS() string
- func (s *Service) Selectors() map[string]string
- func (s *Service) UID() resource.ResUID
- type ServiceList
- type SingleClusterCacheMap
- func (b *SingleClusterCacheMap) AddResHandler(_ string, resType resource.ResType, handler resource.ResHandler)
- func (b *SingleClusterCacheMap) AddResHandlers(_ string, handlers *HandlerMap)
- func (b *SingleClusterCacheMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool)
- func (b *SingleClusterCacheMap) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool)
Constants ¶
View Source
const ( POD_PHASE_RUNNING = "Running" POD_PHASE_PENDING = "Pending" )
Variables ¶
View Source
var Querier = &Query{ CacheMap: NonCache, }
Functions ¶
func NewNodeList ¶
func NewPodList ¶
func NewServiceList ¶
func SetupCacheMap ¶
func SetupCacheMap(cacheMap CacheMap)
Types ¶
type CacheMap ¶
type CacheMap interface { AddResHandler(clusterId string, resType resource.ResType, handler resource.ResHandler) AddResHandlers(clusterId string, handlers *HandlerMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool) }
var NonCache CacheMap = &NonCacheMap{}
type ClusterCacheMap ¶
func NewClusterCacheList ¶
func NewClusterCacheList() *ClusterCacheMap
func (*ClusterCacheMap) AddResHandler ¶
func (b *ClusterCacheMap) AddResHandler(clusterId string, resType resource.ResType, handler resource.ResHandler)
AddResHandler implements Querier.
func (*ClusterCacheMap) AddResHandlers ¶
func (b *ClusterCacheMap) AddResHandlers(clusterId string, handlers *HandlerMap)
AddResHandlers implements Querier.
func (*ClusterCacheMap) GetCache ¶
func (b *ClusterCacheMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool)
func (*ClusterCacheMap) GetCaches ¶
func (b *ClusterCacheMap) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool)
GetCaches implements CacheMap.
type HandlerMap ¶
func (*HandlerMap) AddHandler ¶
func (m *HandlerMap) AddHandler(resType resource.ResType, handler resource.ResHandler)
func (*HandlerMap) GetHandler ¶
func (m *HandlerMap) GetHandler(resType resource.ResType) (resource.ResHandler, bool)
type IQuery ¶
type IQuery interface { SetCacheMap(cacheMap CacheMap) QueryResource(w http.ResponseWriter, r *http.Request) }
type NodeList ¶
func (*NodeList) AddResource ¶
func (*NodeList) DeleteResource ¶
func (*NodeList) GetNodeByIP ¶
func (*NodeList) UpdateResource ¶
type NonCacheMap ¶
type NonCacheMap struct{}
func (*NonCacheMap) AddResHandler ¶
func (n *NonCacheMap) AddResHandler(clusterId string, resType resource.ResType, handler resource.ResHandler)
AddResHandler implements CacheMap.
func (*NonCacheMap) AddResHandlers ¶
func (n *NonCacheMap) AddResHandlers(clusterId string, handlers *HandlerMap)
AddResHandlers implements CacheMap.
func (*NonCacheMap) GetCache ¶
func (n *NonCacheMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool)
GetCache implements CacheMap.
func (*NonCacheMap) GetCaches ¶
func (n *NonCacheMap) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool)
GetCaches implements CacheMap.
type OwnerReferences ¶
type Pod ¶
func (*Pod) ContainerIDs ¶
func (*Pod) GetOwnerReferences ¶
func (p *Pod) GetOwnerReferences(guessDeployment bool) []OwnerReferences
func (*Pod) IsHostNetWork ¶
type PodList ¶
type PodList struct { *resource.Resources // POD UID -> *Pod UIDMap sync.Map // Namespace/Name -> *Pod PodMap sync.Map // ContainerID -> *Pod ContainerID2Pod sync.Map // IP -> *Pod only store not hostNetwork IP // TODO 重写sync.Map的store方法,丢弃key为空的记录 IP2PodMap sync.Map }
func (*PodList) AddResource ¶
func (*PodList) DeleteResource ¶
func (*PodList) UpdateResource ¶
type PodServiceMap ¶
type Query ¶
type Query struct {
CacheMap
}
func (*Query) GetPodByContainerId ¶
func (*Query) GetPodByNSAndName ¶
func (*Query) GetPodByUID ¶
func (*Query) GetServiceByIP ¶
func (*Query) ListService ¶
func (*Query) QueryResource ¶
func (q *Query) QueryResource(w http.ResponseWriter, r *http.Request)
func (*Query) SetCacheMap ¶
type QueryResRequest ¶
type Service ¶
func (*Service) AddEndpoint ¶
func (*Service) DeleteEndpoint ¶
func (*Service) MatchedPods ¶
type ServiceList ¶
type ServiceList struct { *resource.Resources // Service UID -> *Service UIDMap sync.Map // Namespace/Name -> *Service ServiceMap sync.Map // IP -> *Service IP2ServiceMap sync.Map IsPodWatch bool // contains filtered or unexported fields }
ServiceList可以同时处理Service资源和Pod资源 如果同时处理Pod资源,会维护Service和Pod的关系
func (*ServiceList) AddResource ¶
func (sl *ServiceList) AddResource(res *resource.Resource)
func (*ServiceList) DeleteResource ¶
func (sl *ServiceList) DeleteResource(res *resource.Resource)
func (*ServiceList) EnablePodMatch ¶
func (sl *ServiceList) EnablePodMatch()
func (*ServiceList) Reset ¶
func (sl *ServiceList) Reset(resList []*resource.Resource)
func (*ServiceList) UpdateResource ¶
func (sl *ServiceList) UpdateResource(res *resource.Resource)
type SingleClusterCacheMap ¶
type SingleClusterCacheMap struct {
Handlers *HandlerMap
}
func NewSingleClusterCacheList ¶
func NewSingleClusterCacheList() *SingleClusterCacheMap
func (*SingleClusterCacheMap) AddResHandler ¶
func (b *SingleClusterCacheMap) AddResHandler(_ string, resType resource.ResType, handler resource.ResHandler)
AddResHandler implements Querier.z
func (*SingleClusterCacheMap) AddResHandlers ¶
func (b *SingleClusterCacheMap) AddResHandlers(_ string, handlers *HandlerMap)
AddResHandlers implements Querier.
func (*SingleClusterCacheMap) GetCache ¶
func (b *SingleClusterCacheMap) GetCache(clusterId string, resType resource.ResType) (resource.ResHandler, bool)
GetCache implements Querier.
func (*SingleClusterCacheMap) GetCaches ¶
func (b *SingleClusterCacheMap) GetCaches(resType resource.ResType) ([]resource.ResHandler, bool)
GetCaches implements CacheMap.
Click to show internal directories.
Click to hide internal directories.