Documentation
¶
Overview ¶
Package provider is a generated GoMock package.
Index ¶
- Constants
- func AppNeedsNestedExtraction(appSpec *v1beta1.ApplicationProviderSpec) (bool, error)
- func CollectOCITargets(ctx context.Context, log *log.PrefixLogger, podmanFactory client.PodmanFactory, ...) (*dependency.OCICollection, 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 CollectOpt
- type Diff
- type MockProvider
- func (m *MockProvider) EXPECT() *MockProviderMockRecorder
- func (m *MockProvider) EnsureDependencies(ctx context.Context) error
- func (m *MockProvider) ID() string
- func (m *MockProvider) Install(ctx context.Context) error
- func (m *MockProvider) Name() string
- func (m *MockProvider) Remove(ctx context.Context) error
- func (m *MockProvider) Spec() *ApplicationSpec
- func (m *MockProvider) Verify(ctx context.Context) error
- type MockProviderMockRecorder
- func (mr *MockProviderMockRecorder) EnsureDependencies(ctx any) *gomock.Call
- func (mr *MockProviderMockRecorder) ID() *gomock.Call
- func (mr *MockProviderMockRecorder) Install(ctx any) *gomock.Call
- func (mr *MockProviderMockRecorder) Name() *gomock.Call
- func (mr *MockProviderMockRecorder) Remove(ctx any) *gomock.Call
- func (mr *MockProviderMockRecorder) Spec() *gomock.Call
- func (mr *MockProviderMockRecorder) Verify(ctx any) *gomock.Call
- type MockappProvider
- func (m *MockappProvider) EXPECT() *MockappProviderMockRecorder
- func (m *MockappProvider) EnsureDependencies(ctx context.Context) error
- func (m *MockappProvider) ID() string
- func (m *MockappProvider) Install(ctx context.Context) error
- func (m *MockappProvider) Name() string
- func (m *MockappProvider) Remove(ctx context.Context) error
- func (m *MockappProvider) Spec() *ApplicationSpec
- func (m *MockappProvider) Verify(ctx context.Context) error
- type MockappProviderMockRecorder
- func (mr *MockappProviderMockRecorder) EnsureDependencies(ctx any) *gomock.Call
- func (mr *MockappProviderMockRecorder) ID() *gomock.Call
- func (mr *MockappProviderMockRecorder) Install(ctx any) *gomock.Call
- func (mr *MockappProviderMockRecorder) Name() *gomock.Call
- func (mr *MockappProviderMockRecorder) Remove(ctx any) *gomock.Call
- func (mr *MockappProviderMockRecorder) Spec() *gomock.Call
- func (mr *MockappProviderMockRecorder) Verify(ctx any) *gomock.Call
- 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 CollectOCITargets ¶ added in v1.1.0
func CollectOCITargets( ctx context.Context, log *log.PrefixLogger, podmanFactory client.PodmanFactory, clients client.CLIClients, rwFactory fileio.ReadWriterFactory, spec *v1beta1.DeviceSpec, opts ...CollectOpt, ) (*dependency.OCICollection, error)
CollectOCITargets collects all OCI targets from the device spec, including: - Base images and volumes from each application - Nested images extracted from image-based applications (when parent is available) It handles dependency checking, caching, and deferred extraction.
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, resolver dependency.PullConfigResolver, ) (*AppData, error)
ExtractNestedTargetsFromImage extracts nested OCI targets from a single image-based application. This is called when the parent artifact is known to be available locally. 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 CollectOpt ¶ added in v1.1.0
type CollectOpt func(*collectConfig)
CollectOpt is a functional option for CollectOCITargets.
func WithAppData ¶ added in v1.1.0
func WithAppData(cache map[string]*AppData) CollectOpt
WithAppData sets the cache for storing extracted application data.
func WithOCICache ¶ added in v1.1.0
func WithOCICache(cache *OCITargetCache) CollectOpt
WithOCICache sets the cache for storing extracted nested OCI targets.
func WithPullConfigResolver ¶ added in v1.1.0
func WithPullConfigResolver(p dependency.PullConfigResolver) CollectOpt
WithPullConfigResolver sets the pull configuration provider for OCI operations.
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 MockProvider ¶ added in v1.1.0
type MockProvider struct {
// contains filtered or unexported fields
}
MockProvider is a mock of Provider interface.
func NewMockProvider ¶ added in v1.1.0
func NewMockProvider(ctrl *gomock.Controller) *MockProvider
NewMockProvider creates a new mock instance.
func (*MockProvider) EXPECT ¶ added in v1.1.0
func (m *MockProvider) EXPECT() *MockProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProvider) EnsureDependencies ¶ added in v1.1.0
func (m *MockProvider) EnsureDependencies(ctx context.Context) error
EnsureDependencies mocks base method.
func (*MockProvider) Install ¶ added in v1.1.0
func (m *MockProvider) Install(ctx context.Context) error
Install mocks base method.
func (*MockProvider) Name ¶ added in v1.1.0
func (m *MockProvider) Name() string
Name mocks base method.
func (*MockProvider) Remove ¶ added in v1.1.0
func (m *MockProvider) Remove(ctx context.Context) error
Remove mocks base method.
func (*MockProvider) Spec ¶ added in v1.1.0
func (m *MockProvider) Spec() *ApplicationSpec
Spec mocks base method.
type MockProviderMockRecorder ¶ added in v1.1.0
type MockProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockProviderMockRecorder is the mock recorder for MockProvider.
func (*MockProviderMockRecorder) EnsureDependencies ¶ added in v1.1.0
func (mr *MockProviderMockRecorder) EnsureDependencies(ctx any) *gomock.Call
EnsureDependencies indicates an expected call of EnsureDependencies.
func (*MockProviderMockRecorder) ID ¶ added in v1.1.0
func (mr *MockProviderMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockProviderMockRecorder) Install ¶ added in v1.1.0
func (mr *MockProviderMockRecorder) Install(ctx any) *gomock.Call
Install indicates an expected call of Install.
func (*MockProviderMockRecorder) Name ¶ added in v1.1.0
func (mr *MockProviderMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockProviderMockRecorder) Remove ¶ added in v1.1.0
func (mr *MockProviderMockRecorder) Remove(ctx any) *gomock.Call
Remove indicates an expected call of Remove.
func (*MockProviderMockRecorder) Spec ¶ added in v1.1.0
func (mr *MockProviderMockRecorder) Spec() *gomock.Call
Spec indicates an expected call of Spec.
type MockappProvider ¶ added in v1.1.0
type MockappProvider struct {
// contains filtered or unexported fields
}
MockappProvider is a mock of appProvider interface.
func NewMockappProvider ¶ added in v1.1.0
func NewMockappProvider(ctrl *gomock.Controller) *MockappProvider
NewMockappProvider creates a new mock instance.
func (*MockappProvider) EXPECT ¶ added in v1.1.0
func (m *MockappProvider) EXPECT() *MockappProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockappProvider) EnsureDependencies ¶ added in v1.1.0
func (m *MockappProvider) EnsureDependencies(ctx context.Context) error
EnsureDependencies mocks base method.
func (*MockappProvider) ID ¶ added in v1.1.0
func (m *MockappProvider) ID() string
ID mocks base method.
func (*MockappProvider) Install ¶ added in v1.1.0
func (m *MockappProvider) Install(ctx context.Context) error
Install mocks base method.
func (*MockappProvider) Name ¶ added in v1.1.0
func (m *MockappProvider) Name() string
Name mocks base method.
func (*MockappProvider) Remove ¶ added in v1.1.0
func (m *MockappProvider) Remove(ctx context.Context) error
Remove mocks base method.
func (*MockappProvider) Spec ¶ added in v1.1.0
func (m *MockappProvider) Spec() *ApplicationSpec
Spec mocks base method.
type MockappProviderMockRecorder ¶ added in v1.1.0
type MockappProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockappProviderMockRecorder is the mock recorder for MockappProvider.
func (*MockappProviderMockRecorder) EnsureDependencies ¶ added in v1.1.0
func (mr *MockappProviderMockRecorder) EnsureDependencies(ctx any) *gomock.Call
EnsureDependencies indicates an expected call of EnsureDependencies.
func (*MockappProviderMockRecorder) ID ¶ added in v1.1.0
func (mr *MockappProviderMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockappProviderMockRecorder) Install ¶ added in v1.1.0
func (mr *MockappProviderMockRecorder) Install(ctx any) *gomock.Call
Install indicates an expected call of Install.
func (*MockappProviderMockRecorder) Name ¶ added in v1.1.0
func (mr *MockappProviderMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockappProviderMockRecorder) Remove ¶ added in v1.1.0
func (mr *MockappProviderMockRecorder) Remove(ctx any) *gomock.Call
Remove indicates an expected call of Remove.
func (*MockappProviderMockRecorder) Spec ¶ added in v1.1.0
func (mr *MockappProviderMockRecorder) Spec() *gomock.Call
Spec indicates an expected call of Spec.
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 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
// EnsureDependencies checks that the required binaries and their versions
// for this application type are available.
EnsureDependencies(ctx context.Context) error
}
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, user v1beta1.Username, volumes *[]v1beta1.ApplicationVolume) (VolumeManager, error)
NewVolumeManager returns a new VolumeManager.