ciliumutil

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ErrCodeNotFound = 404

Variables

View Source
var (
	ErrAlreadyExists  = errors.New("already exists")
	ErrNotImplemented = errors.New("not implemented")
)
View Source
var ErrMockStoreFailure = errors.New("mock store failure")

Functions

This section is empty.

Types

type ErrNotFound

type ErrNotFound struct{}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

func (ErrNotFound) Status

func (e ErrNotFound) Status() v1.Status

type JSONPatch

type JSONPatch struct {
	OP    string            `json:"op,omitempty"`
	Path  string            `json:"path,omitempty"`
	Value v2.EndpointStatus `json:"value"`
}

type MockCiliumV2Client

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

MockCiliumV2Client is a mock implementation of ciliumv2.CiliumV2Interface. Currently it only returns a real value for CiliumIdentities()

func NewMockCiliumV2Client

func NewMockCiliumV2Client(l logrus.FieldLogger, ciliumEndpoints *MockResource[*v2.CiliumEndpoint]) *MockCiliumV2Client

func (*MockCiliumV2Client) CiliumClusterwideEnvoyConfigs

func (m *MockCiliumV2Client) CiliumClusterwideEnvoyConfigs() ciliumv2.CiliumClusterwideEnvoyConfigInterface

func (*MockCiliumV2Client) CiliumClusterwideNetworkPolicies

func (m *MockCiliumV2Client) CiliumClusterwideNetworkPolicies() ciliumv2.CiliumClusterwideNetworkPolicyInterface

func (*MockCiliumV2Client) CiliumEgressGatewayPolicies

func (m *MockCiliumV2Client) CiliumEgressGatewayPolicies() ciliumv2.CiliumEgressGatewayPolicyInterface

func (*MockCiliumV2Client) CiliumEndpoints

func (m *MockCiliumV2Client) CiliumEndpoints(namespace string) ciliumv2.CiliumEndpointInterface

func (*MockCiliumV2Client) CiliumEnvoyConfigs

func (*MockCiliumV2Client) CiliumExternalWorkloads

func (m *MockCiliumV2Client) CiliumExternalWorkloads() ciliumv2.CiliumExternalWorkloadInterface

func (*MockCiliumV2Client) CiliumIdentities

func (m *MockCiliumV2Client) CiliumIdentities() ciliumv2.CiliumIdentityInterface

func (*MockCiliumV2Client) CiliumLocalRedirectPolicies

func (m *MockCiliumV2Client) CiliumLocalRedirectPolicies(_ string) ciliumv2.CiliumLocalRedirectPolicyInterface

func (*MockCiliumV2Client) CiliumNetworkPolicies

func (m *MockCiliumV2Client) CiliumNetworkPolicies(_ string) ciliumv2.CiliumNetworkPolicyInterface

func (*MockCiliumV2Client) CiliumNodes

func (*MockCiliumV2Client) RESTClient

func (m *MockCiliumV2Client) RESTClient() rest.Interface

type MockEndpointClient

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

func NewMockEndpointClient

func NewMockEndpointClient(l logrus.FieldLogger, namespace string, ciliumEndpoints *MockResource[*v2.CiliumEndpoint]) *MockEndpointClient

func (*MockEndpointClient) Create

func (*MockEndpointClient) Delete

func (*MockEndpointClient) DeleteCollection

func (m *MockEndpointClient) DeleteCollection(_ context.Context, _ v1.DeleteOptions, _ v1.ListOptions) error

func (*MockEndpointClient) Get

func (*MockEndpointClient) List

func (*MockEndpointClient) Patch

func (m *MockEndpointClient) Patch(_ context.Context, name string, _ types.PatchType, data []byte, _ v1.PatchOptions, _ ...string) (result *v2.CiliumEndpoint, err error)

func (*MockEndpointClient) Update

func (*MockEndpointClient) UpdateStatus

func (*MockEndpointClient) Watch

type MockIdentityClient

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

MockIdentityClient is a mock implementation of ciliumv2.CiliumIdentityInterface. We only implement what's needed. These methods are used by: - CRDBackend within the Allocator within the IdentityManager - identitygc cell

func NewMockIdentityClient

func NewMockIdentityClient(l logrus.FieldLogger) *MockIdentityClient

func (*MockIdentityClient) Create

func (*MockIdentityClient) Delete

func (*MockIdentityClient) DeleteCollection

func (m *MockIdentityClient) DeleteCollection(_ context.Context, _ v1.DeleteOptions, _ v1.ListOptions) error

func (*MockIdentityClient) Get

func (*MockIdentityClient) GetIdentities

func (m *MockIdentityClient) GetIdentities() map[string]*v2.CiliumIdentity

func (*MockIdentityClient) List

func (*MockIdentityClient) Patch

func (m *MockIdentityClient) Patch(_ context.Context, _ string, _ types.PatchType, _ []byte, _ v1.PatchOptions, _ ...string) (result *v2.CiliumIdentity, err error)

func (*MockIdentityClient) Update

func (*MockIdentityClient) Watch

type MockResource

type MockResource[T k8sRuntime.Object] struct {
	// contains filtered or unexported fields
}

MockResource is a mock implementation of resource.Resource AND resource.Store It currently only implements the methods used in the endpoint controller i.e. Store() and GetByKey() plus some helpers to add/remove items from the cache and error on the next call to Store()

func NewMockResource

func NewMockResource[T k8sRuntime.Object](l logrus.FieldLogger) *MockResource[T]

func (*MockResource[T]) ByIndex

func (r *MockResource[T]) ByIndex(_, _ string) ([]T, error)

func (*MockResource[T]) CacheStore

func (r *MockResource[T]) CacheStore() cache.Store

func (*MockResource[T]) Delete

func (r *MockResource[T]) Delete(k resource.Key)

func (*MockResource[T]) Events

func (r *MockResource[T]) Events(_ context.Context, _ ...resource.EventsOpt) <-chan resource.Event[T]

func (*MockResource[T]) FailOnNextStoreCall

func (r *MockResource[T]) FailOnNextStoreCall()

FailOnNextStoreCall will cause the next call to Store() to return an error

func (*MockResource[T]) Get

func (r *MockResource[T]) Get(obj T) (item T, exists bool, err error)

func (*MockResource[T]) GetByKey

func (r *MockResource[T]) GetByKey(key resource.Key) (item T, exists bool, err error)

func (*MockResource[T]) IndexKeys

func (r *MockResource[T]) IndexKeys(_, _ string) ([]string, error)

func (*MockResource[T]) IterKeys

func (r *MockResource[T]) IterKeys() resource.KeyIter

func (*MockResource[T]) List

func (r *MockResource[T]) List() []T

func (*MockResource[T]) Observe

func (r *MockResource[T]) Observe(_ context.Context, _ func(resource.Event[T]), _ func(error))

func (*MockResource[T]) Release

func (r *MockResource[T]) Release()

func (*MockResource[T]) Store

func (r *MockResource[T]) Store(context.Context) (resource.Store[T], error)

func (*MockResource[T]) Upsert

func (r *MockResource[T]) Upsert(obj T)

type MockVersionedClient

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

MockVersionedClient is a mock implementation of versioned.Interface Currently it only returns a real value for CiliumV2()

func NewMockVersionedClient

func NewMockVersionedClient(l logrus.FieldLogger, ciliumEndpoints *MockResource[*v2.CiliumEndpoint]) *MockVersionedClient

func (*MockVersionedClient) CiliumV2

func (*MockVersionedClient) CiliumV2alpha1

func (*MockVersionedClient) Discovery

Jump to

Keyboard shortcuts

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