application

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyBlueprintSpecUseCase

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

ApplyBlueprintSpecUseCase contains all use cases which are needed for or around applying the new ecosystem state after the determining the state diff.

func NewApplyBlueprintSpecUseCase

func NewApplyBlueprintSpecUseCase(
	repo blueprintSpecRepository,
	doguInstallUseCase doguInstallationUseCase,
	healthUseCase ecosystemHealthUseCase,
	componentInstallUseCase componentInstallationUseCase,
	maintenanceModeAdapter maintenanceMode,
) *ApplyBlueprintSpecUseCase

func (*ApplyBlueprintSpecUseCase) ApplyBlueprintSpec

func (useCase *ApplyBlueprintSpecUseCase) ApplyBlueprintSpec(ctx context.Context, blueprintId string) error

ApplyBlueprintSpec applies the expected state to the ecosystem. It will stop if any unexpected error happens and sets blueprint status. Returns domainservice.ConflictError if there was a concurrent update to the blueprint spec or other resources or returns a domainservice.InternalError if there was an unspecified error while collecting or modifying the ecosystem state. There is no error, if the ecosystem is unhealthy as this gets reflected in the blueprint spec status.

func (*ApplyBlueprintSpecUseCase) CheckEcosystemHealthAfterwards

func (useCase *ApplyBlueprintSpecUseCase) CheckEcosystemHealthAfterwards(ctx context.Context, blueprintId string) error

CheckEcosystemHealthAfterwards waits for a healthy ecosystem health after applying the blueprint and sets the related status in the blueprint. Returns domainservice.ConflictError if there was a concurrent update to the blueprint spec or returns a domainservice.InternalError if there was an unspecified error while collecting or modifying the ecosystem state. There is no error, if the ecosystem is unhealthy as this gets reflected in the blueprint spec status.

func (*ApplyBlueprintSpecUseCase) CheckEcosystemHealthUpfront

func (useCase *ApplyBlueprintSpecUseCase) CheckEcosystemHealthUpfront(ctx context.Context, blueprintId string) error

CheckEcosystemHealthUpfront checks the ecosystem health before applying the blueprint and sets the related status in the blueprint. Returns domainservice.ConflictError if there was a concurrent update to the blueprint spec or returns a domainservice.InternalError if there was an unspecified error while collecting or modifying the ecosystem state or There is no error, if the ecosystem is unhealthy as this gets reflected in the blueprint spec status.

func (*ApplyBlueprintSpecUseCase) PostProcessBlueprintApplication

func (useCase *ApplyBlueprintSpecUseCase) PostProcessBlueprintApplication(ctx context.Context, blueprintId string) error

PostProcessBlueprintApplication makes changes to the environment after applying the blueprint, e.g. deactivating the maintenance mode. returns a domainservice.ConflictError if another party holds the lock to the maintenance mode or returns a domainservice.InternalError on any other error.

func (*ApplyBlueprintSpecUseCase) PreProcessBlueprintApplication

func (useCase *ApplyBlueprintSpecUseCase) PreProcessBlueprintApplication(ctx context.Context, blueprintId string) error

PreProcessBlueprintApplication prepares the environment for applying the blueprint, e.g. activating the maintenance mode. returns a domainservice.ConflictError if another party activated the maintenance mode or returns a domainservice.InternalError on any other error.

type BlueprintSpecChangeUseCase

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

func NewBlueprintSpecChangeUseCase

func NewBlueprintSpecChangeUseCase(
	repo domainservice.BlueprintSpecRepository,
	validation blueprintSpecValidationUseCase,
	effectiveBlueprint effectiveBlueprintUseCase,
	stateDiff stateDiffUseCase,
	applyUseCase applyBlueprintSpecUseCase,
	doguConfigUseCase registryConfigUseCase,
	doguRestartUseCase doguRestartUseCase,
	selfUpgradeUseCase selfUpgradeUseCase,

) *BlueprintSpecChangeUseCase

func (*BlueprintSpecChangeUseCase) HandleChange

func (useCase *BlueprintSpecChangeUseCase) HandleChange(ctx context.Context, blueprintId string) error

HandleChange further executes a blueprint spec given by the blueprintId until it is fully applied or an error occurred. Returns a domainservice.NotFoundError if the blueprintId does not correspond to a blueprintSpec or a domainservice.InternalError if there is any error while loading or persisting the blueprintSpec or a domainservice.ConflictError if there was a concurrent write or a domain.InvalidBlueprintError if the blueprint is invalid.

type BlueprintSpecValidationUseCase

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

func (*BlueprintSpecValidationUseCase) ValidateBlueprintSpecDynamically

func (useCase *BlueprintSpecValidationUseCase) ValidateBlueprintSpecDynamically(ctx context.Context, blueprintId string) error

ValidateBlueprintSpecDynamically checks the blueprintSpec for semantic errors in combination with external data like dogu specs. returns a domain.InvalidBlueprintError if blueprint is invalid or a domainservice.NotFoundError if the blueprintId does not correspond to a blueprintSpec or a domainservice.InternalError if there is any error while loading or persisting the blueprintSpec or a domainservice.ConflictError if there was a concurrent write.

func (*BlueprintSpecValidationUseCase) ValidateBlueprintSpecStatically

func (useCase *BlueprintSpecValidationUseCase) ValidateBlueprintSpecStatically(ctx context.Context, blueprintId string) error

ValidateBlueprintSpecStatically checks the blueprintSpec for semantic errors and persists it. returns a domain.InvalidBlueprintError if blueprint is invalid or a domainservice.NotFoundError if the blueprintId does not correspond to a blueprintSpec or a domainservice.InternalError if there is any error while loading or persisting the blueprintSpec or a domainservice.ConflictError if there was a concurrent write.

type ComponentInstallationUseCase

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

func NewComponentInstallationUseCase

func NewComponentInstallationUseCase(
	blueprintSpecRepo domainservice.BlueprintSpecRepository,
	componentRepo domainservice.ComponentInstallationRepository,
	healthConfigProvider healthConfigProvider,
) *ComponentInstallationUseCase

func (*ComponentInstallationUseCase) ApplyComponentStates

func (useCase *ComponentInstallationUseCase) ApplyComponentStates(ctx context.Context, blueprintId string) error

ApplyComponentStates applies the expected component state from the Blueprint to the ecosystem. Fail-fast here, so that the possible damage is as small as possible.

func (*ComponentInstallationUseCase) CheckComponentHealth

func (useCase *ComponentInstallationUseCase) CheckComponentHealth(ctx context.Context) (ecosystem.ComponentHealthResult, error)

func (*ComponentInstallationUseCase) WaitForHealthyComponents

func (useCase *ComponentInstallationUseCase) WaitForHealthyComponents(ctx context.Context) (ecosystem.ComponentHealthResult, error)

type DoguInstallationUseCase

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

func (*DoguInstallationUseCase) ApplyDoguStates

func (useCase *DoguInstallationUseCase) ApplyDoguStates(ctx context.Context, blueprintId string) error

ApplyDoguStates applies the expected dogu state from the Blueprint to the ecosystem. Fail-fast here, so that the possible damage is as small as possible.

func (*DoguInstallationUseCase) CheckDoguHealth

func (useCase *DoguInstallationUseCase) CheckDoguHealth(ctx context.Context) (ecosystem.DoguHealthResult, error)

func (*DoguInstallationUseCase) WaitForHealthyDogus

func (useCase *DoguInstallationUseCase) WaitForHealthyDogus(ctx context.Context) (ecosystem.DoguHealthResult, error)

type DoguRestartUseCase added in v1.0.0

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

func NewDoguRestartUseCase added in v1.0.0

func NewDoguRestartUseCase(doguInstallationRepository doguInstallationRepository, blueprintSpecRepo blueprintSpecRepository, restartRepository doguRestartRepository) *DoguRestartUseCase

func (*DoguRestartUseCase) TriggerDoguRestarts added in v1.0.0

func (useCase *DoguRestartUseCase) TriggerDoguRestarts(ctx context.Context, blueprintId string) error

type EcosystemConfigUseCase

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

func NewEcosystemConfigUseCase

func NewEcosystemConfigUseCase(blueprintRepository blueprintSpecRepository, doguConfigRepository doguConfigEntryRepository, doguSensitiveConfigRepository sensitiveDoguConfigEntryRepository, globalConfigRepository globalConfigEntryRepository, encryptionAdapter configEncryptionAdapter) *EcosystemConfigUseCase

func (*EcosystemConfigUseCase) ApplyConfig

func (useCase *EcosystemConfigUseCase) ApplyConfig(ctx context.Context, blueprintId string) error

ApplyConfig fetches the dogu and global config statediff of the blueprint and applies these keys to the repositories.

type EcosystemHealthUseCase

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

func NewEcosystemHealthUseCase

func NewEcosystemHealthUseCase(
	doguUseCase doguInstallationUseCase,
	componentUseCase componentInstallationUseCase,
	waitConfigProvider domainservice.HealthWaitConfigProvider,
) *EcosystemHealthUseCase

func (*EcosystemHealthUseCase) CheckEcosystemHealth

func (useCase *EcosystemHealthUseCase) CheckEcosystemHealth(ctx context.Context, ignoreDoguHealth bool, ignoreComponentHealth bool) (ecosystem.HealthResult, error)

CheckEcosystemHealth checks the ecosystem health once. Returns a HealthResult even if parts are unhealthy or returns an error if the health state could not be fetched.

func (*EcosystemHealthUseCase) WaitForHealthyEcosystem

func (useCase *EcosystemHealthUseCase) WaitForHealthyEcosystem(ctx context.Context) (ecosystem.HealthResult, error)

WaitForHealthyEcosystem waits for a healthy ecosystem and returns an HealthResult.

type EffectiveBlueprintUseCase

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

func NewEffectiveBlueprintUseCase

func NewEffectiveBlueprintUseCase(blueprintSpecRepo domainservice.BlueprintSpecRepository) *EffectiveBlueprintUseCase

func (*EffectiveBlueprintUseCase) CalculateEffectiveBlueprint

func (useCase *EffectiveBlueprintUseCase) CalculateEffectiveBlueprint(ctx context.Context, blueprintId string) error

CalculateEffectiveBlueprint loads the blueprintSpec, lets it calculate the effective blueprint and persists it again. returns a domainservice.NotFoundError if the blueprintId does not correspond to a blueprintSpec or a domainservice.InternalError if there is any error while loading or persisting the blueprintSpec or a domainservice.ConflictError if there was a concurrent write.

type SelfUpgradeUseCase

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

func NewSelfUpgradeUseCase

func NewSelfUpgradeUseCase(
	blueprintRepo domainservice.BlueprintSpecRepository,
	componentRepo componentInstallationRepository,
	componentUseCase componentInstallationUseCase,
	blueprintOperatorName common.SimpleComponentName,
	healthConfigProvider healthConfigProvider,
) *SelfUpgradeUseCase

func (*SelfUpgradeUseCase) HandleSelfUpgrade

func (useCase *SelfUpgradeUseCase) HandleSelfUpgrade(ctx context.Context, blueprintId string) error

HandleSelfUpgrade checks if a self upgrade is necessary, executes all needed steps and can check if the self upgrade was successful after a restart. It always sets the fitting status in the blueprint spec.

type StateDiffUseCase

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

func NewStateDiffUseCase

func NewStateDiffUseCase(
	blueprintSpecRepo domainservice.BlueprintSpecRepository,
	doguInstallationRepo domainservice.DoguInstallationRepository,
	componentInstallationRepo domainservice.ComponentInstallationRepository,
	globalConfigRepo domainservice.GlobalConfigEntryRepository,
	doguConfigRepo domainservice.DoguConfigEntryRepository,
	sensitiveDoguConfigRepo domainservice.SensitiveDoguConfigEntryRepository,
	encryptionAdapter configEncryptionAdapter,
) *StateDiffUseCase

func (*StateDiffUseCase) DetermineStateDiff

func (useCase *StateDiffUseCase) DetermineStateDiff(ctx context.Context, blueprintId string) error

DetermineStateDiff loads the state of the ecosystem and compares it to the blueprint. It creates a declarative diff. returns:

  • a domainservice.NotFoundError if the blueprint was not found or could not found dogu decryption keys or
  • a domainservice.InternalError if there is any error while loading or persisting the blueprintSpec or while collecting the ecosystem state or
  • a domainservice.ConflictError if there was a concurrent write to the blueprint or
  • a domain.InvalidBlueprintError if there are any forbidden actions in the stateDiff.
  • any error if there is any other error.

Jump to

Keyboard shortcuts

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