Documentation
¶
Index ¶
- Constants
- Variables
- func DataDir(stateDir string) (string, error)
- func EnsureServiceAccess(ctx context.Context, issuer serviceaccess.Issuer, files Files) error
- func IsPortBindingConflict(err error) bool
- func QuadletAvailable(ctx context.Context) bool
- func RenderComposeProjectFilesJSON(composePaths []string, environment map[string]string) (string, error)
- func RequireCapabilities(provider Provider, required ...RuntimeCapability) error
- func StateDir(stateDir string) (string, error)
- func WriteQuadletProject(dir string, project QuadletProject) error
- type Compose
- func (c Compose) BuildProjectFilesSelectedProgress(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (Compose) Capabilities() ProviderCapabilities
- func (c Compose) Config(ctx context.Context, composeFile, envFile string) error
- func (c Compose) ConfigJSONProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) (string, error)
- func (c Compose) ConfigProject(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) ConfigProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error
- func (c Compose) ConfigProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) ConnectManagedNetwork(ctx context.Context, network, container, alias string) error
- func (c Compose) ContainerExposedTCPPorts(ctx context.Context, container string) ([]int, error)
- func (c Compose) ContainerHealthStatus(ctx context.Context, container string) (string, error)
- func (c Compose) ContainerNetworks(ctx context.Context, container string) ([]string, error)
- func (c Compose) DestroyOwnedProjectResources(ctx context.Context, project string, resources []ProjectResource) error
- func (c Compose) DestroyProject(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) DestroyProjectRemoveOrphans(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) DiagnosticsProject(ctx context.Context, project, composeFile, envFile string) string
- func (c Compose) DisconnectManagedNetwork(ctx context.Context, network, container string) error
- func (c Compose) Down(ctx context.Context, composeFile, envFile string) error
- func (c Compose) DownProject(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) DownProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error
- func (c Compose) DownProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) DownProjectRemoveOrphans(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) Engine() string
- func (c Compose) EnsureManagedNetwork(ctx context.Context, name string) error
- func (c Compose) ExecProject(ctx context.Context, project, composeFile, envFile, service string, ...) (string, error)
- func (c Compose) ExecProjectFiles(ctx context.Context, project, workdir, service string, composeFiles []string, ...) (string, error)
- func (c Compose) ExecProjectFilesInput(ctx context.Context, project, workdir, service string, composeFiles []string, ...) (string, error)
- func (c Compose) ExecProjectInput(ctx context.Context, project, composeFile, envFile string, input []byte, ...) (string, error)
- func (c Compose) InspectProjectResource(ctx context.Context, project string, resource ProjectResource) (bool, error)
- func (c Compose) InspectProjectResources(ctx context.Context, project string, resources []ProjectResource) ([]ProjectResource, error)
- func (c Compose) Kind() ProviderKind
- func (c Compose) ListComposeContainers(ctx context.Context) ([]ComposeContainer, error)
- func (c Compose) LogsProject(ctx context.Context, project, composeFile, envFile string, services ...string) (string, error)
- func (c Compose) NetworkProjectOwner(ctx context.Context, network string) (string, error)
- func (c Compose) ProjectServiceImageIdentity(ctx context.Context, project, service string) (ImageIdentity, error)
- func (c Compose) PullImage(ctx context.Context, image string) error
- func (c Compose) RemoveManagedNetwork(ctx context.Context, name string) error
- func (c Compose) RunProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) RunningServicesProject(ctx context.Context, project, _, _ string) ([]string, error)
- func (c Compose) RunningServicesProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) ([]string, error)
- func (c Compose) RunningServicesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) ([]string, error)
- func (c Compose) ServiceStatesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) ([]ServiceState, error)
- func (c Compose) ServicesProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) ([]string, error)
- func (c Compose) ServicesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, ...) ([]string, error)
- func (c Compose) Status(ctx context.Context, composeFile, envFile string) (string, error)
- func (c Compose) StatusProject(ctx context.Context, project, composeFile, envFile string) (string, error)
- func (c Compose) StatusProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) (string, error)
- func (c Compose) StopProject(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) StopProjectFilesSelected(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) Up(ctx context.Context, composeFile, envFile string) error
- func (c Compose) UpProject(ctx context.Context, project, composeFile, envFile string) error
- func (c Compose) UpProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error
- func (c Compose) UpProjectFilesSelected(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) UpProjectFilesSelectedForceRecreateNoBuild(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) UpProjectFilesSelectedNoBuildProgress(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) UpProjectFilesSelectedProgress(ctx context.Context, project, workdir string, environment map[string]string, ...) error
- func (c Compose) UpProjectProgress(ctx context.Context, project, composeFile, envFile string, ...) error
- type ComposeContainer
- type Config
- type Files
- func EnsureFiles(stateDir string) (Files, error)
- func EnsureFilesForProject(stateDir, project string, ports Ports) (Files, error)
- func EnsureFilesWithPorts(stateDir string, ports Ports) (Files, error)
- func ExistingFiles(stateDir string) (Files, error)
- func ExistingFilesForProject(stateDir, project string) (Files, error)
- type ImageIdentity
- type Ports
- type ProjectResource
- type Provider
- type ProviderCapabilities
- type ProviderKind
- type PublishedPort
- type QuadletProject
- func RenderComposeProjectFilesQuadlets(composePaths []string, envFile, project string, selectedServices ...string) (QuadletProject, error)
- func RenderComposeProjectFilesQuadletsEnv(composePaths []string, envFile string, environment map[string]string, ...) (QuadletProject, error)
- func RenderComposeProjectQuadlets(composePath, envFile, project string, selectedServices ...string) (QuadletProject, error)
- type RuntimeCapability
- type ServiceState
Constants ¶
const ( DefaultPostgresPort = 5432 DefaultOpenBaoPort = 8200 )
Variables ¶
var ErrResourceOwnership = errors.New("runtime resource ownership does not match the application project")
var ErrRuntimeNotFound = errors.New("container runtime orchestration not found")
Functions ¶
func DataDir ¶ added in v0.4.2
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 IsPortBindingConflict ¶
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 QuadletAvailable ¶ added in v0.4.15
QuadletAvailable reports whether this host can run rootless Podman Quadlet units.
func RenderComposeProjectFilesJSON ¶ added in v0.4.15
func RequireCapabilities ¶ added in v0.4.0
func RequireCapabilities(provider Provider, required ...RuntimeCapability) error
RequireCapabilities validates runtime requirements before orchestration starts. Providers must satisfy every requested capability; BaseHarbor never silently downgrades runtime behavior because a provider lacks a feature.
func StateDir ¶ added in v0.4.2
StateDir resolves the authoritative BaseHarbor runtime state directory without mutating it.
func WriteQuadletProject ¶ added in v0.4.15
func WriteQuadletProject(dir string, project QuadletProject) error
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 DetectCompose ¶
DetectCompose remains the compatibility entry point for existing v0.3 callers. Provider selection itself is centralized in DetectProvider so new runtime implementations do not require application-contract changes.
func (Compose) BuildProjectFilesSelectedProgress ¶ added in v0.4.15
func (Compose) Capabilities ¶ added in v0.4.0
func (Compose) Capabilities() ProviderCapabilities
func (Compose) ConfigJSONProjectFilesEnv ¶
func (Compose) ConfigProject ¶
func (Compose) ConfigProjectFiles ¶
func (Compose) ConfigProjectFilesEnv ¶
func (Compose) ConnectManagedNetwork ¶ added in v0.4.8
func (Compose) ContainerExposedTCPPorts ¶ added in v0.4.8
func (Compose) ContainerHealthStatus ¶ added in v0.4.8
func (Compose) ContainerNetworks ¶ added in v0.4.8
func (Compose) DestroyOwnedProjectResources ¶ added in v0.4.11
func (Compose) DestroyProject ¶
func (Compose) DestroyProjectRemoveOrphans ¶ added in v0.4.4
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) DisconnectManagedNetwork ¶ added in v0.4.8
func (Compose) DownProject ¶
func (Compose) DownProjectFiles ¶
func (Compose) DownProjectFilesEnv ¶
func (Compose) DownProjectRemoveOrphans ¶ added in v0.4.4
func (Compose) EnsureManagedNetwork ¶ added in v0.4.8
func (Compose) ExecProject ¶
func (Compose) ExecProjectFiles ¶
func (Compose) ExecProjectFilesInput ¶ added in v0.4.15
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) 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) Kind ¶ added in v0.4.0
func (c Compose) Kind() ProviderKind
func (Compose) ListComposeContainers ¶ added in v0.4.8
func (c Compose) ListComposeContainers(ctx context.Context) ([]ComposeContainer, error)
func (Compose) LogsProject ¶ added in v0.4.9
func (Compose) NetworkProjectOwner ¶ added in v0.4.8
func (Compose) ProjectServiceImageIdentity ¶ added in v0.4.15
func (Compose) RemoveManagedNetwork ¶ added in v0.4.8
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. Docker uses Compose; Podman resolves the same workload through Quadlet-owned containers without falling back to podman compose.
func (Compose) RunningServicesProject ¶
func (Compose) RunningServicesProjectFiles ¶
func (Compose) RunningServicesProjectFilesEnv ¶
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 (Compose) ServicesProjectFilesEnv ¶
func (Compose) StatusProject ¶
func (Compose) StatusProjectFiles ¶
func (Compose) StopProject ¶ added in v0.4.8
func (Compose) StopProjectFilesSelected ¶
func (Compose) UpProjectFiles ¶
func (Compose) UpProjectFilesSelected ¶
func (Compose) UpProjectFilesSelectedForceRecreateNoBuild ¶ added in v0.4.15
func (Compose) UpProjectFilesSelectedNoBuildProgress ¶ added in v0.4.15
func (Compose) UpProjectFilesSelectedProgress ¶ added in v0.4.11
type ComposeContainer ¶ added in v0.4.8
type Config ¶
type Config struct {
PostgresDB string
PostgresUser string
PostgresPassword string
PostgresPort int
OpenBaoPort int
}
func LoadConfig ¶
type Files ¶
func EnsureFiles ¶
func EnsureFilesForProject ¶ added in v0.4.15
func ExistingFiles ¶
func ExistingFilesForProject ¶ added in v0.4.15
type ImageIdentity ¶ added in v0.4.15
type ProjectResource ¶
type Provider ¶ added in v0.4.0
type Provider interface {
Kind() ProviderKind
Capabilities() ProviderCapabilities
}
Provider is the minimal runtime-provider seam. It deliberately exposes only provider identity and runtime capabilities at this stage; provider-specific lifecycle inputs stay behind the concrete implementation until a portable operation has a demonstrated second implementation.
func DetectProvider ¶ added in v0.4.0
DetectProvider preserves the v0.3/v0.4 Compose-default compatibility path. Deployment-aware callers should use DetectProviderForKind with the explicit provider stored in protected deployment state.
func DetectProviderForKind ¶ added in v0.4.0
func DetectProviderForKind(ctx context.Context, kind ProviderKind) (Provider, error)
DetectProviderForKind resolves the explicitly selected deployment runtime. Provider selection belongs to deployment/environment state and must never be inferred from the portable application contract.
type ProviderCapabilities ¶ added in v0.4.0
type ProviderCapabilities struct {
WorkloadLifecycle bool
ServiceExec bool
PublishedPorts bool
ResourceOwnership bool
}
ProviderCapabilities describes runtime behavior that orchestration may rely on. Capability providers such as PostgreSQL, Valkey or object storage are a separate axis and must not be encoded here.
func (ProviderCapabilities) Supports ¶ added in v0.4.0
func (c ProviderCapabilities) Supports(capability RuntimeCapability) bool
type ProviderKind ¶ added in v0.4.0
type ProviderKind string
ProviderKind identifies the runtime implementation selected for application workloads. It is deployment configuration, not part of the portable application contract.
const ( // ProviderCompose is retained only as the legacy auto-detect compatibility // value. New target-owned runtime selections use concrete provider identities. ProviderCompose ProviderKind = "compose" ProviderDocker ProviderKind = "docker" ProviderPodman ProviderKind = "podman" ProviderKubernetes ProviderKind = "kubernetes" ProviderOpenShift ProviderKind = "openshift" )
func ParseProviderKind ¶ added in v0.4.0
func ParseProviderKind(value string) (ProviderKind, error)
type PublishedPort ¶ added in v0.3.0
PublishedPort is the provider-facing portion of a Compose publisher that is useful for local operational readiness. It deliberately contains no BaseHarbor-specific ingress model; it mirrors existing Compose runtime state.
type QuadletProject ¶ added in v0.4.15
type QuadletProject struct {
Project string
Files map[string]string
ServiceUnits map[string]string
Containers map[string]string
}
func RenderComposeProjectFilesQuadlets ¶ added in v0.4.15
func RenderComposeProjectFilesQuadlets(composePaths []string, envFile, project string, selectedServices ...string) (QuadletProject, error)
func RenderComposeProjectFilesQuadletsEnv ¶ added in v0.4.15
func RenderComposeProjectQuadlets ¶ added in v0.4.15
func RenderComposeProjectQuadlets(composePath, envFile, project string, selectedServices ...string) (QuadletProject, error)
type RuntimeCapability ¶ added in v0.4.0
type RuntimeCapability string
RuntimeCapability names portable runtime behavior that orchestration may require from a provider. These capabilities describe the runtime substrate, not application capabilities such as PostgreSQL or object storage.
const ( CapabilityWorkloadLifecycle RuntimeCapability = "workload-lifecycle" CapabilityServiceExec RuntimeCapability = "service-exec" CapabilityPublishedPorts RuntimeCapability = "published-ports" CapabilityResourceOwnership RuntimeCapability = "resource-ownership" )
type ServiceState ¶ added in v0.3.0
type ServiceState struct {
Service string
State string
Health string
Publishers []PublishedPort
}
ServiceState is the provider-facing runtime state BaseHarbor needs for truthful workload readiness. Health is empty when the service has no healthcheck or the Compose implementation cannot report one.
func (ServiceState) Ready ¶ added in v0.3.0
func (s ServiceState) Ready() bool
Ready reports whether the service is running and, when a health status is available, has reached a healthy terminal state.