instanceiterator

package
v0.0.0-...-fb356ce Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanUpgradeUsingCF

func CanUpgradeUsingCF(cfClient CFClient, maintenanceInfoPresent bool, logger *log.Logger) bool

func NewIteratorState

func NewIteratorState(canaryInstances, allInstances []service.Instance, canaryLimit int) (*iteratorState, error)

Types

type BOSHTriggerer

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

func NewBOSHUpgradeTriggerer

func NewBOSHUpgradeTriggerer(brokerServices BrokerServices) *BOSHTriggerer

func NewRecreateTriggerer

func NewRecreateTriggerer(brokerServices BrokerServices) *BOSHTriggerer

func (*BOSHTriggerer) Check

func (t *BOSHTriggerer) Check(serviceInstanceGUID string, operationData broker.OperationData) (TriggeredOperation, error)

func (*BOSHTriggerer) TriggerOperation

func (t *BOSHTriggerer) TriggerOperation(instance service.Instance) (TriggeredOperation, error)

type BrokerServices

type BrokerServices interface {
	ProcessInstance(instance service.Instance, operationType string) (services.BOSHOperation, error)
	LastOperation(instance string, operationData broker.OperationData) (domain.LastOperation, error)
	Instances(filter map[string]string) ([]service.Instance, error)
	LatestInstanceInfo(inst service.Instance) (service.Instance, error)
}

type CFClient

type CFClient interface {
	CheckMinimumOSBAPIVersion(minimum string, logger *log.Logger) bool
	GetServiceInstance(serviceInstanceGUID string, logger *log.Logger) (cf.ServiceInstanceResource, error)
	UpgradeServiceInstance(serviceInstanceGUID string, maintenanceInfo cf.MaintenanceInfo, logger *log.Logger) (cf.LastOperation, error)
	GetLastOperationForInstance(serviceInstanceGUID string, logger *log.Logger) (cf.LastOperation, error)
	GetPlanByServiceInstanceGUID(planUniqueID string, logger *log.Logger) (cf.ServicePlan, error)
}

type CFTriggerer

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

func NewCFTrigger

func NewCFTrigger(client CFClient, logger *log.Logger) *CFTriggerer

func (*CFTriggerer) Check

func (t *CFTriggerer) Check(serviceInstanceGUID string, operationData broker.OperationData) (TriggeredOperation, error)

func (*CFTriggerer) TriggerOperation

func (t *CFTriggerer) TriggerOperation(instance service.Instance) (TriggeredOperation, error)

type Configurator

type Configurator struct {
	BrokerServices        BrokerServices
	PollingInterval       time.Duration
	AttemptInterval       time.Duration
	AttemptLimit          int
	MaxInFlight           int
	Canaries              int
	Listener              Listener
	Sleeper               sleeper
	Triggerer             Triggerer
	CanarySelectionParams config.CanarySelectionParams
}

func NewConfigurator

func NewConfigurator(conf config.InstanceIteratorConfig, logger *log.Logger, logPrefix string) (*Configurator, error)

func (*Configurator) SetRecreateTriggerer

func (b *Configurator) SetRecreateTriggerer() error

func (*Configurator) SetUpgradeTriggererToBOSH

func (b *Configurator) SetUpgradeTriggererToBOSH()

func (*Configurator) SetUpgradeTriggererToCF

func (b *Configurator) SetUpgradeTriggererToCF(cfClient CFClient, logger *log.Logger)

type Iterator

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

func New

func New(builder *Configurator) *Iterator

func (*Iterator) Iterate

func (it *Iterator) Iterate() error

func (*Iterator) IterateInstancesWithAttempts

func (it *Iterator) IterateInstancesWithAttempts() error

type Listener

type Listener interface {
	FailedToRefreshInstanceInfo(instance string)
	Starting(maxInFlight int)
	RetryAttempt(num, limit int)
	RetryCanariesAttempt(num, limit, remainingCanaries int)
	InstancesToProcess(instances []service.Instance)
	InstanceOperationStarting(instance string, index int, totalInstances int, isCanary bool)
	InstanceOperationStartResult(instance string, status OperationState)
	InstanceOperationFinished(instance string, result string)
	WaitingFor(instance string, boshTaskId int)
	Progress(pollingInterval time.Duration, orphanCount, processedCount, skippedCount, toRetryCount, deletedCount int)
	Finished(orphanCount, finishedCount, skippedCount, deletedCount int, busyInstances, failedInstances []string)
	CanariesStarting(canaries int, filter config.CanarySelectionParams)
	CanariesFinished()
	UpgradeStrategy(strategy string)
}

func NewLoggingListener

func NewLoggingListener(logger *log.Logger, processType string) Listener

type LoggingListener

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

func (LoggingListener) CanariesFinished

func (ll LoggingListener) CanariesFinished()

func (LoggingListener) CanariesStarting

func (ll LoggingListener) CanariesStarting(canaries int, filter config.CanarySelectionParams)

func (LoggingListener) FailedToRefreshInstanceInfo

func (ll LoggingListener) FailedToRefreshInstanceInfo(instance string)

func (LoggingListener) Finished

func (ll LoggingListener) Finished(orphanCount, finishedCount, skippedCount, deletedCount int, busyInstances, failedInstances []string)

func (LoggingListener) InstanceOperationFinished

func (ll LoggingListener) InstanceOperationFinished(instance string, result string)

func (LoggingListener) InstanceOperationStartResult

func (ll LoggingListener) InstanceOperationStartResult(instance string, status OperationState)

func (LoggingListener) InstanceOperationStarting

func (ll LoggingListener) InstanceOperationStarting(instance string, index, totalInstances int, isCanary bool)

func (LoggingListener) InstancesToProcess

func (ll LoggingListener) InstancesToProcess(instances []service.Instance)

func (LoggingListener) Progress

func (ll LoggingListener) Progress(pollingInterval time.Duration, orphanCount, processedCount, skippedCount, toRetryCount, deletedCount int)

func (LoggingListener) RetryAttempt

func (ll LoggingListener) RetryAttempt(num, limit int)

func (LoggingListener) RetryCanariesAttempt

func (ll LoggingListener) RetryCanariesAttempt(attempt, limit, remainingCanaries int)

func (LoggingListener) Starting

func (ll LoggingListener) Starting(maxInFlight int)

func (LoggingListener) UpgradeStrategy

func (ll LoggingListener) UpgradeStrategy(strategy string)

func (LoggingListener) WaitingFor

func (ll LoggingListener) WaitingFor(instance string, boshTaskId int)

type OperationState

type OperationState string
const (
	OperationAccepted   OperationState = "accepted"
	OperationSucceeded  OperationState = "succeeded"
	OperationSkipped    OperationState = "skipped"
	OperationFailed     OperationState = "failed"
	OperationInProgress OperationState = "busy"
	InstanceNotFound    OperationState = "instance-not-found"
	OperationPending    OperationState = "not-started"
	OrphanDeployment    OperationState = "orphan-deployment"
)

type TriggeredOperation

type TriggeredOperation struct {
	State       OperationState
	Data        broker.OperationData
	Description string
}

type Triggerer

type Triggerer interface {
	TriggerOperation(service.Instance) (TriggeredOperation, error)
	Check(string, broker.OperationData) (TriggeredOperation, error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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