Documentation
¶
Overview ¶
Package stackcmd holds host-side verb behaviour shared by the cobra CLI and the image's okapicli, so they can't drift.
Index ¶
- Constants
- func Apply(ctx context.Context, svc *stack.Service, path string, yes bool, ui UI) error
- func Backup(ctx context.Context, svc *stack.Service, path string, o BackupOptions, ui UI) (string, error)
- func BackupDir(manifestPath string) string
- func EnvGet(path, key string, o EnvOptions) (value string, found bool, err error)
- func EnvList(path string, o EnvOptions) (map[string]string, string, error)
- func EnvSet(ctx context.Context, svc *stack.Service, path string, assignments []string, ...) error
- func EnvUnset(ctx context.Context, svc *stack.Service, path string, keys []string, ...) error
- func Restart(ctx context.Context, svc *stack.Service, path, component string, yes bool, ...) error
- func Restore(ctx context.Context, svc *stack.Service, path string, o RestoreOptions, ui UI) error
- func Uninstall(ctx context.Context, svc *stack.Service, path string, withVolumes, yes bool, ...) error
- func Upgrade(ctx context.Context, svc *stack.Service, path string, o UpgradeOptions, ui UI) error
- func WithInstallHint(err error) error
- type BackupOptions
- type DBBackup
- type EnvOptions
- type RestoreOptions
- type SetupOptions
- type SetupResult
- type StatusReport
- type UI
- type UpgradeOptions
Constants ¶
const LabelPreRestore = "pre-restore"
Only these are pruned; a dump the operator asked for is never deleted.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶ added in v1.10.14
The second half of `env set`, so a batch of edits costs one recreate per component.
func Backup ¶ added in v1.10.21
func Backup(ctx context.Context, svc *stack.Service, path string, o BackupOptions, ui UI) (string, error)
Database only: not volumes, certificates or the manifest, whose encryption key the dump needs.
func BackupDir ¶ added in v1.10.21
Beside the manifest, which is already writable and bind-mounted by the containerized installer.
func EnvGet ¶ added in v1.10.1
func EnvGet(path, key string, o EnvOptions) (value string, found bool, err error)
found=false should be reported as such rather than printed as an empty line.
func EnvList ¶ added in v1.10.1
EnvList returns the environment the manifest carries, and the name of the block it came from.
func EnvSet ¶ added in v1.10.1
func EnvSet(ctx context.Context, svc *stack.Service, path string, assignments []string, o EnvOptions, ui UI) error
Validation is Normalize's, whose errors name where a refused value really lives.
func EnvUnset ¶ added in v1.10.1
func EnvUnset(ctx context.Context, svc *stack.Service, path string, keys []string, o EnvOptions, ui UI) error
A seeded key comes back at its default rather than disappearing, and the caller is told so.
func Restart ¶
func Restart(ctx context.Context, svc *stack.Service, path, component string, yes bool, ui UI) error
Restarts without recreating, so on-disk changes like goma.yml are re-read but spec changes are not.
func Restore ¶ added in v1.10.21
The current database is dumped first, so a restore can itself be undone.
func Uninstall ¶
func Uninstall(ctx context.Context, svc *stack.Service, path string, withVolumes, yes bool, ui UI, removeFile func(string) error) error
With volumes removed the manifest goes too, since it describes an install that no longer exists.
func WithInstallHint ¶
Types ¶
type BackupOptions ¶ added in v1.10.21
BackupOptions is the flag surface of `stack backup`, already parsed.
type DBBackup ¶ added in v1.10.21
DBBackup is one dump found on disk.
func ListBackups ¶ added in v1.10.21
Files not following the naming scheme are ignored rather than guessed at.
type EnvOptions ¶ added in v1.10.1
type EnvOptions struct {
// Gateway edits the gateway's environment instead of the control plane's.
Gateway bool
// Off by default so several edits cost one recreate through Apply.
Apply bool
Yes bool
}
EnvOptions is the flag surface of the env verbs, already parsed.
type RestoreOptions ¶ added in v1.10.21
type RestoreOptions struct {
// File is a path, or the bare name of a dump in BackupDir.
File string
Yes bool
// Force restores a dump taken by a newer Miabi than the one running.
Force bool
}
RestoreOptions is the flag surface of `stack restore`, already parsed.
type SetupOptions ¶
type SetupOptions struct {
Domain, AdminEmail, ACMEEmail, ControlURL string
Image, GatewayImage, RunnerImage, GomaConfig string
RegistryHost, Subnet, InternalSubnet string
Registry, NoHostProc, Yes bool
// IPv6 gives the shared app network and every workspace network a dual-stack address space.
IPv6 bool
// AdminPassword is the first admin's password; empty generates one. Only a fresh install uses it.
AdminPassword string
DefaultImage func() string
}
SetupOptions is the flag surface of install/setup, already parsed.
type SetupResult ¶
type StatusReport ¶
type StatusReport struct {
Manifest *stack.Manifest
Path string
Found []stack.Component
// The host is installed; saying otherwise sends the operator hunting for a Compose stack.
LegacyConfig error
// Unmanaged is set when containers exist but no manifest does: a Compose or hand-rolled install.
Unmanaged bool
// Drift lists components running an image the manifest does not pin.
Drift []string
}
The caller renders it; neither front-end decides what is in it.
type UI ¶
type UI interface {
Printf(format string, a ...any)
Info(format string, a ...any)
Success(format string, a ...any)
Warn(format string, a ...any)
// Confirm asks a yes/no question. It is never called when the caller passed Yes.
Confirm(prompt string) bool
}
UI is the front-end's output. The CLI colors it; the server image prints plainly.
type UpgradeOptions ¶
type UpgradeOptions struct {
// Component is empty for the whole stack, else one component by name.
Component string
Image string
Version string
Yes bool
// DefaultImage is as in SetupOptions.
DefaultImage func() string
// GatewayVersion is the Goma release a whole-stack upgrade moves to; nil or "" means the bundled one.
GatewayVersion func() string
}
UpgradeOptions is the flag surface of upgrade/update, already parsed.