app

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const AppRefTag = "dev.miren.app_ref"
View Source
const ConsoleTask = appconfig.ConsoleName

ConsoleTask is the task name `miren app run` resolves when none is given.

The convention predates tasks: servers/exec already looked for a service literally called "console". Moving it to [tasks.console] also fixes an overload nobody wanted, since declaring [services.console] used to get you both a long-running service the launcher keeps up and the command app run executes -- and only the second was ever the point.

Aliased rather than respelled: the config package validates against its copy, and a second literal here would let the two drift into disagreeing about which task name is the convention.

Variables

This section is empty.

Functions

func DeleteAppTransitive

func DeleteAppTransitive(ctx context.Context, client *entityserver.Client, log *slog.Logger, appId entity.Id) error

DeleteAppTransitive deletes an app and all entities that directly reference it. This includes app_versions and sandbox_pools (both tagged with dev.miren.app_ref). Other transitive resources (sandboxes referencing app_versions) are cleaned up by their controllers.

Types

type AddonsServer added in v0.4.0

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

AddonsServer implements the app_v1alpha.Addons RPC interface.

func NewAddonsServer added in v0.4.0

func NewAddonsServer(log *slog.Logger, ec *entityserver.Client, registry *addon.Registry, imageChecker addon.ImageChecker) *AddonsServer

func (*AddonsServer) CreateInstance added in v0.4.0

func (s *AddonsServer) CreateInstance(ctx context.Context, state *app_v1alpha.AddonsCreateInstance) error

func (*AddonsServer) DeleteInstance added in v0.4.0

func (s *AddonsServer) DeleteInstance(ctx context.Context, state *app_v1alpha.AddonsDeleteInstance) error

func (*AddonsServer) ListInstances added in v0.4.0

func (s *AddonsServer) ListInstances(ctx context.Context, state *app_v1alpha.AddonsListInstances) error

func (*AddonsServer) RotateCredential added in v0.12.1

func (s *AddonsServer) RotateCredential(ctx context.Context, state *app_v1alpha.AddonsRotateCredential) error

RotateCredential creates a pending RotationRequest for the addon attached to the named app. The rotation controller reconciles it: apply a new secret to the live engine, update the stored value, and redeploy affected consumers.

type AppInfo

type AppInfo struct {
	Log  *slog.Logger
	CV   ClearVersioner
	EC   *entityserver.Client
	CPU  *metrics.CPUUsage
	Mem  *metrics.MemoryUsage
	HTTP *metrics.HTTPMetrics

	// Secrets resolves backend-sourced variables so a ConfigVersion minted by an
	// env change records the exact secret version it saw.
	Secrets secret.Resolver
}

func NewAppInfo

func NewAppInfo(log *slog.Logger, ec *entityserver.Client, cpu *metrics.CPUUsage, mem *metrics.MemoryUsage, http *metrics.HTTPMetrics, secrets secret.Resolver) *AppInfo

func (*AppInfo) AppInfo

func (a *AppInfo) AppInfo(ctx context.Context, state *app_v1alpha.AppStatusAppInfo) error

func (*AppInfo) CancelRun added in v0.14.0

func (r *AppInfo) CancelRun(ctx context.Context, state *app_v1alpha.RunsCancelRun) error

CancelRun records a cancellation request. The controller owns every status transition, so this deliberately does not write CANCELED itself -- a second writer would race the reconcile that is also deciding this run's fate.

func (*AppInfo) CancelRunEntity added in v0.14.0

func (r *AppInfo) CancelRunEntity(ctx context.Context, runID string) (bool, error)

CancelRunEntity requests cancellation of a run and reports whether the request was recorded (false if the run had already reached a terminal state). It is the in-process core of CancelRun, shared so the exec proxy's legacy compatibility path can cancel a run it created without re-authenticating over a loopback RPC.

func (*AppInfo) CreateRun added in v0.14.0

func (r *AppInfo) CreateRun(ctx context.Context, state *app_v1alpha.RunsCreateRun) error

CreateRun records a run and returns immediately.

Admission and launching belong to the run controller, so a caller never blocks on capacity here: a run that cannot start yet simply stays pending. That is also what lets deploy- and schedule-triggered runs share one gate with a manual invoke without any of them polling.

func (*AppInfo) CreateRunEntity added in v0.14.0

func (r *AppInfo) CreateRunEntity(ctx context.Context, app, taskName string, command []string, tty bool) (entity.Id, string, error)

CreateRunEntity records a run and returns its id and the name its first attempt's sandbox will have. It is the in-process core of CreateRun so that other coordinator services -- notably the exec proxy's legacy exec-by-app compatibility path -- can create a run with the caller's own identity rather than re-authenticating over a loopback RPC as the coordinator.

app is the app entity ref; taskName may be empty for the console task.

func (*AppInfo) DeleteEnvVar

func (r *AppInfo) DeleteEnvVar(ctx context.Context, state *app_v1alpha.CrudDeleteEnvVar) error

func (*AppInfo) Destroy

func (r *AppInfo) Destroy(ctx context.Context, state *app_v1alpha.CrudDestroy) error

func (*AppInfo) GetConfiguration

func (r *AppInfo) GetConfiguration(ctx context.Context, state *app_v1alpha.CrudGetConfiguration) error

func (*AppInfo) GetRun added in v0.14.0

func (r *AppInfo) GetRun(ctx context.Context, state *app_v1alpha.RunsGetRun) error

func (*AppInfo) List

func (r *AppInfo) List(ctx context.Context, state *app_v1alpha.CrudList) error

func (*AppInfo) ListApps added in v0.14.0

func (r *AppInfo) ListApps(ctx context.Context) ([]*app_v1alpha.AppInfo, error)

ListApps computes the current inventory of apps: identity, active version, health, instance counts, scaling mode, and routes.

This is deliberately shared rather than duplicated. Health is a classification over sandbox pool state, not a stored field, so any second implementation would drift from this one and let `miren app list` and the cloud dashboard disagree about whether an app is healthy. Both read from here instead.

func (*AppInfo) ListRuns added in v0.14.0

func (r *AppInfo) ListRuns(ctx context.Context, state *app_v1alpha.RunsListRuns) error

func (*AppInfo) New

func (r *AppInfo) New(ctx context.Context, state *app_v1alpha.CrudNew) error

func (*AppInfo) Restart added in v0.7.0

func (r *AppInfo) Restart(ctx context.Context, state *app_v1alpha.CrudRestart) error

func (*AppInfo) SetConfiguration

func (r *AppInfo) SetConfiguration(ctx context.Context, state *app_v1alpha.CrudSetConfiguration) error

func (*AppInfo) SetEnvVar

func (r *AppInfo) SetEnvVar(ctx context.Context, state *app_v1alpha.CrudSetEnvVar) error

func (*AppInfo) SetEnvVars added in v0.3.1

func (r *AppInfo) SetEnvVars(ctx context.Context, state *app_v1alpha.CrudSetEnvVars) error

func (*AppInfo) SetHost

func (r *AppInfo) SetHost(ctx context.Context, state *app_v1alpha.CrudSetHost) error

func (*AppInfo) SetInitialEnvVars added in v0.8.0

func (r *AppInfo) SetInitialEnvVars(ctx context.Context, state *app_v1alpha.CrudSetInitialEnvVars) error

func (*AppInfo) SetWorkloadRole added in v0.14.0

func (r *AppInfo) SetWorkloadRole(ctx context.Context, state *app_v1alpha.CrudSetWorkloadRole) error

SetWorkloadRole sets the app's workload identity role. This is the operator path: it can grant cluster-scoped roles, which the app.toml path must not.

It is reachable only by unscoped callers — cert (internal/operator) and JWT-with-RBAC. The guard below says that affirmatively: an app-scoped identity (OIDC or a workload) has a bound app, and is refused. That does not rely on the method staying absent from every token role map (the carve-out tripwire still enforces that too); it's belt-and-braces, and the shape the eventual cluster-admin gate will take.

type ClearVersioner

type ClearVersioner interface {
	ClearOldVersions(ctx context.Context, current *core_v1alpha.AppVersion) error
}

Jump to

Keyboard shortcuts

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