common

package
v1.35.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package common is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NamePartitionKey added in v1.21.6

func NamePartitionKey(obj interface{}) (lockKey string, identifier string, err error)

NamePartitionKey returns a string which serves as a "locking key" for parallel processing of RadixEnvironments and RadixRegistrations

func NamespacePartitionKey added in v1.21.6

func NamespacePartitionKey(obj interface{}) (lockKey string, identifier string, err error)

NamespacePartitionKey returns a string which serves as a "locking key" for parallel processing of RadixApplications, RadixAlerts, RadixDeployments and RadixJobs

func NewEventRecorder

func NewEventRecorder(controllerAgentName string, events typedcorev1.EventInterface, logger *log.Entry) record.EventRecorder

NewEventRecorder Creates an event recorder for controller

Types

type Controller

type Controller struct {
	Name                  string
	HandlerOf             string
	KubeClient            kubernetes.Interface
	RadixClient           radixclient.Interface
	WorkQueue             workqueue.RateLimitingInterface
	Informer              cache.SharedIndexInformer
	KubeInformerFactory   kubeinformers.SharedInformerFactory
	Handler               Handler
	Log                   *log.Entry
	WaitForChildrenToSync bool
	Recorder              record.EventRecorder
	LockKeyAndIdentifier  LockKeyAndIdentifierFunc
	// contains filtered or unexported fields
}

Controller Instance variables

func (*Controller) Enqueue

func (c *Controller) Enqueue(obj interface{}) (requeued bool, err error)

Enqueue takes a resource and converts it into a namespace/name string which is then put onto the work queue

func (*Controller) HandleObject

func (c *Controller) HandleObject(obj interface{}, ownerKind string, getOwnerFn GetOwner)

HandleObject ensures that when anything happens to object which any custom resouce is owner of, that custom resource is synced

func (*Controller) Run

func (c *Controller) Run(threadiness int, stopCh <-chan struct{}) error

Run starts the shared informer, which will be stopped when stopCh is closed.

type ControllerTestSuite added in v1.16.1

type ControllerTestSuite struct {
	suite.Suite
	KubeClient                *fake.Clientset
	RadixClient               *fakeradix.Clientset
	SecretProviderClient      *secretproviderfake.Clientset
	PromClient                *prometheusfake.Clientset
	KubeUtil                  *kube.Kube
	EventRecorder             *record.FakeRecorder
	RadixInformerFactory      informers.SharedInformerFactory
	KubeInformerFactory       kubeinformers.SharedInformerFactory
	MockCtrl                  *gomock.Controller
	Handler                   *MockHandler
	Synced                    chan bool
	Stop                      chan struct{}
	TestControllerSyncTimeout time.Duration
}

ControllerTestSuite Test suite

func (*ControllerTestSuite) SetupTest added in v1.16.1

func (s *ControllerTestSuite) SetupTest()

SetupTest Set up the test suite

func (*ControllerTestSuite) SyncedChannelCallback added in v1.16.1

func (s *ControllerTestSuite) SyncedChannelCallback() func(namespace string, name string, eventRecorder record.EventRecorder) error

SyncedChannelCallback Callback to send a signal to the Synced

func (*ControllerTestSuite) TearDownTest added in v1.16.1

func (s *ControllerTestSuite) TearDownTest()

TearDownTest Tear down the test suite

func (*ControllerTestSuite) WaitForNotSynced added in v1.16.1

func (s *ControllerTestSuite) WaitForNotSynced(failMessage string)

WaitForNotSynced Wait for Synced signal is not received during a second

func (*ControllerTestSuite) WaitForSynced added in v1.16.1

func (s *ControllerTestSuite) WaitForSynced(expectedOperation string)

WaitForSynced Wait while Synced signal received or fail after TestControllerSyncTimeout

type GetOwner

type GetOwner func(radixclient.Interface, string, string) (interface{}, error)

GetOwner Function pointer to pass to retrieve owner

type Handler

type Handler interface {
	Sync(namespace, name string, eventRecorder record.EventRecorder) error
}

Handler Common handler interface

type HasSynced

type HasSynced func(bool)

HasSynced Handler to function to report back on sync

type LockKeyAndIdentifierFunc added in v1.21.6

type LockKeyAndIdentifierFunc func(obj interface{}) (lockKey string, identifier string, err error)

LockKeyAndIdentifierFunc is a function which is either NamespacePartitionKey or NamePartitionKey

type MockHandler added in v1.16.1

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

MockHandler is a mock of Handler interface.

func NewMockHandler added in v1.16.1

func NewMockHandler(ctrl *gomock.Controller) *MockHandler

NewMockHandler creates a new mock instance.

func (*MockHandler) EXPECT added in v1.16.1

func (m *MockHandler) EXPECT() *MockHandlerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHandler) Sync added in v1.16.1

func (m *MockHandler) Sync(namespace, name string, eventRecorder record.EventRecorder) error

Sync mocks base method.

type MockHandlerMockRecorder added in v1.16.1

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

MockHandlerMockRecorder is the mock recorder for MockHandler.

func (*MockHandlerMockRecorder) Sync added in v1.16.1

func (mr *MockHandlerMockRecorder) Sync(namespace, name, eventRecorder interface{}) *gomock.Call

Sync indicates an expected call of Sync.

Jump to

Keyboard shortcuts

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