k8s

package module
v0.0.0-...-ab74ee0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.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.

func (*K8SData) OnAdd

func (k *K8SData) OnAdd(obj interface{}, isInInitialList bool)

func (*K8SData) OnDelete

func (k *K8SData) OnDelete(obj interface{})

func (*K8SData) OnUpdate

func (k *K8SData) OnUpdate(old, new interface{})

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL