integratedserviceadapter

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB, logger logrus.FieldLogger) error

Migrate executes the table migrations for the cluster module.

func NewCustomResourceRepository

func NewCustomResourceRepository(kubeConfigFn integratedservices.ClusterKubeConfigFunc, logger common.Logger, serviceConversion *ServiceConversion, namespace string) integratedservices.IntegratedServiceRepository

Creates a new Custom Resource repository instance to access integrated services in a k8s cluster

Types

type CadenceIntegratedServiceOperationDispatcher

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

CadenceIntegratedServiceOperationDispatcher implements an integrated service operation dispatcher using Uber Cadence

func MakeCadenceIntegratedServiceOperationDispatcher

func MakeCadenceIntegratedServiceOperationDispatcher(
	cadenceClient client.Client,
	logger common.Logger,
) CadenceIntegratedServiceOperationDispatcher

MakeCadenceIntegratedServiceOperationDispatcher returns an Uber Cadence based implementation of IntegratedServiceOperationDispatcher

func (CadenceIntegratedServiceOperationDispatcher) DispatchApply

func (d CadenceIntegratedServiceOperationDispatcher) DispatchApply(ctx context.Context, clusterID uint, integratedServiceName string, spec integratedservices.IntegratedServiceSpec) error

DispatchApply dispatches an Apply request to an integrated service manager asynchronously

func (CadenceIntegratedServiceOperationDispatcher) DispatchDeactivate

func (d CadenceIntegratedServiceOperationDispatcher) DispatchDeactivate(ctx context.Context, clusterID uint, integratedServiceName string, spec integratedservices.IntegratedServiceSpec) error

DispatchDeactivate dispatches a Deactivate request to an integrated service manager asynchronously

func (CadenceIntegratedServiceOperationDispatcher) IsBeingDispatched

func (d CadenceIntegratedServiceOperationDispatcher) IsBeingDispatched(ctx context.Context, clusterID uint, integratedServiceName string) (bool, error)

type Cluster

type Cluster interface {
	GetK8sConfig() ([]byte, error)
	GetName() string
	GetOrganizationId() uint
	GetUID() string
	GetID() uint
	NodePoolExists(nodePoolName string) bool
	RbacEnabled() bool
}

Cluster defines operations that can be performed on a k8s cluster

type ClusterGetter

type ClusterGetter interface {
	GetClusterByIDOnly(ctx context.Context, clusterID uint) (Cluster, error)
}

ClusterGetter restricts the external dependencies for the repository

type ClusterGetterAdapter

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

ClusterGetterAdapter adapts a "CommonCluster" cluster getter to an integrated service cluster getter

func MakeClusterGetter

func MakeClusterGetter(clusterGetter CommonClusterGetter) ClusterGetterAdapter

MakeClusterGetter adapts a "CommonCluster" cluster getter to an integrated service cluster getter

func (ClusterGetterAdapter) GetClusterByIDOnly

func (a ClusterGetterAdapter) GetClusterByIDOnly(ctx context.Context, clusterID uint) (Cluster, error)

GetClusterByIDOnly returns the cluster with the specified ID

type ClusterService

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

ClusterService is an adapter providing access to the core cluster layer.

func NewClusterService

func NewClusterService(clusterStatuser ClusterStatuser) ClusterService

NewClusterService returns a new ClusterService instance.

func (ClusterService) CheckClusterReady

func (s ClusterService) CheckClusterReady(ctx context.Context, clusterID uint) error

CheckClusterReady returns true if the cluster is ready to be accessed

type ClusterStatuser

type ClusterStatuser interface {
	GetClusterStatus(ctx context.Context, clusterID uint) (string, error)
}

ClusterStatuser supports getting a cluster's status

type CommonClusterGetter

type CommonClusterGetter interface {
	GetClusterByIDOnly(ctx context.Context, clusterID uint) (cluster.CommonCluster, error)
}

CommonClusterGetter defines cluster getter methods that return a CommonCluster

type GORMIntegratedServiceRepository

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

GORMIntegratedServiceRepository implements integrated service persistence in RDBMS using GORM. TODO: write integration tests

func NewGormIntegratedServiceRepository

func NewGormIntegratedServiceRepository(db *gorm.DB, logger common.Logger) GORMIntegratedServiceRepository

NewGormIntegratedServiceRepository returns an integrated service repository persisting integrated service state into database using GORM.

func (GORMIntegratedServiceRepository) DeleteIntegratedService

func (r GORMIntegratedServiceRepository) DeleteIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) error

DeleteIntegratedService permanently deletes the integrated service record

func (GORMIntegratedServiceRepository) GetIntegratedService

func (r GORMIntegratedServiceRepository) GetIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) (integratedservices.IntegratedService, error)

GetIntegratedService retrieves an integrated service by the cluster ID and integrated service name. It returns a "integrated service not found" error if the integrated service is not in the database.

func (GORMIntegratedServiceRepository) GetIntegratedServices

func (r GORMIntegratedServiceRepository) GetIntegratedServices(ctx context.Context, clusterID uint) ([]integratedservices.IntegratedService, error)

GetIntegratedServices returns integrated services stored in the repository for the specified cluster.

func (GORMIntegratedServiceRepository) SaveIntegratedService

func (r GORMIntegratedServiceRepository) SaveIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string, spec integratedservices.IntegratedServiceSpec, status string) error

SaveIntegratedService persists an integrated service with the specified properties in the database.

func (GORMIntegratedServiceRepository) UpdateIntegratedServiceSpec

func (r GORMIntegratedServiceRepository) UpdateIntegratedServiceSpec(ctx context.Context, clusterID uint, integratedServiceName string, spec integratedservices.IntegratedServiceSpec) error

UpdateIntegratedServiceSpec sets the specification of the specified integrated service

func (GORMIntegratedServiceRepository) UpdateIntegratedServiceStatus

func (r GORMIntegratedServiceRepository) UpdateIntegratedServiceStatus(ctx context.Context, clusterID uint, integratedServiceName string, status string) error

UpdateIntegratedServiceStatus sets the status of the specified integrated service

type IntegratedServiceOperatorNotAvailable

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

func (IntegratedServiceOperatorNotAvailable) Error

func (IntegratedServiceOperatorNotAvailable) ServiceError

type MockClusterGetter

type MockClusterGetter struct {
	mock.Mock
}

MockClusterGetter is an autogenerated mock for the ClusterGetter type.

func (*MockClusterGetter) GetClusterByIDOnly

func (_m *MockClusterGetter) GetClusterByIDOnly(ctx context.Context, clusterID uint) (_result_0 Cluster, _result_1 error)

GetClusterByIDOnly provides a mock function.

type OperationDispatcher

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

OperationDispatcher component dispatching operations related to the new version of the integrated services

func NewCadenceOperationDispatcher

func NewCadenceOperationDispatcher(
	cadenceClient client.Client,
	logger common.Logger,
) OperationDispatcher

NewCadenceOperationDispatcher returns the new version Uber Cadence based implementation of IntegratedServiceOperationDispatcher

func (OperationDispatcher) DispatchApply

func (d OperationDispatcher) DispatchApply(ctx context.Context, clusterID uint, integratedServiceName string, spec integratedservices.IntegratedServiceSpec) error

DispatchApply dispatches an Apply request to an integrated service manager asynchronously

func (OperationDispatcher) DispatchDeactivate

func (d OperationDispatcher) DispatchDeactivate(ctx context.Context, clusterID uint, integratedServiceName string, spec integratedservices.IntegratedServiceSpec) error

DispatchDeactivate dispatches a Deactivate request to an integrated service manager asynchronously

func (OperationDispatcher) IsBeingDispatched

func (d OperationDispatcher) IsBeingDispatched(ctx context.Context, clusterID uint, integratedServiceName string) (bool, error)

type OutputResolver

type OutputResolver interface {
	Resolve(ctx context.Context, instance v1alpha1.ServiceInstance) (integratedservices.IntegratedServiceOutput, error)
}

type Reconciler

type Reconciler interface {
	// Reconcile creates and applies CRs to a cluster
	Reconcile(ctx context.Context, kubeConfig []byte, svcInstance v1alpha1.ServiceInstance) error

	Disable(ctx context.Context, kubeConfig []byte, svcInstance v1alpha1.ServiceInstance) error
}

Reconciler decouples handling of custom resources on a kubernetes cluster

func NewISReconciler

func NewISReconciler(logger common.Logger) Reconciler

NewISReconciler builds an integrated service reconciler

type ServiceConversion

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

func NewServiceConversion

func NewServiceConversion(
	statusMapper services.StatusMapper,
	specConverters map[string]integratedservices.SpecConversion,
	outputResolvers map[string]OutputResolver,
) *ServiceConversion

func (ServiceConversion) Convert

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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