cilium

package
v0.8.20 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNamespace

func GetNamespace(ep *models.Endpoint) string

GetNamespace returns the namespace the Endpoint belongs to.

Types

type FqdnCache

type FqdnCache interface {
	getters.DNSGetter
	InitializeFrom(entries []*models.DNSLookup)
	AddDNSLookup(epID uint64, lookupTime time.Time, domainName string, ips []net.IP, ttl uint32)
}

FqdnCache defines an interface for caching FQDN info from Cilium.

type LegacyPodGetter

type LegacyPodGetter struct {
	PodGetter      getters.IPGetter
	EndpointGetter getters.EndpointGetter
}

LegacyPodGetter implements GetIPIdentity based on the IPCache-backed IPGetter, but falls back on obtaining the pod information from the list of endpoints. This is intended to support Cilium 1.6 and older.

func (*LegacyPodGetter) GetIPIdentity

func (l *LegacyPodGetter) GetIPIdentity(ip net.IP) (identity ipcache.IPIdentity, ok bool)

GetIPIdentity fetches IP-related information.

type State

type State struct {
	// contains filtered or unexported fields
}

State contains various caches for Cilium state and channels to notify state changes.

func NewCiliumState

func NewCiliumState(
	ciliumClient client.Client,
	endpoints v1.EndpointsHandler,
	ipCache *ipcache.IPCache,
	fqdnCache FqdnCache,
	serviceCache *servicecache.ServiceCache,
	logger *logrus.Entry,
) *State

NewCiliumState returns a pointer to an initialized State struct.

func (*State) GetCiliumClient

func (s *State) GetCiliumClient() client.Client

GetCiliumClient returns ciliumClient.

func (*State) GetEndpointEventsChannel

func (s *State) GetEndpointEventsChannel() chan<- monitorAPI.AgentNotify

GetEndpointEventsChannel returns a channel that should be used to send AgentNotifyEndpoint* events when an endpoint is added, deleted or updated in Cilium.

func (*State) GetEndpointsHandler

func (s *State) GetEndpointsHandler() v1.EndpointsHandler

GetEndpointsHandler returns endpoints.

func (*State) GetFQDNCache

func (s *State) GetFQDNCache() FqdnCache

GetFQDNCache returns fqdnCache.

func (*State) GetIPCache

func (s *State) GetIPCache() *ipcache.IPCache

GetIPCache returns ipcache.

func (*State) GetLogRecordNotifyChannel

func (s *State) GetLogRecordNotifyChannel() chan<- monitor.LogRecordNotify

GetLogRecordNotifyChannel returns the event channel to receive monitorAPI.LogRecordNotify events.

func (*State) GetServiceCache

func (s *State) GetServiceCache() *servicecache.ServiceCache

GetServiceCache returns serviceCache.

func (*State) Start

func (s *State) Start()

Start starts the server to handle the events sent to the events channel as well as handle events to the EpAdd and EpDel channels.

func (*State) StartMirroringIPCache

func (s *State) StartMirroringIPCache(ipCacheEvents <-chan monitorAPI.AgentNotify)

StartMirroringIPCache will obtain an initial IPCache snapshot from Cilium and then start mirroring IPCache events based on IPCacheNotification sent through the ipCacheEvents channels. Only messages of type `AgentNotifyIPCacheUpserted` and `AgentNotifyIPCacheDeleted` should be sent through that channel. This function assumes that the caller is already connected to Cilium Monitor, i.e. no IPCacheNotification must be lost after calling this method.

func (*State) StartMirroringServiceCache

func (s *State) StartMirroringServiceCache(serviceEvents <-chan monitorAPI.AgentNotify)

StartMirroringServiceCache initially caches service information from Cilium and then starts to mirror service information based on events that are sent to the serviceEvents channel. Only messages of type `AgentNotifyServiceUpserted` and `AgentNotifyServiceDeleted` should be sent to this channel. This function assumes that the caller is already connected to Cilium Monitor, i.e. no Service notification must be lost after calling this method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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