Documentation
¶
Index ¶
- Constants
- Variables
- func ApplicationBackendNetworkName(m Manifest) string
- func CheckManagedRuntimeDefinition(files RuntimeFiles, m Manifest) error
- func CheckRuntimePermissions(files RuntimeFiles) error
- func CheckSupportedRuntimeServices(m Manifest) error
- func ConfiguredRuntimeAPIURL() (string, bool, error)
- func EnsureRuntimeIdentity(m Manifest, files RuntimeFiles) (string, error)
- func ExpectedPersistentRuntimeResources(m Manifest) []bhruntime.ProjectResource
- func ExpectedPostgresRuntimeResources(m Manifest) []bhruntime.ProjectResource
- func ExpectedRuntimeResources(m Manifest) []bhruntime.ProjectResource
- func FindRepositoryManifest(start string) (string, error)
- func GenerateSecretValue(generation SecretGeneration) ([]byte, error)
- func HasRequiredFileSecrets(m Manifest) bool
- func InspectOwnedRuntimeResources(ctx context.Context, compose bhruntime.Compose, m Manifest) ([]bhruntime.ProjectResource, error)
- func MaterializeRuntimeIdentityWorkloadOverride(m Manifest, workload WorkloadFiles, files RuntimeFiles, ...) (string, bool, error)
- func PostgresInstanceNames(m Manifest) []string
- func ReallocateRuntimePorts(m Manifest, files RuntimeFiles) error
- func RedisInstanceNames(m Manifest) []string
- func RequiredSecretNames(m Manifest) []string
- func RequiredSecretUsesFileBinding(name string) bool
- func ResolveWorkloadCompose(repositoryRoot string, m Manifest) (string, bool, error)
- func ResourceExists(resources []bhruntime.ProjectResource, kind string) bool
- func ResourceNamedExists(resources []bhruntime.ProjectResource, wanted bhruntime.ProjectResource) bool
- func RestorePostgresInstances(ctx context.Context, runtime PostgresBackupRuntime, m Manifest, ...) error
- func RevokeRuntimeIdentity(m Manifest, files RuntimeFiles) error
- func RotateRuntimeIdentity(m Manifest, files RuntimeFiles) error
- func RuntimeComposeYAML(m Manifest) (string, error)
- func RuntimeIdentityRevoked(files RuntimeFiles) bool
- func RuntimeIdentityRevokedPath(files RuntimeFiles) string
- func RuntimeIdentityTokenPath(files RuntimeFiles) string
- func RuntimeMTLSHostDir(files RuntimeFiles) string
- func RuntimeProjectName(m Manifest) string
- func SecretFileContainerPath(name string) string
- func SecretFileHostDir(files RuntimeFiles) string
- func SecretFileHostPath(files RuntimeFiles, name string) string
- func ValidatePostgresBackupSet(m Manifest, backups []PostgresBackup) error
- func VerifyPostgresRuntime(ctx context.Context, compose bhruntime.Compose, m Manifest, files RuntimeFiles) error
- func VerifyValkeyRuntime(ctx context.Context, compose bhruntime.Compose, m Manifest, files RuntimeFiles) error
- func WorkloadProjectName(m Manifest) string
- type Action
- type Manifest
- func LoadManifestFile(path string) (Manifest, error)
- func New(name, environment string, postgres, redis, secrets bool) Manifest
- func ParseYAML(input string) (Manifest, error)
- func WithGeneratedSecret(m Manifest, name, generationType string, size int) Manifest
- func WithPostgresInstances(m Manifest, names ...string) Manifest
- func WithRedisInstances(m Manifest, names ...string) Manifest
- func WithRequiredSecrets(m Manifest, names ...string) Manifest
- func WithWorkload(m Manifest, compose string, services ...string) Manifest
- type Plan
- type PostgresBackup
- type PostgresBackupRuntime
- type RuntimeContract
- type RuntimeFiles
- type SecretGeneration
- type SecretRequirement
- type SecretRequirements
- type ServiceInstance
- type Services
- type Store
- type WorkloadBindingPlan
- type WorkloadConfig
- type WorkloadFiles
Constants ¶
const ( DefaultRuntimeAPIURL = "https://baseharbor-secrets:8443" RuntimeIdentityContainerTokenPath = "/run/secrets/baseharbor-runtime-token" RuntimeIdentityContainerCAPath = "/run/secrets/baseharbor-runtime-ca" RuntimeIdentityContainerClientCertPath = "/run/secrets/baseharbor-runtime-client-cert" RuntimeIdentityContainerClientKeyPath = "/run/secrets/baseharbor-runtime-client-key" SecretFileBindingContainerDir = "/run/baseharbor/bindings/secrets" )
const CurrentVersion = 1
const MaxPostgresBackupBytes int64 = 512 << 20
const RepositoryManifestName = "baseharbor.yaml"
Variables ¶
var ErrExists = errors.New("application already exists")
var ErrRuntimeAPIURL = errors.New("application runtime API URL is invalid")
var ErrRuntimeDefinitionChanged = errors.New("application runtime definition differs from the BaseHarbor-managed definition")
var ErrRuntimeNotApplied = errors.New("application runtime has not been applied")
var ErrUnsupportedService = errors.New("application contains services that are not yet supported by apply")
var ErrWorkloadComposeAmbiguous = errors.New("multiple application Compose files found")
var ErrWorkloadComposeNotFound = errors.New("application Compose file not found")
Functions ¶
func ApplicationBackendNetworkName ¶
ApplicationBackendNetworkName returns the stable Docker/Podman network name used by BaseHarbor-managed backend services for one application environment.
Application-owned workloads may attach to this network as an additional external network without replacing their own Compose networks. The current Compose provider maps the logical backend network to the deterministic project default network.
func CheckManagedRuntimeDefinition ¶
func CheckManagedRuntimeDefinition(files RuntimeFiles, m Manifest) error
CheckManagedRuntimeDefinition prevents destructive operations from trusting a locally modified Compose file. BaseHarbor may only mutate the runtime shape it originally generated and understands for the current manifest.
func CheckRuntimePermissions ¶
func CheckRuntimePermissions(files RuntimeFiles) error
func ConfiguredRuntimeAPIURL ¶
func EnsureRuntimeIdentity ¶
func EnsureRuntimeIdentity(m Manifest, files RuntimeFiles) (string, error)
func ExpectedPersistentRuntimeResources ¶
func ExpectedPersistentRuntimeResources(m Manifest) []bhruntime.ProjectResource
func ExpectedPostgresRuntimeResources ¶
func ExpectedPostgresRuntimeResources(m Manifest) []bhruntime.ProjectResource
ExpectedPostgresRuntimeResources is kept for compatibility with the first runtime milestone. New lifecycle code should use ExpectedRuntimeResources.
func ExpectedRuntimeResources ¶
func ExpectedRuntimeResources(m Manifest) []bhruntime.ProjectResource
func FindRepositoryManifest ¶
FindRepositoryManifest returns the nearest baseharbor.yaml from start upward. This lets developers run baha from nested directories inside an application repository.
func GenerateSecretValue ¶
func GenerateSecretValue(generation SecretGeneration) ([]byte, error)
func HasRequiredFileSecrets ¶
func MaterializeRuntimeIdentityWorkloadOverride ¶
func MaterializeRuntimeIdentityWorkloadOverride(m Manifest, workload WorkloadFiles, files RuntimeFiles, plan WorkloadBindingPlan) (string, bool, error)
MaterializeRuntimeIdentityWorkloadOverride adds only the protected bindings that selected application services actually consume. Runtime identity is injected through ordinary environment file paths plus Compose secret mounts; applications do not configure certificates, keys or broker topology.
func PostgresInstanceNames ¶
func ReallocateRuntimePorts ¶
func ReallocateRuntimePorts(m Manifest, files RuntimeFiles) error
ReallocateRuntimePorts replaces only the generated host-port assignments for an already materialized application runtime. Credentials, databases, volumes and other persisted runtime values are left unchanged. This is used when the container runtime proves that a probed loopback port was claimed between allocation and the actual container bind.
func RedisInstanceNames ¶
func RequiredSecretNames ¶
func ResolveWorkloadCompose ¶
func ResourceExists ¶
func ResourceExists(resources []bhruntime.ProjectResource, kind string) bool
func ResourceNamedExists ¶
func ResourceNamedExists(resources []bhruntime.ProjectResource, wanted bhruntime.ProjectResource) bool
func RestorePostgresInstances ¶
func RestorePostgresInstances(ctx context.Context, runtime PostgresBackupRuntime, m Manifest, files RuntimeFiles, backups []PostgresBackup) error
func RevokeRuntimeIdentity ¶
func RevokeRuntimeIdentity(m Manifest, files RuntimeFiles) error
func RotateRuntimeIdentity ¶
func RotateRuntimeIdentity(m Manifest, files RuntimeFiles) error
func RuntimeComposeYAML ¶
func RuntimeIdentityRevoked ¶
func RuntimeIdentityRevoked(files RuntimeFiles) bool
func RuntimeIdentityRevokedPath ¶
func RuntimeIdentityRevokedPath(files RuntimeFiles) string
func RuntimeIdentityTokenPath ¶
func RuntimeIdentityTokenPath(files RuntimeFiles) string
func RuntimeMTLSHostDir ¶
func RuntimeMTLSHostDir(files RuntimeFiles) string
func RuntimeProjectName ¶
func SecretFileContainerPath ¶
func SecretFileHostDir ¶
func SecretFileHostDir(files RuntimeFiles) string
func SecretFileHostPath ¶
func SecretFileHostPath(files RuntimeFiles, name string) string
func ValidatePostgresBackupSet ¶
func ValidatePostgresBackupSet(m Manifest, backups []PostgresBackup) error
func VerifyPostgresRuntime ¶
func VerifyValkeyRuntime ¶
func WorkloadProjectName ¶
Types ¶
type Manifest ¶
type Manifest struct {
Version int
Name string
Environment string
Services Services
Secrets SecretRequirements
Workload WorkloadConfig
}
Manifest is the declarative application backend request understood by BaseHarbor.
func LoadManifestFile ¶
func ParseYAML ¶
ParseYAML parses the intentionally small v1 manifest grammar without adding a runtime dependency.
func WithGeneratedSecret ¶
func WithPostgresInstances ¶
func WithRedisInstances ¶
func WithRequiredSecrets ¶
type PostgresBackup ¶
func DumpPostgresInstances ¶
func DumpPostgresInstances(ctx context.Context, runtime PostgresBackupRuntime, m Manifest, files RuntimeFiles) ([]PostgresBackup, error)
type PostgresBackupRuntime ¶
type RuntimeContract ¶
func EnsureRuntimeContract ¶
func EnsureRuntimeContract(m Manifest, files RuntimeFiles) (RuntimeContract, error)
type RuntimeFiles ¶
type RuntimeFiles struct {
Dir string
Compose string
Env string
ApplicationEnv string
Bindings string
}
func EnsurePostgresRuntime ¶
func EnsurePostgresRuntime(store Store, m Manifest) (RuntimeFiles, error)
EnsurePostgresRuntime is kept for callers from the first runtime milestone.
func EnsureRuntime ¶
func EnsureRuntime(store Store, m Manifest) (RuntimeFiles, error)
func ExistingRuntimeFiles ¶
func ExistingRuntimeFiles(store Store, m Manifest) (RuntimeFiles, error)
type SecretGeneration ¶
type SecretRequirement ¶
type SecretRequirement struct {
Name string
Generate *SecretGeneration
}
func GeneratedSecretRequirements ¶
func GeneratedSecretRequirements(m Manifest) []SecretRequirement
func SecretRequirementByName ¶
func SecretRequirementByName(m Manifest, name string) (SecretRequirement, bool)
type SecretRequirements ¶
type SecretRequirements struct {
Required []SecretRequirement
}
SecretRequirements declares application-owned secret requirements. Values never belong in the manifest. Generate only expresses explicit intent for BaseHarbor to create a missing value directly in the managed secret backend.
type ServiceInstance ¶
type ServiceInstance struct{}
ServiceInstance is the stable logical identity of one requested backend service. The empty v1 shape is intentional: topology remains a BaseHarbor implementation detail and future intent such as availability can evolve here.
type Services ¶
type Services struct {
Postgres bool
Redis bool
Secrets bool
PostgresInstances map[string]ServiceInstance
RedisInstances map[string]ServiceInstance
}
type WorkloadBindingPlan ¶
type WorkloadBindingPlan struct {
RuntimeIdentityServices []string
FileSecretsByService map[string][]string
}
func (WorkloadBindingPlan) Empty ¶
func (p WorkloadBindingPlan) Empty() bool
type WorkloadConfig ¶
WorkloadConfig optionally disambiguates an existing application Compose workload. Empty values keep the common case convention-based: BaseHarbor may detect one unambiguous Compose file and attach all of its services.
type WorkloadFiles ¶
type WorkloadFiles struct {
RepositoryRoot string
Compose string
Override string
Services []string
Project string
Partial bool
}
func MaterializeWorkload ¶
func MaterializeWorkload(repositoryRoot string, m Manifest, runtime RuntimeFiles) (WorkloadFiles, bool, error)