informers

package
v1.6.0-community Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexIP     = "byIP"
	TypeNode    = "Node"
	TypePod     = "Pod"
	TypeService = "Service"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeInformers

type FakeInformers struct {
	InformersInterface
	// contains filtered or unexported fields
}

func SetupStubs

func SetupStubs(info map[string]*Info, nodes map[string]*Info) *FakeInformers

func (*FakeInformers) GetInfo

func (f *FakeInformers) GetInfo(n string) (*Info, error)

func (*FakeInformers) GetNodeInfo

func (f *FakeInformers) GetNodeInfo(n string) (*Info, error)

func (*FakeInformers) InitFromConfig

func (f *FakeInformers) InitFromConfig(_ string) error

type IndexerMock

type IndexerMock struct {
	mock.Mock
	cache.Indexer
}

func SetupIndexerMocks

func SetupIndexerMocks(kd *Informers) (pods, nodes, svc, rs *IndexerMock)

func (*IndexerMock) ByIndex

func (m *IndexerMock) ByIndex(indexName, indexedValue string) ([]interface{}, error)

func (*IndexerMock) FallbackNotFound

func (m *IndexerMock) FallbackNotFound()

func (*IndexerMock) GetByKey

func (m *IndexerMock) GetByKey(key string) (interface{}, bool, error)

func (*IndexerMock) MockNode

func (m *IndexerMock) MockNode(ip, name string)

func (*IndexerMock) MockPod

func (m *IndexerMock) MockPod(ip, name, namespace, nodeIP string, owner *Owner)

func (*IndexerMock) MockReplicaSet

func (m *IndexerMock) MockReplicaSet(name, namespace string, owner Owner)

func (*IndexerMock) MockService

func (m *IndexerMock) MockService(ip, name, namespace string)

type Info

type Info struct {
	// Informers need that internal object is an ObjectMeta instance
	metav1.ObjectMeta
	Type     string
	Owner    Owner
	HostName string
	HostIP   string
	// contains filtered or unexported fields
}

Info contains precollected metadata for Pods, Nodes and Services. Not all the fields are populated for all the above types. To save memory, we just keep in memory the necessary data for each Type. For more information about which fields are set for each type, please refer to the instantiation function of the respective informers.

type InformerInterface

type InformerInterface interface {
	cache.SharedInformer
	AddIndexers(indexers cache.Indexers) error
	GetIndexer() cache.Indexer
}

type InformerMock

type InformerMock struct {
	mock.Mock
	InformerInterface
}

func (*InformerMock) GetIndexer

func (m *InformerMock) GetIndexer() cache.Indexer

type Informers

type Informers struct {
	InformersInterface
	// contains filtered or unexported fields
}

func (*Informers) GetInfo

func (k *Informers) GetInfo(ip string) (*Info, error)

func (*Informers) GetNodeInfo

func (k *Informers) GetNodeInfo(name string) (*Info, error)

func (*Informers) InitFromConfig

func (k *Informers) InitFromConfig(kubeConfigPath string) error

type InformersInterface

type InformersInterface interface {
	GetInfo(string) (*Info, error)
	GetNodeInfo(string) (*Info, error)
	InitFromConfig(string) error
}

type Mock

type Mock struct {
	mock.Mock
	InformersInterface
}

func NewInformersMock

func NewInformersMock() *Mock

func (*Mock) InitFromConfig

func (o *Mock) InitFromConfig(kubeConfigPath string) error

type Owner

type Owner struct {
	Type string
	Name string
}

Jump to

Keyboard shortcuts

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