Documentation
¶
Index ¶
- func BridgeInterfaceIP(name string) (string, error)
- func ClearForRestore(cfg *config.Config) (string, error)
- func DetectedBackendName(cfg *config.Config) string
- func DevImageTag() string
- func DockerBridgeGatewayIP() (string, error)
- func DockerDesktopGatewayIP() string
- func InfrastructureReplacements(backendName, stackID string) (map[string]string, error)
- func IsDefaultsPath(rel string) bool
- func OllamaHostForBackend(backendName string) string
- func OllamaHostIPForBackend(backendName string) (string, error)
- func ReadDevImageTag(cfg *config.Config) string
- func RecordRewrite(cfg *config.Config, path string, before, after []byte)
- func RefreshInfrastructureIfChanged(cfg *config.Config, backendName, stackID string) (bool, error)
- func ReportRefresh(u *ui.UI, res RefreshResult, resetCmd string)
- func ResolveHostGatewayViaDocker() (string, error)
- func ResolveWorkloadImage(cfg *config.Config, repo string) string
- func StackID(cfg *config.Config) string
- type FileBackup
- type PendingDefault
- type RefreshOptions
- type RefreshResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BridgeInterfaceIP ¶
BridgeInterfaceIP returns the IPv4 address of a named network interface.
func ClearForRestore ¶ added in v0.17.0
ClearForRestore makes way for a defaults tree restored from a stack backup, so the archive's files and manifest are not mixed with the local tree they replace. The local pending new defaults are removed (they belong to the replaced tree). A local tree without hand-edits is removed; one with edits is moved to $CONFIG/defaults.bak.<timestamp> and that path returned.
func DetectedBackendName ¶
DetectedBackendName reads the persisted backend choice, defaulting to k3d for legacy stacks that predate .stack-backend.
func DevImageTag ¶ added in v0.10.0
func DevImageTag() string
DevImageTag returns the tag used for locally-built dev images under OBOL_DEVELOPMENT. It is `dev-<short-git-sha>` of the working tree, so each branch/worktree builds a distinct tag and parallel dev stacks sharing one Docker daemon never clobber each other's images (the `:latest` collision that let a sibling worktree's build poison an unrelated stack). Committing changes the SHA and triggers a fresh build; uncommitted changes reuse the committed tag unless OBOL_FORCE_REBUILD_LOCAL_DEV_IMAGES is set. Falls back to `latest` when the source is not a git checkout (e.g. a tarball build), preserving the previous behaviour there.
func DockerBridgeGatewayIP ¶
DockerBridgeGatewayIP returns the IPv4 address of an active Docker bridge interface.
func DockerDesktopGatewayIP ¶
func DockerDesktopGatewayIP() string
DockerDesktopGatewayIP returns the Docker Desktop VM gateway IP.
This is a hardcoded magic value valid only for Docker Desktop on macOS. Colima and Rancher Desktop use different bridge IPs (e.g. 192.168.5.2 for Colima's default profile), so prefer ResolveHostGatewayViaDocker which works across all macOS Docker runtimes.
func InfrastructureReplacements ¶
InfrastructureReplacements returns the placeholder values used when copying embedded infrastructure defaults.
func IsDefaultsPath ¶ added in v0.17.0
IsDefaultsPath reports whether a ConfigDir-relative path belongs to the defaults tree or its pending new-default sibling (the parts a stack backup restores as one unit).
func OllamaHostForBackend ¶
OllamaHostForBackend returns the hostname/IP that reaches the host Ollama instance from inside the cluster.
func OllamaHostIPForBackend ¶
OllamaHostIPForBackend resolves the Ollama host to an IP address. ClusterIP+Endpoints requires an IP, not a hostname.
Resolution order on darwin+k3d:
- Resolve host.docker.internal from inside a transient Docker container (works for Docker Desktop, Colima, Rancher Desktop — each exposes a different host gateway IP, but all expose host.docker.internal inside containers).
- Fall back to the Docker Desktop magic gateway IP (192.168.65.254) so Docker Desktop users without a working `docker` CLI still work.
Whatever the backend resolves to, the result is never a loopback address: see the guard below.
func ReadDevImageTag ¶ added in v0.10.0
ReadDevImageTag returns the dev image tag persisted at RefreshInfrastructure time, or "latest" if none was recorded (non-dev install, or pre-dates this mechanism). internal/stack uses it to tag the images it builds.
func RecordRewrite ¶ added in v0.17.0
RecordRewrite updates the manifest after obol itself rewrote a file in the defaults tree (e.g. `obol upgrade` bumping chart versions), so the change is not mistaken for a hand-edit. A file the operator had already edited (before differs from what obol last wrote) stays marked as edited.
func RefreshInfrastructureIfChanged ¶
RefreshInfrastructureIfChanged refreshes the generated defaults tree when the embedded infrastructure assets, backend, or stack ID changed. Hand-edited files are preserved (see RefreshInfrastructure); callers with a UI should use RefreshInfrastructure + ReportRefresh so kept files are surfaced.
func ReportRefresh ¶ added in v0.17.0
func ReportRefresh(u *ui.UI, res RefreshResult, resetCmd string)
ReportRefresh prints the outcome of a refresh. resetCmd is the command that takes the new defaults (e.g. "obol stack up --reset-defaults").
func ResolveHostGatewayViaDocker ¶ added in v0.10.0
ResolveHostGatewayViaDocker asks the local Docker daemon to resolve the host gateway by running a tiny container that prints the IP of host.docker.internal. This works on Docker Desktop, Colima, and Rancher Desktop because all three expose host.docker.internal inside containers and map it to whatever bridge gateway their VM is using.
Falls back to --add-host=host.docker.internal:host-gateway when the bare hostname is not pre-populated by the runtime.
func ResolveWorkloadImage ¶ added in v0.15.0
ResolveWorkloadImage returns the image reference for stack-owned workloads created dynamically at runtime (tunnel storefront, demo-server) rather than through the rendered defaults tree. Under OBOL_DEVELOPMENT it pins the locally-imported tag recorded at RefreshInfrastructure time, matching what `stack up` builds and imports into the cluster. images.Resolve alone returns `:latest` in dev mode, which imagePullPolicy IfNotPresent then satisfies from a stale registry pull instead of the local build.
Types ¶
type FileBackup ¶ added in v0.17.0
FileBackup is an edited file that was copied aside before being replaced.
type PendingDefault ¶ added in v0.17.0
PendingDefault is a hand-edited file that was kept; New holds the newer default obol would have written.
func PendingDefaults ¶ added in v0.17.0
func PendingDefaults(cfg *config.Config) []PendingDefault
PendingDefaults lists edited defaults files that still have a newer default waiting in $CONFIG/defaults.obol-new. Entries the operator resolved by copying the new default over are cleaned up.
type RefreshOptions ¶ added in v0.17.0
type RefreshOptions struct {
// Force re-renders even when the stamp (embedded digest, backend, stack
// ID, binary identity) is unchanged.
Force bool
// Reset takes the new defaults for every file, copying hand-edited files
// to a timestamped backup directory first.
Reset bool
}
RefreshOptions controls RefreshInfrastructure.
type RefreshResult ¶ added in v0.17.0
type RefreshResult struct {
Refreshed bool
// Pending: edited files kept while the shipped default changed.
Pending []PendingDefault
// KeptEdited: edited files kept; their shipped default did not change.
KeptEdited []string
// KeptRemoved: edited files obol no longer ships, left in place.
KeptRemoved []string
// BackedUp: edited files replaced after a backup (Reset, or the first
// refresh after upgrading from a version without the manifest).
BackedUp []FileBackup
// Migrated is true when no manifest existed for an existing tree, so
// edits could not be told apart from older defaults.
Migrated bool
}
RefreshResult reports what a refresh did with hand-edited files.
func RefreshInfrastructure ¶ added in v0.17.0
func RefreshInfrastructure(cfg *config.Config, backendName, stackID string, opts RefreshOptions) (RefreshResult, error)
RefreshInfrastructure re-renders the embedded infrastructure defaults when the stamp changed (or opts.Force), preserving hand-edited files:
- unedited (on-disk matches what obol last wrote) -> overwritten
- edited, shipped default changed -> kept; the new default is written to $CONFIG/defaults.obol-new/<path> and reported in Pending
- edited, shipped default unchanged -> kept (KeptEdited)
- no longer shipped -> removed if unedited, kept and reported if edited
- opts.Reset -> everything overwritten; edited files are copied to $CONFIG/defaults.bak.<timestamp>/<path> first
- existing tree without a manifest (written by an older obol) -> every file differing from the new default is backed up, then replaced