lifecycle

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package lifecycle is a generated GoMock package.

Index

Constants

View Source
const (
	ComposeAppPath         = "/etc/compose/manifests"
	EmbeddedComposeAppPath = "/usr/local/etc/compose/manifests"
)
View Source
const (
	RootfulQuadletAppPath    = "/etc/containers/systemd"
	EmbeddedQuadletAppPath   = "/usr/local/etc/containers/systemd"
	RootfulQuadletTargetPath = "/etc/systemd/system/"
	QuadletTargetName        = "flightctl-quadlet-app.target"
)

Variables

This section is empty.

Functions

func BatchStartTimeFromContext added in v1.0.0

func BatchStartTimeFromContext(ctx context.Context) (time.Time, bool)

func ComposeVolumeName added in v1.1.0

func ComposeVolumeName(appName, volumeName string, user v1beta1.Username) string

ComposeVolumeName generates a unique Compose-compatible volume name based on the application and volume names.

func ContextWithBatchStartTime added in v1.0.0

func ContextWithBatchStartTime(ctx context.Context, t time.Time) context.Context

func GenerateAppID added in v1.1.0

func GenerateAppID(name string, user v1beta1.Username) string

GenerateAppID generates a deterministic, lowercase, DNS-compatible ID with a fixed-length hash suffix.

Types

type Action

type Action struct {
	// ID of the application
	ID string
	// Name of the application
	Name string
	// Environment variables to be passed to the manifest handler at runtime
	EnvVars map[string]string
	// Type of the action
	Type ActionType
	// AppType of the application
	AppType v1beta1.AppType
	// Path to the application
	Path string
	// User that owns the app. Blank means the same user as the current process.
	User v1beta1.Username
	// Embedded is true if the application is embedded in the device
	Embedded bool
	// Volumes is a list of volume names related to this application
	Volumes []Volume
	// Spec holds type-specific configuration, discriminated by AppType.
	Spec ActionSpec
	// RestartGeneration is the target restart generation for ActionRestart, applied
	// to the tracked application only after the restart succeeds.
	RestartGeneration int
}

type ActionHandler

type ActionHandler interface {
	Execute(ctx context.Context, actions Actions) error
}

type ActionHandlerType

type ActionHandlerType string
const (
	ActionHandlerCompose ActionHandlerType = "compose"
)

type ActionSpec added in v1.1.0

type ActionSpec interface {
	// contains filtered or unexported methods
}

ActionSpec is a marker interface for type-specific action configuration. Only spec types defined in this package can implement this interface.

type ActionType

type ActionType string
const (
	ActionAdd     ActionType = "add"
	ActionRemove  ActionType = "remove"
	ActionUpdate  ActionType = "update"
	ActionStop    ActionType = "stop"
	ActionStart   ActionType = "start"
	ActionRestart ActionType = "restart"
)

type Actions added in v1.1.0

type Actions []Action

func (Actions) ByUser added in v1.1.0

type ActionsByType added in v1.1.0

type ActionsByType struct {
	Adds    []Action
	Removes []Action
	Updates []Action
	Unknown []Action
}

type Compose

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

func NewCompose

func NewCompose(log *log.PrefixLogger, rwFactory fileio.ReadWriterFactory, podmanFactory client.PodmanFactory) *Compose

func (*Compose) Execute

func (c *Compose) Execute(ctx context.Context, actions Actions) error

func (*Compose) Restart added in v1.3.0

func (c *Compose) Restart(ctx context.Context, action Action) error

Restart stops then starts the compose application.

func (*Compose) Start added in v1.3.0

func (c *Compose) Start(ctx context.Context, action Action) error

Start starts a previously stopped compose application.

func (*Compose) Stop added in v1.3.0

func (c *Compose) Stop(ctx context.Context, action Action) error

Stop stops compose containers without removing them or their associated resources.

type ExecutableResolver added in v1.1.0

type ExecutableResolver interface {
	Resolve() (string, error)
}

ExecutableResolver resolves the path to an executable binary.

type HelmHandler added in v1.1.0

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

func NewHelmHandler added in v1.1.0

func NewHelmHandler(log *log.PrefixLogger, clients client.CLIClients, resolver ExecutableResolver, rwFactory fileio.ReadWriterFactory) *HelmHandler

NewHelmHandler creates a new HelmHandler.

func (*HelmHandler) Execute added in v1.1.0

func (h *HelmHandler) Execute(ctx context.Context, actions Actions) error

func (*HelmHandler) Restart added in v1.3.0

func (h *HelmHandler) Restart(ctx context.Context, action Action) error

Restart scales all workloads to 0 then re-applies the chart to restore replica counts.

func (*HelmHandler) Start added in v1.3.0

func (h *HelmHandler) Start(ctx context.Context, action Action) error

Start re-applies the Helm chart via "helm upgrade --install", which restores replicas to the chart-defined counts after a stop operation.

func (*HelmHandler) Stop added in v1.3.0

func (h *HelmHandler) Stop(ctx context.Context, action Action) error

Stop scales all Deployments and StatefulSets belonging to the Helm release to 0 replicas. Uses the "agent.flightctl.io/app=<action.ID>" label to identify the release's workloads. DaemonSets, Jobs, CronJobs, and standalone Pods are not scaled and remain running; releases composed only of Deployments/StatefulSets are fully supported.

type HelmSpec added in v1.1.0

type HelmSpec struct {
	// Namespace is the Kubernetes namespace for the Helm release.
	Namespace string
	// ValuesFiles is a list of relative paths to values files within the chart.
	ValuesFiles []string
	// ProviderValuesPath is the absolute path to the provider-generated values file.
	// This is set when the application spec contains inline Values.
	ProviderValuesPath string
}

HelmSpec contains Helm-specific action configuration.

type LifecycleHandler added in v1.3.0

type LifecycleHandler interface {
	Stop(ctx context.Context, action Action) error
	Start(ctx context.Context, action Action) error
	Restart(ctx context.Context, action Action) error
}

LifecycleHandler is implemented by action handlers that support declarative stop/start/restart without uninstalling the application. Each implementation constructs its own runtime client from injected factories keyed on action.User.

type MockActionHandler added in v1.0.0

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

MockActionHandler is a mock of ActionHandler interface.

func NewMockActionHandler added in v1.0.0

func NewMockActionHandler(ctrl *gomock.Controller) *MockActionHandler

NewMockActionHandler creates a new mock instance.

func (*MockActionHandler) EXPECT added in v1.0.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockActionHandler) Execute added in v1.0.0

func (m *MockActionHandler) Execute(ctx context.Context, actions Actions) error

Execute mocks base method.

type MockActionHandlerMockRecorder added in v1.0.0

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

MockActionHandlerMockRecorder is the mock recorder for MockActionHandler.

func (*MockActionHandlerMockRecorder) Execute added in v1.0.0

func (mr *MockActionHandlerMockRecorder) Execute(ctx, actions any) *gomock.Call

Execute indicates an expected call of Execute.

type MockActionSpec added in v1.1.0

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

MockActionSpec is a mock of ActionSpec interface.

func NewMockActionSpec added in v1.1.0

func NewMockActionSpec(ctrl *gomock.Controller) *MockActionSpec

NewMockActionSpec creates a new mock instance.

func (*MockActionSpec) EXPECT added in v1.1.0

EXPECT returns an object that allows the caller to indicate expected use.

type MockActionSpecMockRecorder added in v1.1.0

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

MockActionSpecMockRecorder is the mock recorder for MockActionSpec.

type MockLifecycleHandler added in v1.3.0

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

MockLifecycleHandler is a mock of LifecycleHandler interface.

func NewMockLifecycleHandler added in v1.3.0

func NewMockLifecycleHandler(ctrl *gomock.Controller) *MockLifecycleHandler

NewMockLifecycleHandler creates a new mock instance.

func (*MockLifecycleHandler) EXPECT added in v1.3.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLifecycleHandler) Restart added in v1.3.0

func (m *MockLifecycleHandler) Restart(ctx context.Context, action Action) error

Restart mocks base method.

func (*MockLifecycleHandler) Start added in v1.3.0

func (m *MockLifecycleHandler) Start(ctx context.Context, action Action) error

Start mocks base method.

func (*MockLifecycleHandler) Stop added in v1.3.0

func (m *MockLifecycleHandler) Stop(ctx context.Context, action Action) error

Stop mocks base method.

type MockLifecycleHandlerMockRecorder added in v1.3.0

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

MockLifecycleHandlerMockRecorder is the mock recorder for MockLifecycleHandler.

func (*MockLifecycleHandlerMockRecorder) Restart added in v1.3.0

func (mr *MockLifecycleHandlerMockRecorder) Restart(ctx, action any) *gomock.Call

Restart indicates an expected call of Restart.

func (*MockLifecycleHandlerMockRecorder) Start added in v1.3.0

func (mr *MockLifecycleHandlerMockRecorder) Start(ctx, action any) *gomock.Call

Start indicates an expected call of Start.

func (*MockLifecycleHandlerMockRecorder) Stop added in v1.3.0

func (mr *MockLifecycleHandlerMockRecorder) Stop(ctx, action any) *gomock.Call

Stop indicates an expected call of Stop.

type OSExecutableResolver added in v1.1.0

type OSExecutableResolver struct{}

OSExecutableResolver resolves the current process executable using os.Executable().

func (OSExecutableResolver) Resolve added in v1.1.0

func (r OSExecutableResolver) Resolve() (string, error)

type Quadlet added in v1.0.0

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

func NewQuadlet added in v1.0.0

func NewQuadlet(log *log.PrefixLogger, rwFactory fileio.ReadWriterFactory, systemdFactory systemd.ManagerFactory, podmanFactory client.PodmanFactory) *Quadlet

func (*Quadlet) Execute added in v1.0.0

func (q *Quadlet) Execute(ctx context.Context, actions Actions) error

func (*Quadlet) Restart added in v1.3.0

func (q *Quadlet) Restart(ctx context.Context, action Action) error

Restart restarts the application's systemd target directly. VM workloads are rendered as native quadlet units like any other application, so no special handling is required.

func (*Quadlet) Start added in v1.3.0

func (q *Quadlet) Start(ctx context.Context, action Action) error

Start starts a previously stopped application's systemd target. The unit files are already on disk — no DaemonReload is required.

func (*Quadlet) Stop added in v1.3.0

func (q *Quadlet) Stop(ctx context.Context, action Action) error

Stop stops the application's systemd target and dependent services without removing files or Podman resources. It also clears failed unit state so that expected non-zero exits (for example virt-launcher killed on stop) do not remain listed as Failed Units.

type Volume added in v0.8.1

type Volume struct {
	ID            string
	Reference     string
	ReclaimPolicy v1beta1.ApplicationVolumeReclaimPolicy
}

Jump to

Keyboard shortcuts

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