Documentation ¶
Index ¶
- Constants
- Variables
- type AnyListener
- type Client
- func (cs *Client) BuildForCustomKubecfg(kubecfg string) error
- func (cs *Client) BuildForInCluster(kubecfg string) error
- func (cs *Client) BuildForKubecfg() error
- func (cs *Client) BuildForParams(addr, token, cert, key, ca string) error
- func (cs *Client) GetClient() *kubernetes.Clientset
- func (cs *Client) SetClient(cli *kubernetes.Clientset)
- type ClusterCache
- func (c *ClusterCache) GetAllDaemons(ns string) ([]*v1.DaemonSet, error)
- func (c *ClusterCache) GetAllDaemonsWithLabels(ns string, filter labels.Selector) ([]*v1.DaemonSet, error)
- func (c *ClusterCache) GetAllDeployments(ns string) ([]*v1.Deployment, error)
- func (c *ClusterCache) GetAllEndpoints(ns string) ([]*corev1.Endpoints, error)
- func (c *ClusterCache) GetAllEndpointsWithLabels(ns string, filter labels.Selector) ([]*corev1.Endpoints, error)
- func (c *ClusterCache) GetAllEvents(ns string) ([]*corev1.Event, error)
- func (c *ClusterCache) GetAllEventsWithLabels(ns string, filter labels.Selector) ([]*corev1.Event, error)
- func (c *ClusterCache) GetAllPods(ns string) ([]*corev1.Pod, error)
- func (c *ClusterCache) GetAllReplicas(ns string) ([]*v1.ReplicaSet, error)
- func (c *ClusterCache) GetAllServices(ns string) ([]*corev1.Service, error)
- func (c *ClusterCache) GetAllStatefuls(ns string) ([]*v1.StatefulSet, error)
- func (c *ClusterCache) GetAllStatefulsWithLabels(ns string, filter labels.Selector) ([]*v1.StatefulSet, error)
- func (c *ClusterCache) GetDaemon(ns string, name string) (*v1.DaemonSet, error)
- func (c *ClusterCache) GetDeployment(ns string, name string) (*v1.Deployment, error)
- func (c *ClusterCache) GetDeploymentsWithLabels(ns string, filter labels.Selector) ([]*v1.Deployment, error)
- func (c *ClusterCache) GetEndpoints(ns string, name string) (*corev1.Endpoints, error)
- func (c *ClusterCache) GetEvents(ns, name string) (*corev1.Event, error)
- func (c *ClusterCache) GetNamespace(ns string) (*corev1.Namespace, error)
- func (c *ClusterCache) GetNamespaces() ([]*corev1.Namespace, error)
- func (c *ClusterCache) GetNamespacesWithLabels(filter labels.Selector) ([]*corev1.Namespace, error)
- func (c *ClusterCache) GetNode(name string) (*corev1.Node, error)
- func (c *ClusterCache) GetNodes() ([]*corev1.Node, error)
- func (c *ClusterCache) GetNodesWithLabels(filter labels.Selector) ([]*corev1.Node, error)
- func (c *ClusterCache) GetPod(ns string, name string) (*corev1.Pod, error)
- func (c *ClusterCache) GetPodsWithLabels(ns string, filter labels.Selector) ([]*corev1.Pod, error)
- func (c *ClusterCache) GetReplica(ns string, name string) (*v1.ReplicaSet, error)
- func (c *ClusterCache) GetReplicasWithLabels(ns string, filter labels.Selector) ([]*v1.ReplicaSet, error)
- func (c *ClusterCache) GetService(ns string, name string) (*corev1.Service, error)
- func (c *ClusterCache) GetServicesWithLabels(ns string, filter labels.Selector) ([]*corev1.Service, error)
- func (c *ClusterCache) GetStateful(ns string, name string) (*v1.StatefulSet, error)
- func (c *ClusterCache) GetUpdateTime(ns string) (time.Time, error)
- func (c *ClusterCache) ListDaemons(ns string) (*v1.DaemonSetList, error)
- func (c *ClusterCache) ListDeployments(ns string) (*v1.DeploymentList, error)
- func (c *ClusterCache) ListEvents(ns string) (*corev1.EventList, error)
- func (c *ClusterCache) ListPods(ns string) (*corev1.PodList, error)
- func (c *ClusterCache) ListReplicaSets(ns string) (*v1.ReplicaSetList, error)
- func (c *ClusterCache) ListServices(ns string) (*corev1.ServiceList, error)
- func (c *ClusterCache) ListStatefuls(ns string) (*v1.StatefulSetList, error)
- func (c *ClusterCache) RegisterListener(genre string, lis Listener)
- func (c *ClusterCache) Reset()
- func (c *ClusterCache) Start()
- func (c *ClusterCache) Stop()
- func (c *ClusterCache) SyncCache() error
- func (c *ClusterCache) SyncCacheWithTimeout(timeout time.Duration) error
- func (c *ClusterCache) SyncDaemonCache(timeout time.Duration) error
- func (c *ClusterCache) SyncDeploymentsCache(timeout time.Duration) error
- func (c *ClusterCache) SyncEndpointsCache(timeout time.Duration) error
- func (c *ClusterCache) SyncEventsCache(timeout time.Duration) error
- func (c *ClusterCache) SyncNamespacesCache(timeout time.Duration) error
- func (c *ClusterCache) SyncNodesCache(timeout time.Duration) error
- func (c *ClusterCache) SyncPodsCache(timeout time.Duration) error
- func (c *ClusterCache) SyncReplicasCache(timeout time.Duration) error
- func (c *ClusterCache) SyncServicesCache(timeout time.Duration) error
- func (c *ClusterCache) SyncStatefulCache(timeout time.Duration) error
- func (c *ClusterCache) ToLabels(mm map[string]string) labels.Selector
- func (c *ClusterCache) UnRegisterListener(genre string, lis Listener)
- func (c *ClusterCache) Wait()
- func (c *ClusterCache) WatchDaemons(ns string) (<-chan watch.Event, error)
- func (c *ClusterCache) WatchDeployments(ns string) (<-chan watch.Event, error)
- func (c *ClusterCache) WatchEvents(ns string) (<-chan watch.Event, error)
- func (c *ClusterCache) WatchPods(ns string) (<-chan watch.Event, error)
- func (c *ClusterCache) WatchReplicaSets(ns string) (<-chan watch.Event, error)
- func (c *ClusterCache) WatchServices(ns string) (<-chan watch.Event, error)
- func (c *ClusterCache) WatchStatefuls(ns string) (<-chan watch.Event, error)
- type ClusterCachePool
- type DataSet
- func (d *DataSet) CopyDaemons() map[string]*v1.DaemonSet
- func (d *DataSet) CopyDeployments() map[string]*v1.Deployment
- func (d *DataSet) CopyEndpoints() map[string]*corev1.Endpoints
- func (d *DataSet) CopyEvents() map[string]map[string][]*corev1.Event
- func (d *DataSet) CopyPods() map[string]*corev1.Pod
- func (d *DataSet) CopyReplicas() map[string]*v1.ReplicaSet
- func (d *DataSet) CopyServices() map[string]*corev1.Service
- func (d *DataSet) CopyStatefuls() map[string]*v1.StatefulSet
- type Listener
- type ListenerPool
- type OptionFunc
- func WithContext(ctx context.Context) OptionFunc
- func WithFollowNamespaces(nlist []string) OptionFunc
- func WithFollowResource(rlist []string) OptionFunc
- func WithNamespace(ns string) OptionFunc
- func WithNotFollowNamespaces(nlist []string) OptionFunc
- func WithNotFollowResource(rlist []string) OptionFunc
- func WithStopper(stopper chan struct{}) OptionFunc
Constants ¶
View Source
const ( TypeNamespace = "Namespace" TypePod = "Pod" TypeNode = "Node" TypeService = "Service" TypeReplicaSet = "ReplicaSet" TypeDeployment = "Deployment" TypeDaemonSet = "DaemonSet" TypeStatefulSet = "StatefulSet" TypeEvent = "Event" TypeEndpoint = "Endpoint" )
Variables ¶
View Source
var ( ErrNotFoundNamespace = errors.New("not found namespace") ErrNotFoundName = errors.New("not found name") ErrSyncResourceTimeout = errors.New("sync resource timeout") ErrCacheNotReady = errors.New("cache not ready, wait to sync full cache in the beginning") ErrBeyondExpireInterval = errors.New("beyond expire interval") ErrNotSupportResource = errors.New("not support resource") )
View Source
var ( ErrFullQueue = errors.New("channel is full") ErrCauseTimeout = errors.New("timeout") )
Functions ¶
This section is empty.
Types ¶
type AnyListener ¶ added in v1.0.4
type AnyListener struct { Name string Namespace string sync.Mutex // contains filtered or unexported fields }
func NewAnyListener ¶ added in v1.0.5
func NewAnyListener(ns, name string, uequal func(interface{}) bool) *AnyListener
NewAnyListener if ns and name are null, always return true.
func (*AnyListener) Equal ¶ added in v1.0.5
func (p *AnyListener) Equal(obj interface{}) bool
func (*AnyListener) Error ¶ added in v1.0.5
func (p *AnyListener) Error() error
func (*AnyListener) IsDone ¶ added in v1.0.5
func (p *AnyListener) IsDone() bool
func (*AnyListener) Notify ¶ added in v1.0.5
func (p *AnyListener) Notify(ev interface{})
func (*AnyListener) Receive ¶ added in v1.0.5
func (p *AnyListener) Receive() chan interface{}
func (*AnyListener) Stop ¶ added in v1.0.5
func (p *AnyListener) Stop()
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BuildForCustomKubecfg ¶
func (*Client) BuildForInCluster ¶
func (*Client) BuildForKubecfg ¶
func (*Client) BuildForParams ¶
func (*Client) GetClient ¶
func (cs *Client) GetClient() *kubernetes.Clientset
func (*Client) SetClient ¶ added in v1.0.3
func (cs *Client) SetClient(cli *kubernetes.Clientset)
type ClusterCache ¶
type ClusterCache struct {
// contains filtered or unexported fields
}
func NewClusterCache ¶
func NewClusterCache(client *Client, opts ...OptionFunc) (*ClusterCache, error)
func (*ClusterCache) GetAllDaemons ¶ added in v1.0.1
func (c *ClusterCache) GetAllDaemons(ns string) ([]*v1.DaemonSet, error)
func (*ClusterCache) GetAllDaemonsWithLabels ¶ added in v1.0.4
func (*ClusterCache) GetAllDeployments ¶ added in v1.0.1
func (c *ClusterCache) GetAllDeployments(ns string) ([]*v1.Deployment, error)
func (*ClusterCache) GetAllEndpoints ¶ added in v1.0.1
func (c *ClusterCache) GetAllEndpoints(ns string) ([]*corev1.Endpoints, error)
func (*ClusterCache) GetAllEndpointsWithLabels ¶ added in v1.0.4
func (*ClusterCache) GetAllEvents ¶ added in v1.0.1
func (c *ClusterCache) GetAllEvents(ns string) ([]*corev1.Event, error)
func (*ClusterCache) GetAllEventsWithLabels ¶ added in v1.0.4
func (*ClusterCache) GetAllPods ¶ added in v1.0.1
func (c *ClusterCache) GetAllPods(ns string) ([]*corev1.Pod, error)
func (*ClusterCache) GetAllReplicas ¶ added in v1.0.1
func (c *ClusterCache) GetAllReplicas(ns string) ([]*v1.ReplicaSet, error)
func (*ClusterCache) GetAllServices ¶ added in v1.0.1
func (c *ClusterCache) GetAllServices(ns string) ([]*corev1.Service, error)
func (*ClusterCache) GetAllStatefuls ¶ added in v1.0.1
func (c *ClusterCache) GetAllStatefuls(ns string) ([]*v1.StatefulSet, error)
func (*ClusterCache) GetAllStatefulsWithLabels ¶ added in v1.0.4
func (c *ClusterCache) GetAllStatefulsWithLabels(ns string, filter labels.Selector) ([]*v1.StatefulSet, error)
func (*ClusterCache) GetDeployment ¶
func (c *ClusterCache) GetDeployment(ns string, name string) (*v1.Deployment, error)
func (*ClusterCache) GetDeploymentsWithLabels ¶ added in v1.0.6
func (c *ClusterCache) GetDeploymentsWithLabels(ns string, filter labels.Selector) ([]*v1.Deployment, error)
func (*ClusterCache) GetEndpoints ¶ added in v1.0.1
func (*ClusterCache) GetEvents ¶ added in v1.0.1
func (c *ClusterCache) GetEvents(ns, name string) (*corev1.Event, error)
func (*ClusterCache) GetNamespace ¶ added in v1.0.6
func (c *ClusterCache) GetNamespace(ns string) (*corev1.Namespace, error)
func (*ClusterCache) GetNamespaces ¶
func (c *ClusterCache) GetNamespaces() ([]*corev1.Namespace, error)
func (*ClusterCache) GetNamespacesWithLabels ¶ added in v1.0.6
func (*ClusterCache) GetNode ¶ added in v1.0.6
func (c *ClusterCache) GetNode(name string) (*corev1.Node, error)
func (*ClusterCache) GetNodesWithLabels ¶ added in v1.0.6
func (*ClusterCache) GetPodsWithLabels ¶ added in v1.0.6
func (*ClusterCache) GetReplica ¶
func (c *ClusterCache) GetReplica(ns string, name string) (*v1.ReplicaSet, error)
func (*ClusterCache) GetReplicasWithLabels ¶ added in v1.0.6
func (c *ClusterCache) GetReplicasWithLabels(ns string, filter labels.Selector) ([]*v1.ReplicaSet, error)
func (*ClusterCache) GetService ¶
func (*ClusterCache) GetServicesWithLabels ¶ added in v1.0.6
func (*ClusterCache) GetStateful ¶
func (c *ClusterCache) GetStateful(ns string, name string) (*v1.StatefulSet, error)
func (*ClusterCache) GetUpdateTime ¶
func (c *ClusterCache) GetUpdateTime(ns string) (time.Time, error)
func (*ClusterCache) ListDaemons ¶
func (c *ClusterCache) ListDaemons(ns string) (*v1.DaemonSetList, error)
func (*ClusterCache) ListDeployments ¶
func (c *ClusterCache) ListDeployments(ns string) (*v1.DeploymentList, error)
func (*ClusterCache) ListEvents ¶
func (c *ClusterCache) ListEvents(ns string) (*corev1.EventList, error)
func (*ClusterCache) ListReplicaSets ¶
func (c *ClusterCache) ListReplicaSets(ns string) (*v1.ReplicaSetList, error)
func (*ClusterCache) ListServices ¶
func (c *ClusterCache) ListServices(ns string) (*corev1.ServiceList, error)
func (*ClusterCache) ListStatefuls ¶
func (c *ClusterCache) ListStatefuls(ns string) (*v1.StatefulSetList, error)
func (*ClusterCache) RegisterListener ¶ added in v1.0.4
func (c *ClusterCache) RegisterListener(genre string, lis Listener)
func (*ClusterCache) Reset ¶
func (c *ClusterCache) Reset()
func (*ClusterCache) Start ¶
func (c *ClusterCache) Start()
func (*ClusterCache) Stop ¶
func (c *ClusterCache) Stop()
func (*ClusterCache) SyncCache ¶
func (c *ClusterCache) SyncCache() error
func (*ClusterCache) SyncCacheWithTimeout ¶
func (c *ClusterCache) SyncCacheWithTimeout(timeout time.Duration) error
func (*ClusterCache) SyncDaemonCache ¶
func (c *ClusterCache) SyncDaemonCache(timeout time.Duration) error
func (*ClusterCache) SyncDeploymentsCache ¶
func (c *ClusterCache) SyncDeploymentsCache(timeout time.Duration) error
func (*ClusterCache) SyncEndpointsCache ¶ added in v1.0.1
func (c *ClusterCache) SyncEndpointsCache(timeout time.Duration) error
func (*ClusterCache) SyncEventsCache ¶
func (c *ClusterCache) SyncEventsCache(timeout time.Duration) error
func (*ClusterCache) SyncNamespacesCache ¶
func (c *ClusterCache) SyncNamespacesCache(timeout time.Duration) error
func (*ClusterCache) SyncNodesCache ¶
func (c *ClusterCache) SyncNodesCache(timeout time.Duration) error
func (*ClusterCache) SyncPodsCache ¶
func (c *ClusterCache) SyncPodsCache(timeout time.Duration) error
func (*ClusterCache) SyncReplicasCache ¶
func (c *ClusterCache) SyncReplicasCache(timeout time.Duration) error
func (*ClusterCache) SyncServicesCache ¶
func (c *ClusterCache) SyncServicesCache(timeout time.Duration) error
func (*ClusterCache) SyncStatefulCache ¶
func (c *ClusterCache) SyncStatefulCache(timeout time.Duration) error
func (*ClusterCache) ToLabels ¶ added in v1.0.6
func (c *ClusterCache) ToLabels(mm map[string]string) labels.Selector
func (*ClusterCache) UnRegisterListener ¶ added in v1.0.4
func (c *ClusterCache) UnRegisterListener(genre string, lis Listener)
func (*ClusterCache) Wait ¶
func (c *ClusterCache) Wait()
func (*ClusterCache) WatchDaemons ¶
func (c *ClusterCache) WatchDaemons(ns string) (<-chan watch.Event, error)
func (*ClusterCache) WatchDeployments ¶
func (c *ClusterCache) WatchDeployments(ns string) (<-chan watch.Event, error)
func (*ClusterCache) WatchEvents ¶
func (c *ClusterCache) WatchEvents(ns string) (<-chan watch.Event, error)
func (*ClusterCache) WatchPods ¶
func (c *ClusterCache) WatchPods(ns string) (<-chan watch.Event, error)
func (*ClusterCache) WatchReplicaSets ¶
func (c *ClusterCache) WatchReplicaSets(ns string) (<-chan watch.Event, error)
func (*ClusterCache) WatchServices ¶
func (c *ClusterCache) WatchServices(ns string) (<-chan watch.Event, error)
func (*ClusterCache) WatchStatefuls ¶
func (c *ClusterCache) WatchStatefuls(ns string) (<-chan watch.Event, error)
type ClusterCachePool ¶
func NewClusterCachePool ¶ added in v1.0.3
func NewClusterCachePool() *ClusterCachePool
func (*ClusterCachePool) Get ¶ added in v1.0.3
func (cp *ClusterCachePool) Get(id string) (*ClusterCache, bool)
func (*ClusterCachePool) Set ¶ added in v1.0.3
func (cp *ClusterCachePool) Set(id string, cc *ClusterCache)
type DataSet ¶
type DataSet struct { Pods map[string]*corev1.Pod // key: pod.name value: pod body Services map[string]*corev1.Service Deployments map[string]*v1.Deployment Replicas map[string]*v1.ReplicaSet Daemons map[string]*v1.DaemonSet StatefulSets map[string]*v1.StatefulSet Endpoints map[string]*corev1.Endpoints Events map[string]map[string][]*corev1.Event // key: Kind, key inside: name Namespace string // current ns UpdateAT time.Time sync.RWMutex // todo }
func (*DataSet) CopyDeployments ¶
func (d *DataSet) CopyDeployments() map[string]*v1.Deployment
func (*DataSet) CopyEndpoints ¶ added in v1.0.1
func (*DataSet) CopyEvents ¶ added in v1.0.1
func (*DataSet) CopyReplicas ¶
func (d *DataSet) CopyReplicas() map[string]*v1.ReplicaSet
func (*DataSet) CopyStatefuls ¶
func (d *DataSet) CopyStatefuls() map[string]*v1.StatefulSet
type ListenerPool ¶ added in v1.0.4
type OptionFunc ¶
type OptionFunc func(*ClusterCache) error
func WithContext ¶
func WithContext(ctx context.Context) OptionFunc
func WithFollowNamespaces ¶
func WithFollowNamespaces(nlist []string) OptionFunc
func WithFollowResource ¶
func WithFollowResource(rlist []string) OptionFunc
func WithNamespace ¶
func WithNamespace(ns string) OptionFunc
func WithNotFollowNamespaces ¶
func WithNotFollowNamespaces(nlist []string) OptionFunc
func WithNotFollowResource ¶
func WithNotFollowResource(rlist []string) OptionFunc
func WithStopper ¶
func WithStopper(stopper chan struct{}) OptionFunc
Click to show internal directories.
Click to hide internal directories.