cluster

package
v0.0.0-...-03a9efe Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultInventory

type DefaultInventory struct {
	*repository.Repository
	// contains filtered or unexported fields
}

func (*DefaultInventory) ClustersNotReady

func (i *DefaultInventory) ClustersNotReady() ([]*State, error)

func (*DefaultInventory) ClustersToReconcile

func (i *DefaultInventory) ClustersToReconcile(reconcileInterval time.Duration) ([]*State, error)

func (*DefaultInventory) CountRetries

func (i *DefaultInventory) CountRetries(runtimeID string, configVersion int64, maxRetries int,
	errorStatus ...model.Status) (int, error)

func (*DefaultInventory) CreateOrUpdate

func (i *DefaultInventory) CreateOrUpdate(contractVersion int64, cluster *keb.Cluster) (*State, error)

func (*DefaultInventory) Delete

func (i *DefaultInventory) Delete(runtimeID string) error

func (*DefaultInventory) Get

func (i *DefaultInventory) Get(runtimeID string, configVersion int64) (*State, error)

func (*DefaultInventory) GetAll

func (i *DefaultInventory) GetAll() ([]*State, error)

func (*DefaultInventory) GetLatest

func (i *DefaultInventory) GetLatest(runtimeID string) (*State, error)

func (*DefaultInventory) GetStatusIDsBlocksToDelete

func (i *DefaultInventory) GetStatusIDsBlocksToDelete(statusCleanupBatchSize int) ([][]interface{}, error)

func (*DefaultInventory) MarkForDeletion

func (i *DefaultInventory) MarkForDeletion(runtimeID string) (*State, error)

func (*DefaultInventory) RemoveDeletedClustersOlderThan

func (i *DefaultInventory) RemoveDeletedClustersOlderThan(deadline time.Time) (int, error)

func (*DefaultInventory) RemoveStatusesWithoutReconciliations

func (i *DefaultInventory) RemoveStatusesWithoutReconciliations(timeout time.Duration, statusCleanupBatchSize int) (int,
	error)

func (*DefaultInventory) StatusChanges

func (i *DefaultInventory) StatusChanges(runtimeID string, offset time.Duration) ([]*StatusChange, error)

func (*DefaultInventory) UpdateStatus

func (i *DefaultInventory) UpdateStatus(state *State, status model.Status) (*State, error)

func (*DefaultInventory) WithTx

func (i *DefaultInventory) WithTx(tx *db.TxConnection) (Inventory, error)

type Inventory

type Inventory interface {
	CreateOrUpdate(contractVersion int64, cluster *keb.Cluster) (*State, error)
	UpdateStatus(State *State, status model.Status) (*State, error)
	MarkForDeletion(runtimeID string) (*State, error)
	Delete(runtimeID string) error
	Get(runtimeID string, configVersion int64) (*State, error)
	GetLatest(runtimeID string) (*State, error)
	GetAll() ([]*State, error)
	StatusChanges(runtimeID string, offset time.Duration) ([]*StatusChange, error)
	ClustersToReconcile(reconcileInterval time.Duration) ([]*State, error)
	ClustersNotReady() ([]*State, error)
	CountRetries(runtimeID string, configVersion int64, maxRetries int, errorStatus ...model.Status) (int, error)
	WithTx(tx *db.TxConnection) (Inventory, error)
	RemoveStatusesWithoutReconciliations(timeout time.Duration, statusCleanupBatchSize int) (int, error)
	RemoveDeletedClustersOlderThan(deadline time.Time) (int, error)
}

func NewInventory

func NewInventory(conn db.Connection, debug bool, collector metricsCollector) (Inventory, error)

type MetricsCollectorMock

type MetricsCollectorMock struct{}

func (MetricsCollectorMock) OnClusterStateUpdate

func (collector MetricsCollectorMock) OnClusterStateUpdate(_ *State) error

type MockInventory

type MockInventory struct {
	ClustersToReconcileResult             []*State
	ClustersNotReadyResult                []*State
	GetResult                             *State
	GetLatestResult                       *State
	GetAllResult                          []*State
	CreateOrUpdateResult                  *State
	MarkForDeletionResult                 *State
	DeleteResult                          error
	UpdateStatusResult                    *State
	ChangesResult                         []*StatusChange
	RetriesCount                          int
	DeletedStatusesWoReconciliationResult int
	DeletedStatusesOlderThanResult        int
	DeletedClustersOlderThanResult        int
}

func (*MockInventory) ClustersNotReady

func (i *MockInventory) ClustersNotReady() ([]*State, error)

func (*MockInventory) ClustersToReconcile

func (i *MockInventory) ClustersToReconcile(_ time.Duration) ([]*State, error)

func (*MockInventory) CountRetries

func (i *MockInventory) CountRetries(_ string, _ int64, _ int, _ ...model.Status) (int, error)

func (*MockInventory) CreateOrUpdate

func (i *MockInventory) CreateOrUpdate(_ int64, _ *keb.Cluster) (*State, error)

func (*MockInventory) Delete

func (i *MockInventory) Delete(_ string) error

func (*MockInventory) Get

func (i *MockInventory) Get(_ string, _ int64) (*State, error)

func (*MockInventory) GetAll

func (i *MockInventory) GetAll() ([]*State, error)

func (*MockInventory) GetLatest

func (i *MockInventory) GetLatest(_ string) (*State, error)

func (*MockInventory) MarkForDeletion

func (i *MockInventory) MarkForDeletion(_ string) (*State, error)

func (*MockInventory) RemoveDeletedClustersOlderThan

func (i *MockInventory) RemoveDeletedClustersOlderThan(deadline time.Time) (int, error)

func (*MockInventory) RemoveStatusesWithoutReconciliations

func (i *MockInventory) RemoveStatusesWithoutReconciliations(timeout time.Duration, statusCleanupBatchSize int) (int, error)

func (*MockInventory) StatusChanges

func (i *MockInventory) StatusChanges(_ string, _ time.Duration) ([]*StatusChange, error)

func (*MockInventory) UpdateStatus

func (i *MockInventory) UpdateStatus(_ *State, _ model.Status) (*State, error)

func (*MockInventory) WithTx

func (i *MockInventory) WithTx(_ *db.TxConnection) (Inventory, error)

type MockKubeconfigProvider

type MockKubeconfigProvider struct {
	KubeconfigResult string
}

func (*MockKubeconfigProvider) Get

func (kp *MockKubeconfigProvider) Get() (string, error)

type State

type State struct {
	Cluster       *model.ClusterEntity
	Configuration *model.ClusterConfigurationEntity
	Status        *model.ClusterStatusEntity
}

func (*State) String

func (s *State) String() string

type StatusChange

type StatusChange struct {
	Status   *model.ClusterStatusEntity
	Duration time.Duration
}

func (*StatusChange) String

func (s *StatusChange) String() string

Jump to

Keyboard shortcuts

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