Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LogNode = false
Functions ¶
This section is empty.
Types ¶
type K8SData ¶
type K8SData struct { // Common model for the 'machines' database. Multiple sources of authoritative info are merged. MDB *MDB // IPToSrc sync.Map PodInfo sync.Map Pods atomic.Int32 Slices atomic.Int32 SliceIPs atomic.Int32 // contains filtered or unexported fields }
K8SData holds the data for one K8S cluster.
type K8SIPWatcher ¶
type K8SIPWatcher struct { // User data structures and callbacks. No direct deps on informers *K8SData Stop chan struct{} // contains filtered or unexported fields }
K8SIPWatcher watches pods, nodes, services and endpoints/slices to find IPs - using the shared informers.
The informer machinery creates an in-memory replica of the K8S data from etcd, with callbacks on changes.
TODO: also istio serviceentry and workloadentry ?
func Start ¶
func Start(kd *K8SData, config *rest.Config) (*K8SIPWatcher, error)
Start watching K8S, based on the config. The initial sync will happen in background - main() can do other initialization, but before readiness must call WaitForSync.
Will create 'clientsets' using generated code for strong-typed access to objects, as well as strong-typed listeners and informer objects.
func (*K8SIPWatcher) WaitForInit ¶
func (c *K8SIPWatcher) WaitForInit(stopCh chan struct{}) error
Run is used to wait for the sync to happen, and switch from initial sync to 'events' mode.
type MDB ¶
Objects to consider:
Pod Node Service EndpointSlice Endpoints Gateway
Istio: WorkloadEntry ServiceEntry
kind: EndpointSlice metadata:
name: example-abc labels: kubernetes.io/service-name: example
addressType: IPv4 ports:
- name: http protocol: TCP port: 80
endpoints:
- addresses:
- "10.1.2.3" conditions: ready: true hostname: pod-1 nodeName: node-1 zone: us-west2-a