infinispan

package
v0.0.0-...-546eec4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package infinispan is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ServiceTypes      = []schema.GroupVersionKind{ServiceGVK, RouteGVK, IngressGVK}
	ServiceGVK        = corev1.SchemeGroupVersion.WithKind("Service")
	RouteGVK          = routev1.SchemeGroupVersion.WithKind("Route")
	IngressGVK        = ingressv1.SchemeGroupVersion.WithKind("Ingress")
	ServiceMonitorGVK = monitoringv1.SchemeGroupVersion.WithKind("ServiceMonitor")
)

Functions

func IgnoreNotFound

func IgnoreNotFound(config *ResourcesConfig)

IgnoreNotFound return nil when NotFound errors are present

func InvalidateCache

func InvalidateCache(config *ResourcesConfig)

InvalidateCache ignore any cached resources and execute a new call to the api-server Only applicable for Load and LoadGlobal functions

func RetryOnErr

func RetryOnErr(config *ResourcesConfig)

RetryOnErr set Context#Requeue(err) when an error is encountered

func SkipEventRec

func SkipEventRec(config *ResourcesConfig)

SkipEventRec do not send an event to the EventRecorder in the event of an error Only applicable for Load and LoadGlobal functions

Types

type AdminIdentities

type AdminIdentities struct {
	Username       string
	Password       string
	IdentitiesFile []byte
	CliProperties  string
}

type BackupSite

type BackupSite struct {
	Address            string
	Name               string
	Port               int32
	IgnoreGossipRouter bool
}

type ConfigFiles

type ConfigFiles struct {
	ConfigSpec             config.Spec
	Jmx                    bool
	ServerAdminConfig      string
	ServerBaseConfig       string
	ZeroConfig             string
	Log4j                  string
	UserIdentities         []byte
	AdminIdentities        *AdminIdentities
	CredentialStoreEntries map[string][]byte
	IdentitiesBatch        string
	UserConfig             UserConfig
	Keystore               *Keystore
	Truststore             *Truststore
	Transport              Transport
	XSite                  *XSite
}

ConfigFiles is used to hold all configuration required by the Operand in provisioned resources

type Context

type Context interface {

	// Operand returns the metadata associated with the current Infinispan CR spec.version field
	Operand() version.Operand

	// Operands returns the version.Manager containing all supported Operands
	Operands() *version.Manager

	// InfinispanClient returns a client for the Operand servers
	// The client is created Lazily and cached per Pipeline execution to prevent repeated calls to retrieve the cluster pods
	// An error is thrown on initial client creation if the cluster pods can't be retrieved or don't exist.
	InfinispanClient() (ispnApi.Infinispan, error)

	// InfinispanClientForPod returns a client for the specific pod
	InfinispanClientForPod(podName string) ispnApi.Infinispan

	// InfinispanPods returns all pods associated with the Infinispan cluster's StatefulSet
	// The list is created Lazily and cached per Pipeline execution to prevent repeated calls to retrieve the cluster pods
	// If an error is returned, then RetryProcessing is automatically set
	InfinispanPods() (*corev1.PodList, error)

	// ConfigFiles returns the ConfigFiles struct used to hold all configuration data required by the Operand
	ConfigFiles() *ConfigFiles

	// Resources interface provides convenience functions for interacting with kubernetes resources
	Resources() Resources

	// Ctx the Pipeline's context.Context that should be passed to any functions requiring a context
	Ctx() context.Context

	// Log the Infinispan request logger
	Log() logr.Logger

	// EventRecorder associated with the Infinispan controller
	EventRecorder() record.EventRecorder

	// Kubernetes exposes the underlying kubernetes client for when Resources doesn't provide the required functionality.
	// In general this method should be avoided if the same behaviour can be performed via the Resources interface
	Kubernetes() *kubernetes.Kubernetes

	// DefaultAnnotations defined for the Operator via ENV vars
	DefaultAnnotations() map[string]string

	// DefaultLabels defined for the Operator via ENV vars
	DefaultLabels() map[string]string

	// IsTypeSupported returns true if the GVK is supported on the kubernetes cluster
	IsTypeSupported(gvk schema.GroupVersionKind) bool

	// UpdateInfinispan updates the Infinispan CR resource being reconciled
	// If an error is encountered, then RetryProcessing is automatically set
	UpdateInfinispan(func()) error

	// Requeue indicates that the pipeline should stop once the current Handler has finished execution and
	// reconciliation should be requeued
	Requeue(reason error)

	// RequeueAfter indicates that the pipeline should stop once the current Handler has finished execution and
	// reconciliation should be requeued after delay time
	RequeueAfter(delay time.Duration, reason error)

	// RequeueEventually indicates that pipeline execution should continue after the current handler, but the
	// reconciliation event should be requeued on pipeline completion or when a call to Requeue is made by a
	// subsequent Handler execution. A non-zero delay indicates that on pipeline completion, the request should be
	// requeued after delay time.
	RequeueEventually(delay time.Duration)

	// Stop indicates that the pipeline should stop once the current Handler has finished execution
	Stop(err error)

	// FlowStatus the current status of the Pipeline
	FlowStatus() FlowStatus
}

Context of the pipeline, which is passed to each Handler

type ContextProvider

type ContextProvider interface {
	Get(ctx context.Context, config *ContextProviderConfig) (Context, error)
}

ContextProvider interface used by Pipeline implementations to obtain a Context

type ContextProviderConfig

type ContextProviderConfig struct {
	DefaultAnnotations map[string]string
	DefaultLabels      map[string]string
	Infinispan         *ispnv1.Infinispan
	Logger             logr.Logger
	SupportedTypes     map[schema.GroupVersionKind]struct{} // We only care about keys, so use struct{} as it requires 0 bytes
	VersionManager     *version.Manager
}

type FlowStatus

type FlowStatus struct {
	Retry bool
	Stop  bool
	Err   error
	Delay time.Duration
}

FlowStatus Pipeline flow control

func (*FlowStatus) String

func (f *FlowStatus) String() string

type GossipRouter

type GossipRouter struct {
	Keystore   *Keystore
	Truststore *Truststore
}

type Handler

type Handler interface {
	Handle(i *ispnv1.Infinispan, ctx Context)
}

Handler an individual stage in the pipeline

type HandlerFunc

type HandlerFunc func(i *ispnv1.Infinispan, ctx Context)

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(i *ispnv1.Infinispan, ctx Context)

type Keystore

type Keystore struct {
	Alias    string
	File     []byte
	PemFile  []byte
	Password string
	Path     string
	Type     string
}

type MockContext

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

MockContext is a mock of Context interface.

func NewMockContext

func NewMockContext(ctrl *gomock.Controller) *MockContext

NewMockContext creates a new mock instance.

func (*MockContext) ConfigFiles

func (m *MockContext) ConfigFiles() *ConfigFiles

ConfigFiles mocks base method.

func (*MockContext) Ctx

func (m *MockContext) Ctx() context.Context

Ctx mocks base method.

func (*MockContext) DefaultAnnotations

func (m *MockContext) DefaultAnnotations() map[string]string

DefaultAnnotations mocks base method.

func (*MockContext) DefaultLabels

func (m *MockContext) DefaultLabels() map[string]string

DefaultLabels mocks base method.

func (*MockContext) EXPECT

func (m *MockContext) EXPECT() *MockContextMockRecorder

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

func (*MockContext) EventRecorder

func (m *MockContext) EventRecorder() record.EventRecorder

EventRecorder mocks base method.

func (*MockContext) FlowStatus

func (m *MockContext) FlowStatus() FlowStatus

FlowStatus mocks base method.

func (*MockContext) InfinispanClient

func (m *MockContext) InfinispanClient() (api.Infinispan, error)

InfinispanClient mocks base method.

func (*MockContext) InfinispanClientForPod

func (m *MockContext) InfinispanClientForPod(podName string) api.Infinispan

InfinispanClientForPod mocks base method.

func (*MockContext) InfinispanPods

func (m *MockContext) InfinispanPods() (*v10.PodList, error)

InfinispanPods mocks base method.

func (*MockContext) IsTypeSupported

func (m *MockContext) IsTypeSupported(gvk schema.GroupVersionKind) bool

IsTypeSupported mocks base method.

func (*MockContext) Kubernetes

func (m *MockContext) Kubernetes() *kubernetes.Kubernetes

Kubernetes mocks base method.

func (*MockContext) Log

func (m *MockContext) Log() logr.Logger

Log mocks base method.

func (*MockContext) Operand

func (m *MockContext) Operand() version.Operand

Operand mocks base method.

func (*MockContext) Operands

func (m *MockContext) Operands() *version.Manager

Operands mocks base method.

func (*MockContext) Requeue

func (m *MockContext) Requeue(reason error)

Requeue mocks base method.

func (*MockContext) RequeueAfter

func (m *MockContext) RequeueAfter(delay time.Duration, reason error)

RequeueAfter mocks base method.

func (*MockContext) RequeueEventually

func (m *MockContext) RequeueEventually(delay time.Duration)

RequeueEventually mocks base method.

func (*MockContext) Resources

func (m *MockContext) Resources() Resources

Resources mocks base method.

func (*MockContext) Stop

func (m *MockContext) Stop(err error)

Stop mocks base method.

func (*MockContext) UpdateInfinispan

func (m *MockContext) UpdateInfinispan(arg0 func()) error

UpdateInfinispan mocks base method.

type MockContextMockRecorder

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

MockContextMockRecorder is the mock recorder for MockContext.

func (*MockContextMockRecorder) ConfigFiles

func (mr *MockContextMockRecorder) ConfigFiles() *gomock.Call

ConfigFiles indicates an expected call of ConfigFiles.

func (*MockContextMockRecorder) Ctx

func (mr *MockContextMockRecorder) Ctx() *gomock.Call

Ctx indicates an expected call of Ctx.

func (*MockContextMockRecorder) DefaultAnnotations

func (mr *MockContextMockRecorder) DefaultAnnotations() *gomock.Call

DefaultAnnotations indicates an expected call of DefaultAnnotations.

func (*MockContextMockRecorder) DefaultLabels

func (mr *MockContextMockRecorder) DefaultLabels() *gomock.Call

DefaultLabels indicates an expected call of DefaultLabels.

func (*MockContextMockRecorder) EventRecorder

func (mr *MockContextMockRecorder) EventRecorder() *gomock.Call

EventRecorder indicates an expected call of EventRecorder.

func (*MockContextMockRecorder) FlowStatus

func (mr *MockContextMockRecorder) FlowStatus() *gomock.Call

FlowStatus indicates an expected call of FlowStatus.

func (*MockContextMockRecorder) InfinispanClient

func (mr *MockContextMockRecorder) InfinispanClient() *gomock.Call

InfinispanClient indicates an expected call of InfinispanClient.

func (*MockContextMockRecorder) InfinispanClientForPod

func (mr *MockContextMockRecorder) InfinispanClientForPod(podName interface{}) *gomock.Call

InfinispanClientForPod indicates an expected call of InfinispanClientForPod.

func (*MockContextMockRecorder) InfinispanPods

func (mr *MockContextMockRecorder) InfinispanPods() *gomock.Call

InfinispanPods indicates an expected call of InfinispanPods.

func (*MockContextMockRecorder) IsTypeSupported

func (mr *MockContextMockRecorder) IsTypeSupported(gvk interface{}) *gomock.Call

IsTypeSupported indicates an expected call of IsTypeSupported.

func (*MockContextMockRecorder) Kubernetes

func (mr *MockContextMockRecorder) Kubernetes() *gomock.Call

Kubernetes indicates an expected call of Kubernetes.

func (*MockContextMockRecorder) Log

func (mr *MockContextMockRecorder) Log() *gomock.Call

Log indicates an expected call of Log.

func (*MockContextMockRecorder) Operand

func (mr *MockContextMockRecorder) Operand() *gomock.Call

Operand indicates an expected call of Operand.

func (*MockContextMockRecorder) Operands

func (mr *MockContextMockRecorder) Operands() *gomock.Call

Operands indicates an expected call of Operands.

func (*MockContextMockRecorder) Requeue

func (mr *MockContextMockRecorder) Requeue(reason interface{}) *gomock.Call

Requeue indicates an expected call of Requeue.

func (*MockContextMockRecorder) RequeueAfter

func (mr *MockContextMockRecorder) RequeueAfter(delay, reason interface{}) *gomock.Call

RequeueAfter indicates an expected call of RequeueAfter.

func (*MockContextMockRecorder) RequeueEventually

func (mr *MockContextMockRecorder) RequeueEventually(delay interface{}) *gomock.Call

RequeueEventually indicates an expected call of RequeueEventually.

func (*MockContextMockRecorder) Resources

func (mr *MockContextMockRecorder) Resources() *gomock.Call

Resources indicates an expected call of Resources.

func (*MockContextMockRecorder) Stop

func (mr *MockContextMockRecorder) Stop(err interface{}) *gomock.Call

Stop indicates an expected call of Stop.

func (*MockContextMockRecorder) UpdateInfinispan

func (mr *MockContextMockRecorder) UpdateInfinispan(arg0 interface{}) *gomock.Call

UpdateInfinispan indicates an expected call of UpdateInfinispan.

type MockContextProvider

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

MockContextProvider is a mock of ContextProvider interface.

func NewMockContextProvider

func NewMockContextProvider(ctrl *gomock.Controller) *MockContextProvider

NewMockContextProvider creates a new mock instance.

func (*MockContextProvider) EXPECT

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

func (*MockContextProvider) Get

Get mocks base method.

type MockContextProviderMockRecorder

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

MockContextProviderMockRecorder is the mock recorder for MockContextProvider.

func (*MockContextProviderMockRecorder) Get

func (mr *MockContextProviderMockRecorder) Get(ctx, config interface{}) *gomock.Call

Get indicates an expected call of Get.

type MockHandler

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

MockHandler is a mock of Handler interface.

func NewMockHandler

func NewMockHandler(ctrl *gomock.Controller) *MockHandler

NewMockHandler creates a new mock instance.

func (*MockHandler) EXPECT

func (m *MockHandler) EXPECT() *MockHandlerMockRecorder

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

func (*MockHandler) Handle

func (m *MockHandler) Handle(i *v1.Infinispan, ctx Context)

Handle mocks base method.

type MockHandlerMockRecorder

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

MockHandlerMockRecorder is the mock recorder for MockHandler.

func (*MockHandlerMockRecorder) Handle

func (mr *MockHandlerMockRecorder) Handle(i, ctx interface{}) *gomock.Call

Handle indicates an expected call of Handle.

type MockPipeline

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

MockPipeline is a mock of Pipeline interface.

func NewMockPipeline

func NewMockPipeline(ctrl *gomock.Controller) *MockPipeline

NewMockPipeline creates a new mock instance.

func (*MockPipeline) EXPECT

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

func (*MockPipeline) Process

func (m *MockPipeline) Process(ctx context.Context) (bool, time.Duration, error)

Process mocks base method.

type MockPipelineMockRecorder

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

MockPipelineMockRecorder is the mock recorder for MockPipeline.

func (*MockPipelineMockRecorder) Process

func (mr *MockPipelineMockRecorder) Process(ctx interface{}) *gomock.Call

Process indicates an expected call of Process.

type MockResources

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

MockResources is a mock of Resources interface.

func NewMockResources

func NewMockResources(ctrl *gomock.Controller) *MockResources

NewMockResources creates a new mock instance.

func (*MockResources) Create

func (m *MockResources) Create(obj client.Object, setControllerRef bool, opts ...func(*ResourcesConfig)) error

Create mocks base method.

func (*MockResources) CreateOrPatch

func (m *MockResources) CreateOrPatch(obj client.Object, setControllerRef bool, mutate func() error, opts ...func(*ResourcesConfig)) (OperationResult, error)

CreateOrPatch mocks base method.

func (*MockResources) CreateOrUpdate

func (m *MockResources) CreateOrUpdate(obj client.Object, setControllerRef bool, mutate func() error, opts ...func(*ResourcesConfig)) (OperationResult, error)

CreateOrUpdate mocks base method.

func (*MockResources) Delete

func (m *MockResources) Delete(name string, obj client.Object, opts ...func(*ResourcesConfig)) error

Delete mocks base method.

func (*MockResources) EXPECT

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

func (*MockResources) List

func (m *MockResources) List(set map[string]string, list client.ObjectList, opts ...func(*ResourcesConfig)) error

List mocks base method.

func (*MockResources) Load

func (m *MockResources) Load(name string, obj client.Object, opts ...func(*ResourcesConfig)) error

Load mocks base method.

func (*MockResources) LoadGlobal

func (m *MockResources) LoadGlobal(name string, obj client.Object, opts ...func(*ResourcesConfig)) error

LoadGlobal mocks base method.

func (*MockResources) SetControllerReference

func (m *MockResources) SetControllerReference(controlled v11.Object) error

SetControllerReference mocks base method.

func (*MockResources) Update

func (m *MockResources) Update(obj client.Object, opts ...func(*ResourcesConfig)) error

Update mocks base method.

type MockResourcesMockRecorder

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

MockResourcesMockRecorder is the mock recorder for MockResources.

func (*MockResourcesMockRecorder) Create

func (mr *MockResourcesMockRecorder) Create(obj, setControllerRef interface{}, opts ...interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockResourcesMockRecorder) CreateOrPatch

func (mr *MockResourcesMockRecorder) CreateOrPatch(obj, setControllerRef, mutate interface{}, opts ...interface{}) *gomock.Call

CreateOrPatch indicates an expected call of CreateOrPatch.

func (*MockResourcesMockRecorder) CreateOrUpdate

func (mr *MockResourcesMockRecorder) CreateOrUpdate(obj, setControllerRef, mutate interface{}, opts ...interface{}) *gomock.Call

CreateOrUpdate indicates an expected call of CreateOrUpdate.

func (*MockResourcesMockRecorder) Delete

func (mr *MockResourcesMockRecorder) Delete(name, obj interface{}, opts ...interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockResourcesMockRecorder) List

func (mr *MockResourcesMockRecorder) List(set, list interface{}, opts ...interface{}) *gomock.Call

List indicates an expected call of List.

func (*MockResourcesMockRecorder) Load

func (mr *MockResourcesMockRecorder) Load(name, obj interface{}, opts ...interface{}) *gomock.Call

Load indicates an expected call of Load.

func (*MockResourcesMockRecorder) LoadGlobal

func (mr *MockResourcesMockRecorder) LoadGlobal(name, obj interface{}, opts ...interface{}) *gomock.Call

LoadGlobal indicates an expected call of LoadGlobal.

func (*MockResourcesMockRecorder) SetControllerReference

func (mr *MockResourcesMockRecorder) SetControllerReference(controlled interface{}) *gomock.Call

SetControllerReference indicates an expected call of SetControllerReference.

func (*MockResourcesMockRecorder) Update

func (mr *MockResourcesMockRecorder) Update(obj interface{}, opts ...interface{}) *gomock.Call

Update indicates an expected call of Update.

type OperationResult

type OperationResult string

OperationResult is the result of a CreateOrPatch or CreateOrUpdate call

const (
	// OperationResultNone means that the resource has not been changed
	OperationResultNone OperationResult = "unchanged"
	// OperationResultCreated means that a new resource is created
	OperationResultCreated OperationResult = "created"
	// OperationResultUpdated means that an existing resource is updated
	OperationResultUpdated OperationResult = "updated"
	// OperationResultUpdatedStatus means that an existing resource and its status is updated
	OperationResultUpdatedStatus OperationResult = "updatedStatus"
	// OperationResultUpdatedStatusOnly means that only an existing status is updated
	OperationResultUpdatedStatusOnly OperationResult = "updatedStatusOnly"
)

type Pipeline

type Pipeline interface {
	// Process the pipeline
	// Returns true if processing should be repeated and optional error if occurred
	// important: even if error occurred it might not be needed to retry processing
	Process(ctx context.Context) (bool, time.Duration, error)
}

Pipeline for Infinispan reconciliation

type Resources

type Resources interface {
	// Create the passed object in the Infinispan namespace, setting the objects ControllerRef to the Infinispan CR if
	// setControllerRef is true
	Create(obj client.Object, setControllerRef bool, opts ...func(config *ResourcesConfig)) error
	// CreateOrUpdate the passed object in the Infinispan namespace, setting the objects ControllerRef to the Infinispan CR if
	// setControllerRef is true
	CreateOrUpdate(obj client.Object, setControllerRef bool, mutate func() error, opts ...func(config *ResourcesConfig)) (OperationResult, error)
	// CreateOrPatch the passed object in the Infinispan namespace, setting the objects ControllerRef to the Infinispan CR if
	// setControllerRef is true
	CreateOrPatch(obj client.Object, setControllerRef bool, mutate func() error, opts ...func(config *ResourcesConfig)) (OperationResult, error)
	// Delete the obj from the Infinispan namespace
	// IgnoreFoundError option is always true
	Delete(name string, obj client.Object, opts ...func(config *ResourcesConfig)) error
	// List resources in the Infinispan namespace using the passed set as a LabelSelector
	List(set map[string]string, list client.ObjectList, opts ...func(config *ResourcesConfig)) error
	// Load a resource from the Infinispan namespace
	Load(name string, obj client.Object, opts ...func(config *ResourcesConfig)) error
	// LoadGlobal loads a cluster scoped kubernetes resource
	LoadGlobal(name string, obj client.Object, opts ...func(config *ResourcesConfig)) error
	// SetControllerReference Set the controller reference of the passed object to the Infinispan CR being reconciled
	SetControllerReference(controlled metav1.Object) error
	// Update a kubernetes resource in the Infinispan namespace
	Update(obj client.Object, opts ...func(config *ResourcesConfig)) error
}

Resources interface that provides common functionality for interacting with Kubernetes resources

type ResourcesConfig

type ResourcesConfig struct {
	IgnoreNotFound  bool
	InvalidateCache bool
	RetryOnErr      bool
	SkipEventRec    bool
}

ResourcesConfig config used by Resources implementations to control implementation behaviour

type Transport

type Transport struct {
	Keystore   *Keystore
	Truststore *Truststore
}

type Truststore

type Truststore struct {
	File     []byte
	Password string
	Path     string
	Type     string
}

type UserConfig

type UserConfig struct {
	ServerConfig         string
	ServerConfigFileName string
	Log4j                string
}

type XSite

type XSite struct {
	GossipRouter      GossipRouter
	MaxRelayNodes     int32
	Sites             []BackupSite
	HeartbeatEnabled  bool
	HeartbeatInterval int64
	HeartbeatTimeout  int64
}

Directories

Path Synopsis
handler

Jump to

Keyboard shortcuts

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