Documentation
¶
Index ¶
- Constants
- func AppNeedsNestedExtraction(appSpec *v1beta1.ApplicationProviderSpec) (bool, error)
- func CollectBaseOCITargets(ctx context.Context, rwFactory fileio.ReadWriterFactory, ...) (dependency.OCIPullTargetsByUser, error)
- func GetHelmProviderValuesPath(appName string) string
- func NewAppDataCache() map[string]*AppData
- func ResolveImageAppName(appSpec *v1beta1.ApplicationProviderSpec) (string, error)
- func ResolveImageRef(appSpec *v1beta1.ApplicationProviderSpec) (string, error)
- func ResolveUser(appSpec *v1beta1.ApplicationProviderSpec) (v1beta1.Username, error)
- func ToLifecycleVolumes(volumes []*Volume) []lifecycle.Volume
- type AppData
- type ApplicationSpec
- type CacheEntry
- type Diff
- type OCITargetCache
- type ParseOpt
- type Provider
- type Volume
- type VolumeManager
Constants ¶
const ( AppTypeLabel = "appType" DefaultImageManifestDir = "/" )
Variables ¶
This section is empty.
Functions ¶
func AppNeedsNestedExtraction ¶ added in v1.1.0
func AppNeedsNestedExtraction(appSpec *v1beta1.ApplicationProviderSpec) (bool, error)
AppNeedsNestedExtraction determines if an app needs nested OCI target extraction. Container apps don't need extraction (simple image pull). Helm apps need extraction for chart images. Compose/Quadlet apps need extraction only if image-based (not inline).
func CollectBaseOCITargets ¶ added in v1.0.0
func CollectBaseOCITargets( ctx context.Context, rwFactory fileio.ReadWriterFactory, spec *v1beta1.DeviceSpec, configProvider client.PullConfigProvider, ) (dependency.OCIPullTargetsByUser, error)
CollectBaseOCITargets collects only the base OCI targets (images and volumes) from the device spec without creating providers or extracting nested targets. This is used in phase 1 of prefetching before the base images are available locally.
func GetHelmProviderValuesPath ¶ added in v1.1.0
GetHelmProviderValuesPath returns the absolute path to the provider-generated values file for a given application name.
func NewAppDataCache ¶ added in v1.0.0
NewAppDataCache creates a new app data cache
func ResolveImageAppName ¶ added in v1.0.0
func ResolveImageAppName(appSpec *v1beta1.ApplicationProviderSpec) (string, error)
ResolveImageAppName resolves the canonical application name from an ApplicationProviderSpec. If the spec has an explicit name, it uses that; otherwise, it falls back to the image reference.
func ResolveImageRef ¶ added in v1.1.0
func ResolveImageRef(appSpec *v1beta1.ApplicationProviderSpec) (string, error)
ResolveImageRef extracts the OCI image reference from an app spec based on its type. For Container and Helm apps, returns the image directly. For Compose and Quadlet apps, returns the image from the nested ImageApplicationProviderSpec.
func ResolveUser ¶ added in v1.1.0
func ResolveUser(appSpec *v1beta1.ApplicationProviderSpec) (v1beta1.Username, error)
ResolveUser returns the User association with the application
func ToLifecycleVolumes ¶ added in v0.8.1
ToLifecycleVolumes converts provider volumes to lifecycle volumes
Types ¶
type AppData ¶ added in v1.0.0
type AppData struct {
Owner v1beta1.Username
Targets []dependency.OCIPullTarget
TmpPath string
CleanupFn func() error
}
AppData holds the extracted application data and cleanup function
func ExtractNestedTargetsFromImage ¶ added in v1.0.0
func ExtractNestedTargetsFromImage( ctx context.Context, log *log.PrefixLogger, podmanFactory client.PodmanFactory, clients client.CLIClients, rwFactory fileio.ReadWriterFactory, appSpec *v1beta1.ApplicationProviderSpec, configProvider client.PullConfigProvider, ) (*AppData, error)
ExtractNestedTargetsFromImage extracts nested OCI targets from a single image-based application. This is used by the manager for per-application caching. Returns the extracted app data with targets. Caller is responsible for cleanup.
type ApplicationSpec ¶
type ApplicationSpec struct {
// Name of the application
Name string
// ID of the application
ID string
// Type of the application
AppType v1beta1.AppType
// User that the app should be run under
User v1beta1.Username
// 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
// App-type-specific specs (only one will be set based on AppType)
ContainerApp *v1beta1.ContainerApplication
HelmApp *v1beta1.HelmApplication
ComposeApp *v1beta1.ComposeApplication
QuadletApp *v1beta1.QuadletApplication
// contains filtered or unexported fields
}
type CacheEntry ¶ added in v1.0.0
type CacheEntry struct {
Name string
Owner v1beta1.Username
// Parent is the parent image from which child OCI targets were extracted.
Parent dependency.OCIPullTarget
// Children are OCI targets extracted from parent image.
Children []dependency.OCIPullTarget
}
CacheEntry represents cached nested targets extracted from image-based applications.
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
}
type OCITargetCache ¶ added in v1.0.0
type OCITargetCache struct {
// contains filtered or unexported fields
}
OCITargetCache caches child OCI targets extracted from parents.
func NewOCITargetCache ¶ added in v1.0.0
func NewOCITargetCache() *OCITargetCache
NewOCITargetCache creates a new cache instance
func (*OCITargetCache) Clear ¶ added in v1.0.0
func (c *OCITargetCache) Clear()
Clear removes all entries from the cache
func (*OCITargetCache) GC ¶ added in v1.0.0
func (c *OCITargetCache) GC(activeNames []string)
GC removes cache entries for entities not in the activeNames list. This prevents unbounded cache growth as entities are added/removed.
func (*OCITargetCache) Get ¶ added in v1.0.0
func (c *OCITargetCache) Get(name string) (CacheEntry, bool)
Get retrieves cached nested targets for the given entity name. Returns the entry and true if found, empty entry and false otherwise.
func (*OCITargetCache) Len ¶ added in v1.0.0
func (c *OCITargetCache) Len() int
Len returns the number of entries in the cache
func (*OCITargetCache) Set ¶ added in v1.0.0
func (c *OCITargetCache) Set(entry CacheEntry)
Set stores a cache entry.
type ParseOpt ¶
type ParseOpt func(*parseConfig)
func WithAppDataCache ¶ added in v1.0.0
func WithEmbedded ¶
func WithInstalledEmbedded ¶ added in v1.0.0
func WithInstalledEmbedded() ParseOpt
func WithProviderTypes ¶
func WithProviderTypes(providerTypes ...v1beta1.ApplicationProviderType) ParseOpt
func WithVerify ¶ added in v0.9.0
func WithVerify() ParseOpt
type Provider ¶
type Provider interface {
// 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
// ID returns the unique identifier for the application.
ID() 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, podmanFactory client.PodmanFactory, clients client.CLIClients, rwFactory fileio.ReadWriterFactory, spec *v1beta1.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 the reference used to populate the volume
Reference string
// Available is true if the volume has been created
Available bool
// ReclaimPolicy controls how the volume is handled when the application is removed
ReclaimPolicy v1beta1.ApplicationVolumeReclaimPolicy
}
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 *v1beta1.DeviceApplicationStatus)
// UpdateStatus processes a Podman event and updates internal volume status as needed.
UpdateStatus(event *client.PodmanEvent)
// AddVolumes adds all specified volumes to the manager. An ID will be added if one does not exist
AddVolumes([]*Volume)
}
func NewVolumeManager ¶ added in v0.8.1
func NewVolumeManager(log *log.PrefixLogger, appName string, appType v1beta1.AppType, volumes *[]v1beta1.ApplicationVolume) (VolumeManager, error)
NewVolumeManager returns a new VolumeManager.