Documentation ¶
Index ¶
- func IsInputValidationError(err error) bool
- func IsIntegratedServiceNotFoundError(err error) bool
- func IsUnknownIntegratedServiceError(err error) bool
- type ClusterIsNotReadyError
- type ClusterKubeConfigFunc
- type ClusterService
- type ISServiceV2
- func (i ISServiceV2) Activate(ctx context.Context, clusterID uint, serviceName string, ...) error
- func (i ISServiceV2) Deactivate(ctx context.Context, clusterID uint, serviceName string) error
- func (i ISServiceV2) Details(ctx context.Context, clusterID uint, serviceName string) (IntegratedService, error)
- func (i ISServiceV2) List(ctx context.Context, clusterID uint) ([]IntegratedService, error)
- func (i ISServiceV2) Update(ctx context.Context, clusterID uint, serviceName string, ...) error
- type InMemoryIntegratedServiceRepository
- func (r *InMemoryIntegratedServiceRepository) Clear()
- func (r *InMemoryIntegratedServiceRepository) DeleteIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) error
- func (r *InMemoryIntegratedServiceRepository) GetIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) (IntegratedService, error)
- func (r *InMemoryIntegratedServiceRepository) GetIntegratedServices(ctx context.Context, clusterID uint) ([]IntegratedService, error)
- func (r *InMemoryIntegratedServiceRepository) Restore(snapshot map[uint]map[string]IntegratedService)
- func (r *InMemoryIntegratedServiceRepository) SaveIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string, ...) error
- func (r *InMemoryIntegratedServiceRepository) Snapshot() map[uint]map[string]IntegratedService
- func (r *InMemoryIntegratedServiceRepository) UpdateIntegratedServiceSpec(ctx context.Context, clusterID uint, integratedServiceName string, ...) error
- func (r *InMemoryIntegratedServiceRepository) UpdateIntegratedServiceStatus(ctx context.Context, clusterID uint, integratedServiceName string, ...) error
- type IntegratedService
- type IntegratedServiceCleaner
- type IntegratedServiceManager
- type IntegratedServiceManagerRegistry
- type IntegratedServiceOperationDispatcher
- type IntegratedServiceOperator
- type IntegratedServiceOperatorRegistry
- type IntegratedServiceOutput
- type IntegratedServiceOutputProducer
- type IntegratedServiceRepository
- type IntegratedServiceService
- func (s IntegratedServiceService) Activate(ctx context.Context, clusterID uint, integratedServiceName string, ...) error
- func (s IntegratedServiceService) Deactivate(ctx context.Context, clusterID uint, integratedServiceName string) error
- func (s IntegratedServiceService) Details(ctx context.Context, clusterID uint, integratedServiceName string) (IntegratedService, error)
- func (s IntegratedServiceService) List(ctx context.Context, clusterID uint) ([]IntegratedService, error)
- func (s IntegratedServiceService) Update(ctx context.Context, clusterID uint, integratedServiceName string, ...) error
- type IntegratedServiceSpec
- type IntegratedServiceSpecPreparer
- type IntegratedServiceSpecValidator
- type IntegratedServiceStatus
- type InvalidIntegratedServiceSpecError
- func (e InvalidIntegratedServiceSpecError) Details() []interface{}
- func (e InvalidIntegratedServiceSpecError) Error() string
- func (InvalidIntegratedServiceSpecError) InputValidationError() bool
- func (InvalidIntegratedServiceSpecError) ServiceError() bool
- func (InvalidIntegratedServiceSpecError) Validation() bool
- type LocalIntegratedServiceOperationDispatcher
- func (d LocalIntegratedServiceOperationDispatcher) DispatchApply(ctx context.Context, clusterID uint, integratedServiceName string, ...) error
- func (d LocalIntegratedServiceOperationDispatcher) DispatchDeactivate(ctx context.Context, clusterID uint, integratedServiceName string) error
- func (d LocalIntegratedServiceOperationDispatcher) Terminate()
- type Logger
- type MockClusterService
- type MockService
- func (_m *MockService) Activate(ctx context.Context, clusterID uint, serviceName string, ...) (_result_0 error)
- func (_m *MockService) Deactivate(ctx context.Context, clusterID uint, serviceName string) (_result_0 error)
- func (_m *MockService) Details(ctx context.Context, clusterID uint, serviceName string) (service IntegratedService, err error)
- func (_m *MockService) List(ctx context.Context, clusterID uint) (services []IntegratedService, err error)
- func (_m *MockService) Update(ctx context.Context, clusterID uint, serviceName string, ...) (_result_0 error)
- type NoopLogger
- type NotManagedIntegratedServiceError
- type PassthroughIntegratedServiceSpecPreparer
- type Service
- type SpecConversion
- type UnknownIntegratedServiceError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInputValidationError ¶
IsInputValidationError returns true if the error is an input validation error
func IsIntegratedServiceNotFoundError ¶
IsIntegratedServiceNotFoundError returns true when the specified error is a "integrated service not found" error
func IsUnknownIntegratedServiceError ¶
IsUnknownIntegratedServiceError returns true when the specified error is a "integrated service is unknown" error
Types ¶
type ClusterIsNotReadyError ¶
type ClusterIsNotReadyError struct {
ClusterID uint
}
ClusterIsNotReadyError is returned when a cluster is not in a ready state.
func (ClusterIsNotReadyError) Details ¶
func (e ClusterIsNotReadyError) Details() []interface{}
Details returns the error's details
func (ClusterIsNotReadyError) Error ¶
func (e ClusterIsNotReadyError) Error() string
func (ClusterIsNotReadyError) ShouldRetry ¶
func (e ClusterIsNotReadyError) ShouldRetry() bool
ShouldRetry returns true if the operation resulting in this error should be retried later.
type ClusterKubeConfigFunc ¶
func (ClusterKubeConfigFunc) GetKubeConfig ¶
type ClusterService ¶
type ClusterService interface { // CheckClusterReady checks whether the cluster is ready for integrated services (eg.: exists and it's running). If the cluster is not ready, a ClusterIsNotReadyError should be returned. CheckClusterReady(ctx context.Context, clusterID uint) error }
ClusterService provides a thin access layer to clusters.
type ISServiceV2 ¶
type ISServiceV2 struct {
// contains filtered or unexported fields
}
ISServiceV2 integrated service service implementation - V2
func NewISServiceV2 ¶
func NewISServiceV2( integratedServiceManagerRegistry IntegratedServiceManagerRegistry, integratedServiceOperationDispatcher IntegratedServiceOperationDispatcher, repository IntegratedServiceRepository, logger common.Logger, ) *ISServiceV2
NewISServiceV2 creates a new service instance using the provided collaborators
func (ISServiceV2) Activate ¶
func (i ISServiceV2) Activate(ctx context.Context, clusterID uint, serviceName string, spec map[string]interface{}) error
Activate initiates the activation of an integrated service
func (ISServiceV2) Deactivate ¶
func (ISServiceV2) Details ¶
func (i ISServiceV2) Details(ctx context.Context, clusterID uint, serviceName string) (IntegratedService, error)
func (ISServiceV2) List ¶
func (i ISServiceV2) List(ctx context.Context, clusterID uint) ([]IntegratedService, error)
type InMemoryIntegratedServiceRepository ¶
type InMemoryIntegratedServiceRepository struct {
// contains filtered or unexported fields
}
InMemoryIntegratedServiceRepository keeps integrated services in the memory. Use it in tests or for development/demo purposes.
func NewInMemoryIntegratedServiceRepository ¶
func NewInMemoryIntegratedServiceRepository(integratedServices map[uint][]IntegratedService) *InMemoryIntegratedServiceRepository
NewInMemoryIntegratedServiceRepository returns a new in-memory integrated service repository.
func (*InMemoryIntegratedServiceRepository) Clear ¶
func (r *InMemoryIntegratedServiceRepository) Clear()
Clear removes every entry from the repository
func (*InMemoryIntegratedServiceRepository) DeleteIntegratedService ¶
func (r *InMemoryIntegratedServiceRepository) DeleteIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) error
DeleteIntegratedService removes the integrated service from the repository. It is an idempotent operation.
func (*InMemoryIntegratedServiceRepository) GetIntegratedService ¶
func (r *InMemoryIntegratedServiceRepository) GetIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) (IntegratedService, error)
GetIntegratedService returns the integrated service identified by the parameters if it is in the repository, otherwise an error is returned
func (*InMemoryIntegratedServiceRepository) GetIntegratedServices ¶
func (r *InMemoryIntegratedServiceRepository) GetIntegratedServices(ctx context.Context, clusterID uint) ([]IntegratedService, error)
GetIntegratedServices returns a list of all the integrated services stored in the repository for the specified cluster
func (*InMemoryIntegratedServiceRepository) Restore ¶
func (r *InMemoryIntegratedServiceRepository) Restore(snapshot map[uint]map[string]IntegratedService)
Restore sets the repository's state from a snapshot
func (*InMemoryIntegratedServiceRepository) SaveIntegratedService ¶
func (r *InMemoryIntegratedServiceRepository) SaveIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec, status string) error
SaveIntegratedService persists the integrated service to the repository
func (*InMemoryIntegratedServiceRepository) Snapshot ¶
func (r *InMemoryIntegratedServiceRepository) Snapshot() map[uint]map[string]IntegratedService
Snapshot returns a snapshot of the repository's state that can be restored later
func (*InMemoryIntegratedServiceRepository) UpdateIntegratedServiceSpec ¶
func (r *InMemoryIntegratedServiceRepository) UpdateIntegratedServiceSpec(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec) error
UpdateIntegratedServiceSpec sets the integrated service's specification
func (*InMemoryIntegratedServiceRepository) UpdateIntegratedServiceStatus ¶
func (r *InMemoryIntegratedServiceRepository) UpdateIntegratedServiceStatus(ctx context.Context, clusterID uint, integratedServiceName string, status string) error
UpdateIntegratedServiceStatus sets the integrated service's status
type IntegratedService ¶
type IntegratedService struct { Name string `json:"name"` Spec IntegratedServiceSpec `json:"spec"` Output IntegratedServiceOutput `json:"output"` Status string `json:"status"` }
IntegratedService represents the state of an integrated service.
type IntegratedServiceCleaner ¶
type IntegratedServiceCleaner interface {
DisableServiceInstance(ctx context.Context, clusterID uint) error
}
func NewIntegratedServiceClean ¶
func NewIntegratedServiceClean(kubeConfigFn ClusterKubeConfigFunc) IntegratedServiceCleaner
type IntegratedServiceManager ¶
type IntegratedServiceManager interface { IntegratedServiceOutputProducer IntegratedServiceSpecValidator IntegratedServiceSpecPreparer // Name returns the integrated service's name. Name() string }
IntegratedServiceManager is a collection of integrated service specific methods that are used synchronously when responding to integrated service related requests.
type IntegratedServiceManagerRegistry ¶
type IntegratedServiceManagerRegistry interface { // GetIntegratedServiceManager retrieves an integrated service manager by name. GetIntegratedServiceManager(integratedServiceName string) (IntegratedServiceManager, error) // GetIntegratedServiceNames retrieves all known integrated services GetIntegratedServiceNames() []string }
IntegratedServiceManagerRegistry contains integrated service managers.
func MakeIntegratedServiceManagerRegistry ¶
func MakeIntegratedServiceManagerRegistry(managers []IntegratedServiceManager) IntegratedServiceManagerRegistry
MakeIntegratedServiceManagerRegistry returns a IntegratedServiceManagerRegistry with the specified integrated service managers registered.
type IntegratedServiceOperationDispatcher ¶
type IntegratedServiceOperationDispatcher interface { // DispatchApply starts applying a desired state for an integrated service asynchronously. DispatchApply(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec) error // DispatchDeactivate starts deactivating an integrated service asynchronously. DispatchDeactivate(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec) error // IsBeingDispatched checks whether there are any actively running workflows for the service IsBeingDispatched(ctx context.Context, clusterID uint, integratedServiceName string) (bool, error) }
IntegratedServiceOperationDispatcher dispatches cluster integrated service operations asynchronously.
type IntegratedServiceOperator ¶
type IntegratedServiceOperator interface { // Apply applies a desired state for an integrated service on the given cluster. Apply(ctx context.Context, clusterID uint, spec IntegratedServiceSpec) error // Deactivate deactivates an integrated service on the given cluster. Deactivate(ctx context.Context, clusterID uint, spec IntegratedServiceSpec) error // Name returns the integrated service's name. Name() string }
IntegratedServiceOperator defines the operations that can be applied to an integrated service.
type IntegratedServiceOperatorRegistry ¶
type IntegratedServiceOperatorRegistry interface { // GetIntegratedServiceOperator retrieves an integrated service operator by name. GetIntegratedServiceOperator(integratedServiceName string) (IntegratedServiceOperator, error) }
IntegratedServiceOperatorRegistry contains integrated service operators.
func MakeIntegratedServiceOperatorRegistry ¶
func MakeIntegratedServiceOperatorRegistry(operators []IntegratedServiceOperator) IntegratedServiceOperatorRegistry
MakeIntegratedServiceOperatorRegistry returns a IntegratedServiceOperatorRegistry with the specified integrated service operators registered.
type IntegratedServiceOutput ¶
type IntegratedServiceOutput = map[string]interface{}
IntegratedServiceOutput represents an integrated service's output.
type IntegratedServiceOutputProducer ¶
type IntegratedServiceOutputProducer interface { // GetOutput returns an integrated service's output. GetOutput(ctx context.Context, clusterID uint, spec IntegratedServiceSpec) (IntegratedServiceOutput, error) }
IntegratedServiceOutputProducer defines how to produce an integrated service's output.
type IntegratedServiceRepository ¶
type IntegratedServiceRepository interface { // GetIntegratedServices retrieves integrated services for a given cluster. GetIntegratedServices(ctx context.Context, clusterID uint) ([]IntegratedService, error) // GetIntegratedService retrieves an integrated service. GetIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) (IntegratedService, error) // SaveIntegratedService persists an integrated service. SaveIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec, status string) error // UpdateIntegratedServiceStatus updates the status of an integrated service. UpdateIntegratedServiceStatus(ctx context.Context, clusterID uint, integratedServiceName string, status string) error // UpdateIntegratedServiceSpec updates the spec of an integrated service. UpdateIntegratedServiceSpec(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec) error // DeleteIntegratedService deletes an integrated service. DeleteIntegratedService(ctx context.Context, clusterID uint, integratedServiceName string) error }
IntegratedServiceRepository manages integrated service state.
type IntegratedServiceService ¶
type IntegratedServiceService struct {
// contains filtered or unexported fields
}
IntegratedServiceService implements a cluster integrated service service
func MakeIntegratedServiceService ¶
func MakeIntegratedServiceService( integratedServiceOperationDispatcher IntegratedServiceOperationDispatcher, integratedServiceManagerRegistry IntegratedServiceManagerRegistry, integratedServiceRepository IntegratedServiceRepository, logger common.Logger, ) IntegratedServiceService
MakeIntegratedServiceService returns a new IntegratedServiceService instance.
func (IntegratedServiceService) Activate ¶
func (s IntegratedServiceService) Activate(ctx context.Context, clusterID uint, integratedServiceName string, spec map[string]interface{}) error
Activate activates an integrated service.
func (IntegratedServiceService) Deactivate ¶
func (s IntegratedServiceService) Deactivate(ctx context.Context, clusterID uint, integratedServiceName string) error
Deactivate deactivates a integrated service.
func (IntegratedServiceService) Details ¶
func (s IntegratedServiceService) Details(ctx context.Context, clusterID uint, integratedServiceName string) (IntegratedService, error)
Details returns the details of an activated integrated service.
func (IntegratedServiceService) List ¶
func (s IntegratedServiceService) List(ctx context.Context, clusterID uint) ([]IntegratedService, error)
List returns non-inactive integrated services and their status.
type IntegratedServiceSpec ¶
type IntegratedServiceSpec = map[string]interface{}
IntegratedServiceSpec represents an integrated service's specification (i.e. its input parameters).
type IntegratedServiceSpecPreparer ¶
type IntegratedServiceSpecPreparer interface { // PrepareSpec makes certain preparations to the spec before it's sent to be applied. // For example it rewrites the secret ID to it's internal representation, fills in defaults, etc. PrepareSpec(ctx context.Context, clusterID uint, spec IntegratedServiceSpec) (IntegratedServiceSpec, error) }
IntegratedServiceSpecPreparer defines how an integrated service specification is prepared before it's sent to be applied
type IntegratedServiceSpecValidator ¶
type IntegratedServiceSpecValidator interface { // ValidateSpec validates an integrated service specification. ValidateSpec(ctx context.Context, spec IntegratedServiceSpec) error }
IntegratedServiceSpecValidator defines how to validate an integrated service specification
type IntegratedServiceStatus ¶
type IntegratedServiceStatus = string
IntegratedServiceStatus represents an integrated service's status.
const ( IntegratedServiceStatusInactive IntegratedServiceStatus = "INACTIVE" IntegratedServiceStatusPending IntegratedServiceStatus = "PENDING" IntegratedServiceStatusActive IntegratedServiceStatus = "ACTIVE" IntegratedServiceStatusError IntegratedServiceStatus = "ERROR" )
IntegratedService status constants
type InvalidIntegratedServiceSpecError ¶
InvalidIntegratedServiceSpecError is returned when an integrated service specification fails the validation.
func (InvalidIntegratedServiceSpecError) Details ¶
func (e InvalidIntegratedServiceSpecError) Details() []interface{}
Details returns the error's details
func (InvalidIntegratedServiceSpecError) Error ¶
func (e InvalidIntegratedServiceSpecError) Error() string
func (InvalidIntegratedServiceSpecError) InputValidationError ¶
func (InvalidIntegratedServiceSpecError) InputValidationError() bool
InputValidationError returns true since InputValidationError is an input validation error
func (InvalidIntegratedServiceSpecError) ServiceError ¶
func (InvalidIntegratedServiceSpecError) ServiceError() bool
ServiceError tells the consumer whether this error is caused by invalid input supplied by the client. Client errors are usually returned to the consumer without retrying the operation.
func (InvalidIntegratedServiceSpecError) Validation ¶
func (InvalidIntegratedServiceSpecError) Validation() bool
Validation tells a client that this error is related to a semantic validation of the request. Can be used to translate the error to status codes for example.
type LocalIntegratedServiceOperationDispatcher ¶
type LocalIntegratedServiceOperationDispatcher struct {
// contains filtered or unexported fields
}
LocalIntegratedServiceOperationDispatcher implements an IntegratedServiceOperationDispatcher using goroutines
func NewLocalIntegratedServiceOperationDispatcher ¶
func NewLocalIntegratedServiceOperationDispatcher( jobQueueSize uint, integratedServiceOperatorRegistry IntegratedServiceOperatorRegistry, integratedServiceRepository IntegratedServiceRepository, logger common.Logger, results chan<- error, ) LocalIntegratedServiceOperationDispatcher
NewLocalIntegratedServiceOperationDispatcher dispatches integrated service operations via goroutines This dispatcher implementation should not be used in production, only for development and testing.
func (LocalIntegratedServiceOperationDispatcher) DispatchApply ¶
func (d LocalIntegratedServiceOperationDispatcher) DispatchApply(ctx context.Context, clusterID uint, integratedServiceName string, spec IntegratedServiceSpec) error
DispatchApply dispatches an Apply request to a integrated service manager asynchronously
func (LocalIntegratedServiceOperationDispatcher) DispatchDeactivate ¶
func (d LocalIntegratedServiceOperationDispatcher) DispatchDeactivate(ctx context.Context, clusterID uint, integratedServiceName string) error
DispatchDeactivate dispatches a Deactivate request to a integrated service manager asynchronously
func (LocalIntegratedServiceOperationDispatcher) Terminate ¶
func (d LocalIntegratedServiceOperationDispatcher) Terminate()
Terminate prevents the dispatcher from processing further requests
type MockClusterService ¶
MockClusterService is an autogenerated mock for the ClusterService type.
func (*MockClusterService) CheckClusterReady ¶
func (_m *MockClusterService) CheckClusterReady(ctx context.Context, clusterID uint) (_result_0 error)
CheckClusterReady provides a mock function.
type MockService ¶
MockService is an autogenerated mock for the Service type.
func (*MockService) Activate ¶
func (_m *MockService) Activate(ctx context.Context, clusterID uint, serviceName string, spec map[string]interface{}) (_result_0 error)
Activate provides a mock function.
func (*MockService) Deactivate ¶
func (_m *MockService) Deactivate(ctx context.Context, clusterID uint, serviceName string) (_result_0 error)
Deactivate provides a mock function.
func (*MockService) Details ¶
func (_m *MockService) Details(ctx context.Context, clusterID uint, serviceName string) (service IntegratedService, err error)
Details provides a mock function.
func (*MockService) List ¶
func (_m *MockService) List(ctx context.Context, clusterID uint) (services []IntegratedService, err error)
List provides a mock function.
type NoopLogger ¶
type NoopLogger = common.NoopLogger
NoopLogger is a logger that discards every log event.
type NotManagedIntegratedServiceError ¶
type NotManagedIntegratedServiceError struct {
IntegratedServiceName string
}
func (NotManagedIntegratedServiceError) Error ¶
func (n NotManagedIntegratedServiceError) Error() string
func (NotManagedIntegratedServiceError) ServiceError ¶
func (NotManagedIntegratedServiceError) ServiceError() bool
type PassthroughIntegratedServiceSpecPreparer ¶
type PassthroughIntegratedServiceSpecPreparer struct{}
PassthroughIntegratedServiceSpecPreparer implements IntegratedServiceSpecPreparer by making no modifications to the integrated service spec
func (PassthroughIntegratedServiceSpecPreparer) PrepareSpec ¶
func (PassthroughIntegratedServiceSpecPreparer) PrepareSpec(_ context.Context, _ uint, spec IntegratedServiceSpec) (IntegratedServiceSpec, error)
PrepareSpec returns the provided spec without any modifications
type Service ¶
type Service interface { // List lists the activated integrated services and their details. List(ctx context.Context, clusterID uint) (services []IntegratedService, err error) // Details returns the details of an activated integrated service. Details(ctx context.Context, clusterID uint, serviceName string) (service IntegratedService, err error) // Activate activates a integrated service. Activate(ctx context.Context, clusterID uint, serviceName string, spec map[string]interface{}) error // Deactivate deactivates a integrated service. Deactivate(ctx context.Context, clusterID uint, serviceName string) error // Update updates a integrated service. Update(ctx context.Context, clusterID uint, serviceName string, spec map[string]interface{}) error }
Service manages integrated services on Kubernetes clusters.
type SpecConversion ¶
type SpecConversion interface { // ConvertSpec converts in integrated service spec while keeping it's original structure ConvertSpec(ctx context.Context, instance v1alpha1.ServiceInstance) (IntegratedServiceSpec, error) }
type UnknownIntegratedServiceError ¶
type UnknownIntegratedServiceError struct {
IntegratedServiceName string
}
UnknownIntegratedServiceError is returned when there is no integrated service manager registered for a integrated service.
func (UnknownIntegratedServiceError) Details ¶
func (e UnknownIntegratedServiceError) Details() []interface{}
Details returns the error's details
func (UnknownIntegratedServiceError) Error ¶
func (UnknownIntegratedServiceError) Error() string
func (UnknownIntegratedServiceError) ServiceError ¶
func (UnknownIntegratedServiceError) ServiceError() bool
ServiceError tells the transport layer whether this error should be translated into the transport format or an internal error should be returned instead.
func (UnknownIntegratedServiceError) Unknown ¶
func (UnknownIntegratedServiceError) Unknown() bool
Unknown tells a client that this error is related to a resource being unsupported. Can be used to translate the error to eg. status code.