Help us shape the future of Go! Take the 2026 Go Developer Survey

runtime

package
v0.4.19 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogCollectionSyslog   = runtimecontract.LogCollectionSyslog
	LogCollectionJournald = runtimecontract.LogCollectionJournald
)
View Source
const (
	ProviderDocker     = runtimecontract.ProviderDocker
	ProviderPodman     = runtimecontract.ProviderPodman
	ProviderKubernetes = runtimecontract.ProviderKubernetes
	ProviderOpenShift  = runtimecontract.ProviderOpenShift
)
View Source
const (
	CapabilityWorkloadLifecycle = runtimecontract.CapabilityWorkloadLifecycle
	CapabilityServiceExec       = runtimecontract.CapabilityServiceExec
	CapabilityPublishedPorts    = runtimecontract.CapabilityPublishedPorts
	CapabilityResourceOwnership = runtimecontract.CapabilityResourceOwnership
)
View Source
const (
	DefaultPostgresPort = 5432
	DefaultOpenBaoPort  = 8200
)
View Source
const RuntimeProviderContractVersion = runtimecontract.RuntimeProviderContractVersion

Variables

View Source
var ErrResourceOwnership = errors.New("runtime resource ownership does not match the application project")
View Source
var ErrRuntimeNotFound = errors.New("container runtime orchestration not found")

Functions

func ApplicationProjectName added in v0.4.16

func ApplicationProjectName(namespace, application, environment string) string

ApplicationProjectName returns the operator-visible Compose project for one application on a target. Empty namespace means the implicit local target.

func CacheProjectEnvironment added in v0.4.17

func CacheProjectEnvironment(project string, environment map[string]string)

func ClearProjectEnvironment added in v0.4.17

func ClearProjectEnvironment(project string)

func ControlPlaneNetworkName added in v0.4.17

func ControlPlaneNetworkName(resourceProject string) string

func ControlPlaneServiceAccessNeedsBootstrapRestart added in v0.4.17

func ControlPlaneServiceAccessNeedsBootstrapRestart(files Files) (bool, error)

func DataDir added in v0.4.2

func DataDir(stateDir string) (string, error)

DataDir resolves the BaseHarbor data root that owns runtime-global metadata. Explicit state-directory overrides remain self-contained. Without an override, metadata is stored beside runtime/ so creating it cannot change legacy/global runtime selection.

func EnsureServiceAccess added in v0.4.15

func EnsureServiceAccess(ctx context.Context, issuer serviceaccess.Issuer, files Files) error

func IsPortBindingConflict

func IsPortBindingConflict(err error) bool

IsPortBindingConflict reports whether a Docker Compose or Podman runtime failure is a host-port allocation conflict. Runtime engines phrase the same condition differently, so keep the classifier deliberately narrow but multi-engine.

func RequireCapabilities added in v0.4.0

func RequireCapabilities(provider Provider, required ...RuntimeCapability) error

func SharedProjectName added in v0.4.16

func SharedProjectName(namespace string) string

SharedProjectName returns the operator-visible Compose project for target-wide BaseHarbor platform services. Empty namespace means the implicit local target.

func SharedResourceProjectName added in v0.4.16

func SharedResourceProjectName(namespace string) string

SharedResourceProjectName returns the stable physical resource prefix for target-wide platform resources. It is intentionally independent from the operator-visible consolidated Compose project name.

func StateDir added in v0.4.2

func StateDir(stateDir string) (string, error)

StateDir resolves the authoritative BaseHarbor runtime state directory without mutating it.

func TakeProjectEnvironment added in v0.4.17

func TakeProjectEnvironment(project string) map[string]string

Types

type Compose

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

Compose provides the small lifecycle surface BaseHarbor needs from a container runtime. Application code should not shell out to Docker/Podman directly.

func NewCLIBackend added in v0.4.17

func NewCLIBackend(command string, prefix ...string) Compose

func (Compose) BuildProjectFilesSelectedProgress added in v0.4.15

func (c Compose) BuildProjectFilesSelectedProgress(ctx context.Context, project, workdir string, environment map[string]string, services []string, onProgress func(string), composeFiles ...string) error

func (Compose) CommandPath added in v0.4.17

func (c Compose) CommandPath() string

func (Compose) Config

func (c Compose) Config(ctx context.Context, composeFile, envFile string) error

func (Compose) ConfigJSONProjectFilesEnv

func (c Compose) ConfigJSONProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) (string, error)

func (Compose) ConfigProject

func (c Compose) ConfigProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) ConfigProjectFiles

func (c Compose) ConfigProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error

func (Compose) ConfigProjectFilesEnv

func (c Compose) ConfigProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) error

func (Compose) ConnectManagedNetwork added in v0.4.8

func (c Compose) ConnectManagedNetwork(ctx context.Context, network, container, alias string) error

func (Compose) ContainerExposedTCPPorts added in v0.4.8

func (c Compose) ContainerExposedTCPPorts(ctx context.Context, container string) ([]int, error)

func (Compose) ContainerHealthStatus added in v0.4.8

func (c Compose) ContainerHealthStatus(ctx context.Context, container string) (string, error)

func (Compose) ContainerLogConfigProjectService added in v0.4.16

func (c Compose) ContainerLogConfigProjectService(ctx context.Context, project, service string) (string, string, error)

ContainerLogConfigProjectService returns the runtime logging driver and tag for the running container that belongs to an exact Compose project/service.

func (Compose) ContainerNetworks added in v0.4.8

func (c Compose) ContainerNetworks(ctx context.Context, container string) ([]string, error)

func (Compose) DestroyOwnedProjectResources added in v0.4.11

func (c Compose) DestroyOwnedProjectResources(ctx context.Context, project string, resources []ProjectResource) error

func (Compose) DestroyProject

func (c Compose) DestroyProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) DestroyProjectRemoveOrphans added in v0.4.4

func (c Compose) DestroyProjectRemoveOrphans(ctx context.Context, project, composeFile, envFile string) error

func (Compose) DiagnosticsProject added in v0.4.9

func (c Compose) DiagnosticsProject(ctx context.Context, project, composeFile, envFile string) string

DiagnosticsProject captures stopped/restarting containers and recent logs before a fail-closed lifecycle rollback removes provider resources.

func (Compose) DirectOutput added in v0.4.17

func (c Compose) DirectOutput(ctx context.Context, args ...string) (string, error)

func (Compose) DisconnectManagedNetwork added in v0.4.8

func (c Compose) DisconnectManagedNetwork(ctx context.Context, network, container string) error

func (Compose) Down

func (c Compose) Down(ctx context.Context, composeFile, envFile string) error

func (Compose) DownProject

func (c Compose) DownProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) DownProjectFiles

func (c Compose) DownProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error

func (Compose) DownProjectFilesEnv

func (c Compose) DownProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) error

func (Compose) DownProjectRemoveOrphans added in v0.4.4

func (c Compose) DownProjectRemoveOrphans(ctx context.Context, project, composeFile, envFile string) error

func (Compose) EnsureManagedNetwork added in v0.4.8

func (c Compose) EnsureManagedNetwork(ctx context.Context, name string) error

func (Compose) EnsureOwnedVolume added in v0.4.16

func (c Compose) EnsureOwnedVolume(ctx context.Context, project, volume string) error

func (Compose) ExecProject

func (c Compose) ExecProject(ctx context.Context, project, composeFile, envFile, service string, args ...string) (string, error)

func (Compose) ExecProjectFiles

func (c Compose) ExecProjectFiles(ctx context.Context, project, workdir, service string, composeFiles []string, args ...string) (string, error)

func (Compose) ExecProjectFilesInput added in v0.4.15

func (c Compose) ExecProjectFilesInput(ctx context.Context, project, workdir, service string, composeFiles []string, input []byte, args ...string) (string, error)

func (Compose) ExecProjectInput

func (c Compose) ExecProjectInput(ctx context.Context, project, composeFile, envFile string, input []byte, service string, args ...string) (string, error)

ExecProjectInput executes a command inside a Compose service while supplying stdin without placing that input in the host process argument list. It is intended for sensitive operator flows such as OpenBao unseal/authentication.

func (Compose) ExportOwnedVolume added in v0.4.16

func (c Compose) ExportOwnedVolume(ctx context.Context, project, volume string) ([]byte, error)

func (Compose) InspectProjectResource

func (c Compose) InspectProjectResource(ctx context.Context, project string, resource ProjectResource) (bool, error)

InspectProjectResource verifies an exact runtime resource name before a destructive operation. A resource with the expected name but a different Compose project label is an ownership conflict, never an implicit match.

func (Compose) InspectProjectResources added in v0.4.15

func (c Compose) InspectProjectResources(ctx context.Context, project string, resources []ProjectResource) ([]ProjectResource, error)

InspectProjectResources verifies runtime resource existence and ownership in batches by kind. This keeps ownership fail-closed while avoiding repeated list/inspect round-trips on Podman.

func (Compose) ListOwnedProjectResources added in v0.4.18

func (c Compose) ListOwnedProjectResources(ctx context.Context, project string) ([]ProjectResource, error)

func (Compose) ListRuntimeContainers added in v0.4.17

func (c Compose) ListRuntimeContainers(ctx context.Context) ([]RuntimeContainer, error)

func (Compose) LogCollectionMode added in v0.4.17

func (Compose) LogCollectionMode() LogCollectionMode

func (Compose) LogsProject added in v0.4.9

func (c Compose) LogsProject(ctx context.Context, project, composeFile, envFile string, services ...string) (string, error)

func (Compose) LogsProjectFilesEnv added in v0.4.19

func (c Compose) LogsProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, services []string, composeFiles ...string) (string, error)

func (Compose) NetworkProjectOwner added in v0.4.8

func (c Compose) NetworkProjectOwner(ctx context.Context, network string) (string, error)

func (Compose) ProjectServiceImageIdentity added in v0.4.15

func (c Compose) ProjectServiceImageIdentity(ctx context.Context, project, service string) (ImageIdentity, error)

func (Compose) ProjectServiceLogDriver added in v0.4.16

func (c Compose) ProjectServiceLogDriver(ctx context.Context, project, service string) (string, error)

func (Compose) PullImage added in v0.4.15

func (c Compose) PullImage(ctx context.Context, image string) error

func (Compose) RemoveManagedNetwork added in v0.4.8

func (c Compose) RemoveManagedNetwork(ctx context.Context, name string) error

func (Compose) RemoveProjectServices added in v0.4.17

func (c Compose) RemoveProjectServices(ctx context.Context, project string, services ...string) error

RemoveProjectServices removes only containers whose runtime ownership labels match the exact project and one of the requested legacy service names. It is intentionally narrower than compose --remove-orphans so consolidated bh-* projects cannot prune sibling modules.

func (Compose) RestoreOwnedVolume added in v0.4.16

func (c Compose) RestoreOwnedVolume(ctx context.Context, project, volume string, archive []byte) error

func (Compose) RunProjectFilesEnv added in v0.3.0

func (c Compose) RunProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, stdin io.Reader, stdout, stderr io.Writer, composeFiles []string, args ...string) error

RunProjectFilesEnv runs a workload command with caller-owned streams through Docker Compose. Podman owns the equivalent operation in PodmanProvider.

func (Compose) RunningServicesProject

func (c Compose) RunningServicesProject(ctx context.Context, project, composeFile, envFile string) ([]string, error)

func (Compose) RunningServicesProjectFiles

func (c Compose) RunningServicesProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) ([]string, error)

func (Compose) RunningServicesProjectFilesEnv

func (c Compose) RunningServicesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) ([]string, error)

func (Compose) ServiceStatesFromRuntimeLabels added in v0.4.17

func (c Compose) ServiceStatesFromRuntimeLabels(ctx context.Context, project string) ([]ServiceState, error)

func (Compose) ServiceStatesProjectFilesEnv added in v0.3.0

func (c Compose) ServiceStatesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) ([]ServiceState, error)

ServiceStatesProjectFilesEnv returns Compose service state without exposing generated container names to application code. Modern Compose implementations expose JSON state including container health and published ports. Older compatible implementations fall back to the portable running-service query; in that case Health and Publishers remain empty rather than inventing state.

func (Compose) ServicesProjectFiles

func (c Compose) ServicesProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) ([]string, error)

func (Compose) ServicesProjectFilesEnv

func (c Compose) ServicesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) ([]string, error)

func (Compose) Status

func (c Compose) Status(ctx context.Context, composeFile, envFile string) (string, error)

func (Compose) StatusProject

func (c Compose) StatusProject(ctx context.Context, project, composeFile, envFile string) (string, error)

func (Compose) StatusProjectFiles

func (c Compose) StatusProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) (string, error)

func (Compose) StopOwnedProjectContainers added in v0.4.18

func (c Compose) StopOwnedProjectContainers(ctx context.Context, project string) error

func (Compose) StopProject added in v0.4.8

func (c Compose) StopProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) StopProjectFilesSelected

func (c Compose) StopProjectFilesSelected(ctx context.Context, project, workdir string, environment map[string]string, services []string, composeFiles ...string) error

func (Compose) Up

func (c Compose) Up(ctx context.Context, composeFile, envFile string) error

func (Compose) UpProject

func (c Compose) UpProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) UpProjectFiles

func (c Compose) UpProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error

func (Compose) UpProjectFilesSelected

func (c Compose) UpProjectFilesSelected(ctx context.Context, project, workdir string, environment map[string]string, services []string, composeFiles ...string) error

func (Compose) UpProjectFilesSelectedForceRecreateNoBuild added in v0.4.15

func (c Compose) UpProjectFilesSelectedForceRecreateNoBuild(ctx context.Context, project, workdir string, environment map[string]string, services []string, composeFiles ...string) error

func (Compose) UpProjectFilesSelectedNoBuildProgress added in v0.4.15

func (c Compose) UpProjectFilesSelectedNoBuildProgress(ctx context.Context, project, workdir string, environment map[string]string, services []string, onProgress func(string), composeFiles ...string) error

func (Compose) UpProjectFilesSelectedProgress added in v0.4.11

func (c Compose) UpProjectFilesSelectedProgress(ctx context.Context, project, workdir string, environment map[string]string, services []string, onProgress func(string), composeFiles ...string) error

func (Compose) UpProjectProgress added in v0.4.11

func (c Compose) UpProjectProgress(ctx context.Context, project, composeFile, envFile string, onProgress func(string)) error

func (Compose) VerifyProjectServiceLogCollection added in v0.4.17

func (c Compose) VerifyProjectServiceLogCollection(ctx context.Context, project, service, expectedTag string) error

VerifyProjectServiceLogCollection keeps runtime-product verification behind the runtime provider boundary. Docker verifies the configured syslog driver and tag. Podman/Quadlet uses journald and has no equivalent Compose log-tag contract to assert here.

type Config

type Config struct {
	PostgresDB        string
	PostgresUser      string
	PostgresPassword  string
	OpenBaoDBPassword string
	PostgresPort      int
	OpenBaoPort       int
}

func LoadConfig

func LoadConfig(envPath string) (Config, error)

type Files

type Files struct {
	Compose         string
	Env             string
	Project         string
	ResourceProject string
}

func EnsureFiles

func EnsureFiles(stateDir string) (Files, error)

func EnsureFilesForProject added in v0.4.15

func EnsureFilesForProject(stateDir, project string, ports Ports) (Files, error)

func EnsureFilesForProjectAndResources added in v0.4.16

func EnsureFilesForProjectAndResources(stateDir, project, resourceProject string, ports Ports) (Files, error)

func EnsureFilesWithPorts

func EnsureFilesWithPorts(stateDir string, ports Ports) (Files, error)

func ExistingFiles

func ExistingFiles(stateDir string) (Files, error)

func ExistingFilesForProject added in v0.4.15

func ExistingFilesForProject(stateDir, project string) (Files, error)

type ImageIdentity added in v0.4.15

type ImageIdentity = runtimecontract.ImageIdentity

type LogCollectionMode added in v0.4.17

type LogCollectionMode = runtimecontract.LogCollectionMode

type LogSourceAdapter added in v0.4.17

type LogSourceAdapter = runtimecontract.LogSourceAdapter

type Ports

type Ports struct {
	Postgres int
	OpenBao  int
}

type ProjectResource

type ProjectResource = runtimecontract.ProjectResource

type Provider added in v0.4.0

type Provider = runtimecontract.Provider

type ProviderCapabilities added in v0.4.0

type ProviderCapabilities = runtimecontract.ProviderCapabilities

type ProviderDescriptor added in v0.4.17

type ProviderDescriptor = runtimecontract.ProviderDescriptor

type ProviderFactory added in v0.4.17

type ProviderFactory = runtimecontract.ProviderFactory

type ProviderKind added in v0.4.0

type ProviderKind = runtimecontract.ProviderKind

func ParseProviderKind added in v0.4.0

func ParseProviderKind(value string) (ProviderKind, error)

type ProviderRegistration added in v0.4.17

type ProviderRegistration = runtimecontract.ProviderRegistration

type ProviderRegistry added in v0.4.17

type ProviderRegistry = runtimecontract.ProviderRegistry

func NewProviderRegistry added in v0.4.17

func NewProviderRegistry(registrations ...ProviderRegistration) (*ProviderRegistry, error)

type PublishedPort added in v0.3.0

type PublishedPort = runtimecontract.PublishedPort

type RuntimeCapability added in v0.4.0

type RuntimeCapability = runtimecontract.RuntimeCapability

type RuntimeContainer added in v0.4.17

type RuntimeContainer = runtimecontract.RuntimeContainer

type RuntimeProvider added in v0.4.17

type RuntimeProvider = runtimecontract.RuntimeProvider

type ServiceState added in v0.3.0

type ServiceState = runtimecontract.ServiceState

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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