provider

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppTypeLabel            = "appType"
	DefaultImageManifestDir = "/"
)

Variables

This section is empty.

Functions

func ToLifecycleVolumes added in v0.8.1

func ToLifecycleVolumes(volumes []*Volume) []lifecycle.Volume

ToLifecycleVolumes converts provider volumes to lifecycle volumes

Types

type ApplicationSpec

type ApplicationSpec struct {
	// Name of the application
	Name string
	// ID of the application
	ID string
	// Type of the application
	AppType v1alpha1.AppType
	// Path to the application
	Path string
	// EnvVars are the environment variables to be passed to the application
	EnvVars map[string]string
	// Embedded is true if the application is embedded in the device
	Embedded bool
	// Volume manager.
	Volume VolumeManager
	// ImageProvider is the spec for the image provider
	ImageProvider *v1alpha1.ImageApplicationProviderSpec
	// InlineProvider is the spec for the inline provider
	InlineProvider *v1alpha1.InlineApplicationProviderSpec
}

type Diff

type Diff struct {
	// Ensure contains both newly added and unchanged app provders
	Ensure []Provider
	// Removed contains app providers that are no longer part of the desired state
	Removed []Provider
	// Changed contains app providers that have changed between the current and desired state
	Changed []Provider
}

func GetDiff

func GetDiff(
	current []Provider,
	desired []Provider,
) (Diff, error)

type ParseOpt

type ParseOpt func(*parseConfig)

func WithEmbedded

func WithEmbedded() ParseOpt

func WithProviderTypes

func WithProviderTypes(providerTypes ...v1alpha1.ApplicationProviderType) ParseOpt

func WithVerify added in v0.9.0

func WithVerify() ParseOpt

type Provider

type Provider interface {
	// OCITargets returns the list of OCI images and artifacts required by the provider.
	OCITargets(pullSecret *client.PullSecret) ([]dependency.OCIPullTarget, error)
	// Verify the application content is valid and dependencies are met.
	Verify(ctx context.Context) error
	// Install the application content to the device.
	Install(ctx context.Context) error
	// Remove the application content from the device.
	Remove(ctx context.Context) error
	// Name returns the name of the application.
	Name() string
	// Spec returns the application spec.
	Spec() *ApplicationSpec
}

Provider defines the interface for supplying and managing an application's spec and lifecycle operations for installation to disk.

func FromDeviceSpec

func FromDeviceSpec(
	ctx context.Context,
	log *log.PrefixLogger,
	podman *client.Podman,
	readWriter fileio.ReadWriter,
	spec *v1alpha1.DeviceSpec,
	opts ...ParseOpt,
) ([]Provider, error)

FromDeviceSpec parses the application spec and returns a list of providers.

type Volume added in v0.8.1

type Volume struct {
	// Name is the user defined name for the volume
	Name string
	// ID is a unique internal idenfier used to create the actual volume
	ID string
	// Reference is a the reference used to populate the volume
	Reference string
	// Available is true if the volume has been created
	Available bool
}

type VolumeManager added in v0.8.1

type VolumeManager interface {
	// Get returns the Volume by name, if it exists.
	Get(name string) (*Volume, bool)
	// Add adds a new Volume to the manager.
	Add(volume *Volume)
	// Update updates an existing Volume. Returns true if the volume existed and was updated.
	Update(volume *Volume) bool
	// Remove deletes the Volume by name. Returns true if the volume existed and was removed.
	Remove(name string) bool
	// List returns all managed Volumes.
	List() []*Volume
	// Status populates the given DeviceApplicationStatus with volume status information.
	Status(status *v1alpha1.DeviceApplicationStatus)
	// UpdateStatus processes a Podman event and updates internal volume status as needed.
	UpdateStatus(event *client.PodmanEvent)
}

func NewVolumeManager added in v0.8.1

func NewVolumeManager(log *log.PrefixLogger, appName string, volumes *[]v1alpha1.ApplicationVolume) (VolumeManager, error)

NewVolumeManager returns a new VolumeManager.

Jump to

Keyboard shortcuts

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