Documentation ¶
Overview ¶
Package k8s communicates with Kubernetes to watch nodes.
Index ¶
- func WatchNodes(ctx context.Context, master, kubeconfig string, resync time.Duration, ...) error
- type Node
- type NodeStore
- func (s *NodeStore) Add(obj interface{}) error
- func (s *NodeStore) Delete(obj interface{}) error
- func (s *NodeStore) Get(obj interface{}) (item interface{}, exists bool, err error)
- func (s *NodeStore) GetByKey(key string) (item interface{}, exists bool, err error)
- func (s *NodeStore) List() []interface{}
- func (s *NodeStore) ListKeys() []string
- func (s *NodeStore) Replace(objs []interface{}, unusedResourceVersion string) error
- func (s *NodeStore) Resync() error
- func (s *NodeStore) Update(obj interface{}) error
- type Record
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchNodes ¶
func WatchNodes(ctx context.Context, master, kubeconfig string, resync time.Duration, store cache.Store) error
WatchNodes connects to the k8s API server (using an in-cluster configuration if kubconfig and master are empty), watches nodes until the provided context is finished, and publishes any changes to the provided cache.Store.
The provided watcher will be resync'd at a scheduled interval regardless of any changes if resync is non-zero.
Types ¶
type NodeStore ¶
type NodeStore struct { sync.Mutex Name string // The name of the NodeStore, for observability (logging, metrics, tracing). Timeout time.Duration // How long to block (worst case) on events. OnChange func(UpdateRequest) // A function that will be called whenever DNS records change. Logger *zap.Logger // contains filtered or unexported fields }
NodeStore is a cache.Store that maintains the full set of nodes, and notifies interested parties of changes.
func NewNodeStore ¶
NewNodeStore returns an initialized NodeStore.
func (*NodeStore) List ¶
func (s *NodeStore) List() []interface{}
We only implement cache.Store for cache.Reflector, and cache.Reflector does not call List/Get methods.
type Record ¶
type Record struct { IsInternal bool // Whether this record contains internal IPs or external IPs. IPs []net.IP }
Record is a DNS record that contains the full set of nodes.
type UpdateRequest ¶
UpdateRequest is a request to change a DNS address.