ecosystem

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ComponentStatusNotInstalled represents a status for a component that is not installed
	ComponentStatusNotInstalled = ""
	// ComponentStatusInstalling represents a status for a component that is currently being installed
	ComponentStatusInstalling = "installing"
	// ComponentStatusUpgrading represents a status for a component that is currently being upgraded
	ComponentStatusUpgrading = "upgrading"
	// ComponentStatusDeleting represents a status for a component that is currently being deleted
	ComponentStatusDeleting = "deleting"
	ComponentStatusIgnored  = "ignored"
	// ComponentStatusInstalled represents a status for a component that was successfully installed
	ComponentStatusInstalled = "installed"
	// ComponentStatusTryToInstall represents a status for a component that is not installed but its install process is in requeue loop.
	ComponentStatusTryToInstall = "tryToInstall"
	// ComponentStatusTryToUpgrade represents a status for a component that is installed but its actual upgrade process is in requeue loop.
	// In this state the component can be healthy but the version in the spec is not installed.
	ComponentStatusTryToUpgrade = "tryToUpgrade"
	// ComponentStatusTryToDelete represents a status for a component that is installed but its delete process is in requeue loop.
	// In this state the component can be healthy.
	ComponentStatusTryToDelete = "tryToDelete"
)
View Source
const (
	DoguStatusNotInstalled = ""
	DoguStatusInstalling   = "installing"
	DoguStatusUpgrading    = "upgrading"
	DoguStatusDeleting     = "deleting"
	DoguStatusInstalled    = "installed"
	DoguStatusPVCResizing  = "resizing PVC"
)
View Source
const (
	NginxIngressAnnotationBodySize         = "nginx.ingress.kubernetes.io/proxy-body-size"
	NginxIngressAnnotationRewriteTarget    = "nginx.ingress.kubernetes.io/rewrite-target"
	NginxIngressAnnotationAdditionalConfig = "nginx.ingress.kubernetes.io/configuration-snippet"
)

Specific Nginx annotations. In future those annotations will be replaced be generalized fields in the dogu cr. The dogu-operator or service-discovery will interpret them.

Variables

This section is empty.

Functions

func GetQuantityReference

func GetQuantityReference(quantityStr string) (*resource.Quantity, error)

func GetQuantityString

func GetQuantityString(quantity *resource.Quantity) string

Types

type AdditionalConfig

type AdditionalConfig string

type BodySize

type BodySize = resource.Quantity

type ComponentHealthResult

type ComponentHealthResult struct {
	ComponentsByStatus map[HealthStatus][]common.SimpleComponentName
}

ComponentHealthResult is a snapshot of all components' health states.

func CalculateComponentHealthResult

func CalculateComponentHealthResult(installedComponents map[common.SimpleComponentName]*ComponentInstallation, requiredComponents []RequiredComponent) ComponentHealthResult

CalculateComponentHealthResult checks if all required components are installed, collects the health states from ComponentInstallation and creates a ComponentHealthResult.

func (ComponentHealthResult) AllHealthy

func (result ComponentHealthResult) AllHealthy() bool

func (ComponentHealthResult) String

func (result ComponentHealthResult) String() string

type ComponentInstallation

type ComponentInstallation struct {
	// Name identifies the component by simple dogu name and namespace, e.g 'k8s/k8s-dogu-operator'.
	Name common.QualifiedComponentName
	// ExpectedVersion is the version of the component which should be installed
	ExpectedVersion *semver.Version
	// ActualVersion is the version of the component which is actually installed
	ActualVersion *semver.Version
	// Status is the installation status of the component in the ecosystem
	Status string
	// Health is the current health status of the component in the ecosystem
	Health HealthStatus
	// PersistenceContext can hold generic values needed for persistence with repositories, e.g. version counters or transaction contexts.
	// This field has a generic map type as the values within it highly depend on the used type of repository.
	// This field should be ignored in the whole domain.
	PersistenceContext map[string]interface{}
	DeployConfig       DeployConfig
}

ComponentInstallation represents an installed or to be installed component in the ecosystem.

func InstallComponent

func InstallComponent(
	componentName common.QualifiedComponentName,
	expectedVersion *semver.Version,
	deployConfig DeployConfig,
) *ComponentInstallation

InstallComponent is a factory for new ComponentInstallation's.

func (*ComponentInstallation) UpdateDeployConfig

func (ci *ComponentInstallation) UpdateDeployConfig(deployConfig DeployConfig)

func (*ComponentInstallation) Upgrade

func (ci *ComponentInstallation) Upgrade(expectedVersion *semver.Version)

type DeployConfig

type DeployConfig map[string]interface{}

type DoguConfigEntry

type DoguConfigEntry struct {
	Key   common.DoguConfigKey
	Value common.DoguConfigValue
	// PersistenceContext can hold generic values needed for persistence with repositories, e.g. version counters or transaction contexts.
	// This field has a generic map type as the values within it highly depend on the used type of repository.
	// This field should be ignored in the whole domain.
	PersistenceContext interface{}
}

type DoguHealthResult

type DoguHealthResult struct {
	DogusByStatus map[HealthStatus][]common.SimpleDoguName
}

DoguHealthResult is a snapshot of the health states of all dogus.

func CalculateDoguHealthResult

func CalculateDoguHealthResult(dogus []*DoguInstallation) DoguHealthResult

CalculateDoguHealthResult collects the health states from DoguInstallation and creates a DoguHealthResult.

func (DoguHealthResult) AllHealthy

func (result DoguHealthResult) AllHealthy() bool

func (DoguHealthResult) String

func (result DoguHealthResult) String() string

type DoguInstallation

type DoguInstallation struct {
	// Name identifies the dogu by simple dogu name and namespace.
	Name common.QualifiedDoguName
	// Version is the version of the dogu
	Version core.Version
	// Status is the installation status of the dogu in the ecosystem
	Status string
	// Health is the current health status of the dogu in the ecosystem
	Health HealthStatus
	// UpgradeConfig contains configuration for dogu upgrades
	UpgradeConfig UpgradeConfig
	// PersistenceContext can hold generic values needed for persistence with repositories, e.g. version counters or transaction contexts.
	// This field has a generic map type as the values within it highly depend on the used type of repository.
	// This field should be ignored in the whole domain.
	PersistenceContext map[string]interface{}
	// MinVolumeSize is the minimum storage of the dogu. This field is optional and can be nil to indicate that no
	// storage is needed.
	MinVolumeSize *VolumeSize
	// ReverseProxyConfig defines configuration for the ecosystem reverse proxy. This field is optional.
	ReverseProxyConfig ReverseProxyConfig
}

DoguInstallation represents an installed or to be installed dogu in the ecosystem.

func InstallDogu

func InstallDogu(name common.QualifiedDoguName, version core.Version, minVolumeSize *VolumeSize, reverseProxyConfig ReverseProxyConfig) *DoguInstallation

InstallDogu is a factory for new DoguInstallation's.

func (*DoguInstallation) IsHealthy

func (dogu *DoguInstallation) IsHealthy() bool

func (*DoguInstallation) SwitchNamespace

func (dogu *DoguInstallation) SwitchNamespace(newNamespace common.DoguNamespace, isNamespaceSwitchAllowed bool) error

func (*DoguInstallation) UpdateMinVolumeSize

func (dogu *DoguInstallation) UpdateMinVolumeSize(size *VolumeSize)

func (*DoguInstallation) UpdateProxyAdditionalConfig

func (dogu *DoguInstallation) UpdateProxyAdditionalConfig(value AdditionalConfig)

func (*DoguInstallation) UpdateProxyBodySize

func (dogu *DoguInstallation) UpdateProxyBodySize(value *BodySize)

func (*DoguInstallation) UpdateProxyRewriteTarget

func (dogu *DoguInstallation) UpdateProxyRewriteTarget(value RewriteTarget)

func (*DoguInstallation) Upgrade

func (dogu *DoguInstallation) Upgrade(newVersion core.Version)

type EcosystemState

type EcosystemState struct {
	InstalledDogus               map[common.SimpleDoguName]*DoguInstallation
	InstalledComponents          map[common.SimpleComponentName]*ComponentInstallation
	GlobalConfig                 map[common.GlobalConfigKey]*GlobalConfigEntry
	DoguConfig                   map[common.DoguConfigKey]*DoguConfigEntry
	EncryptedDoguConfig          map[common.SensitiveDoguConfigKey]*SensitiveDoguConfigEntry
	DecryptedSensitiveDoguConfig map[common.SensitiveDoguConfigKey]common.SensitiveDoguConfigValue
}

func (EcosystemState) GetInstalledDoguNames

func (state EcosystemState) GetInstalledDoguNames() []common.SimpleDoguName

type GlobalConfigEntry

type GlobalConfigEntry struct {
	Key   common.GlobalConfigKey
	Value common.GlobalConfigValue
	// PersistenceContext can hold generic values needed for persistence with repositories, e.g. version counters or transaction contexts.
	// This field has a generic map type as the values within it highly depend on the used type of repository.
	// This field should be ignored in the whole domain.
	PersistenceContext interface{}
}

type HealthResult

type HealthResult struct {
	DoguHealth      DoguHealthResult
	ComponentHealth ComponentHealthResult
}

HealthResult is a snapshot of the health states of all relevant parts of the running ecosystem.

func (HealthResult) AllHealthy

func (result HealthResult) AllHealthy() bool

func (HealthResult) String

func (result HealthResult) String() string

type HealthStatus

type HealthStatus = string
const (
	PendingHealthStatus      HealthStatus = ""
	AvailableHealthStatus    HealthStatus = "available"
	UnavailableHealthStatus  HealthStatus = "unavailable"
	NotInstalledHealthStatus HealthStatus = "not installed"
)

type RegistryConfigEntry

type RegistryConfigEntry interface {
	*GlobalConfigEntry | *DoguConfigEntry | *SensitiveDoguConfigEntry
}

type RequiredComponent

type RequiredComponent struct {
	Name common.SimpleComponentName
}

type ReverseProxyConfig

type ReverseProxyConfig struct {
	MaxBodySize      *BodySize
	RewriteTarget    RewriteTarget
	AdditionalConfig AdditionalConfig
}

type RewriteTarget

type RewriteTarget string

type SensitiveDoguConfigEntry

type SensitiveDoguConfigEntry struct {
	Key   common.SensitiveDoguConfigKey
	Value common.EncryptedDoguConfigValue
	// PersistenceContext can hold generic values needed for persistence with repositories, e.g. version counters or transaction contexts.
	// This field has a generic map type as the values within it highly depend on the used type of repository.
	// This field should be ignored in the whole domain.
	PersistenceContext interface{}
}

type UpgradeConfig

type UpgradeConfig struct {
	// AllowNamespaceSwitch lets a dogu switch its dogu namespace during an upgrade. The dogu must be technically the
	// same dogu which did reside in a different namespace. The remote dogu's version must be equal to or greater than
	// the version of the local dogu.
	AllowNamespaceSwitch bool `json:"allowNamespaceSwitch,omitempty"`
}

UpgradeConfig contains configuration hints regarding aspects during the upgrade of dogus.

type VolumeSize

type VolumeSize = resource.Quantity

type WaitConfig

type WaitConfig struct {
	Timeout  time.Duration
	Interval time.Duration
}

Jump to

Keyboard shortcuts

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