Documentation
¶
Overview ¶
Package applications is a generated GoMock package.
Index ¶
- Constants
- func ImageProvidersFromSpec(spec *v1alpha1.RenderedDeviceSpec) ([]v1alpha1.ImageApplicationProvider, error)
- func NewApplication[T any](id, name string, provider T, appType AppType) *application[T]
- type AppType
- type Application
- type Container
- type ContainerStatusType
- type Controller
- type EmbeddedProvider
- type Manager
- type MockApplication
- func (m *MockApplication) AddContainer(container Container)
- func (m *MockApplication) Container(name string) (*Container, bool)
- func (m *MockApplication) EXPECT() *MockApplicationMockRecorder
- func (m *MockApplication) EnvVars() map[string]string
- func (m *MockApplication) ID() string
- func (m *MockApplication) IsEmbedded() bool
- func (m *MockApplication) Name() string
- func (m *MockApplication) Path() (string, error)
- func (m *MockApplication) RemoveContainer(name string) bool
- func (m *MockApplication) SetEnvVars(envVars map[string]string) bool
- func (m *MockApplication) Status() (*v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, ...)
- func (m *MockApplication) Type() AppType
- type MockApplicationMockRecorder
- func (mr *MockApplicationMockRecorder) AddContainer(container any) *gomock.Call
- func (mr *MockApplicationMockRecorder) Container(name any) *gomock.Call
- func (mr *MockApplicationMockRecorder) EnvVars() *gomock.Call
- func (mr *MockApplicationMockRecorder) ID() *gomock.Call
- func (mr *MockApplicationMockRecorder) IsEmbedded() *gomock.Call
- func (mr *MockApplicationMockRecorder) Name() *gomock.Call
- func (mr *MockApplicationMockRecorder) Path() *gomock.Call
- func (mr *MockApplicationMockRecorder) RemoveContainer(name any) *gomock.Call
- func (mr *MockApplicationMockRecorder) SetEnvVars(envVars any) *gomock.Call
- func (mr *MockApplicationMockRecorder) Status() *gomock.Call
- func (mr *MockApplicationMockRecorder) Type() *gomock.Call
- type MockManager
- func (m *MockManager) AfterUpdate(ctx context.Context) error
- func (m *MockManager) BeforeUpdate(ctx context.Context, desired *v1alpha1.RenderedDeviceSpec) error
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) Ensure(app Application) error
- func (m *MockManager) Remove(app Application) error
- func (m *MockManager) Status(arg0 context.Context, arg1 *v1alpha1.DeviceStatus) error
- func (m *MockManager) Stop(ctx context.Context) error
- func (m *MockManager) Update(app Application) error
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) AfterUpdate(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) BeforeUpdate(ctx, desired any) *gomock.Call
- func (mr *MockManagerMockRecorder) Ensure(app any) *gomock.Call
- func (mr *MockManagerMockRecorder) Remove(app any) *gomock.Call
- func (mr *MockManagerMockRecorder) Status(arg0, arg1 any) *gomock.Call
- func (mr *MockManagerMockRecorder) Stop(ctx any) *gomock.Call
- func (mr *MockManagerMockRecorder) Update(app any) *gomock.Call
- type MockMonitor
- type MockMonitorMockRecorder
- type Monitor
- type PodmanContainerConfig
- type PodmanContainerState
- type PodmanEvent
- type PodmanInspect
- type PodmanMonitor
- func (m *PodmanMonitor) ExecuteActions(ctx context.Context) error
- func (m *PodmanMonitor) Initialize()
- func (m *PodmanMonitor) IsInitialized() bool
- func (m *PodmanMonitor) Run(ctx context.Context) error
- func (m *PodmanMonitor) Status() ([]v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, ...)
- func (m *PodmanMonitor) Stop(ctx context.Context) error
Constants ¶
const ( AppTypeLabel = "appType" DefaultImageManifestDir = "/" )
Variables ¶
This section is empty.
Functions ¶
func ImageProvidersFromSpec ¶
func ImageProvidersFromSpec(spec *v1alpha1.RenderedDeviceSpec) ([]v1alpha1.ImageApplicationProvider, error)
ImageProvidersFromSpec returns a list of image application providers from a rendered device spec.
func NewApplication ¶
Types ¶
type AppType ¶
type AppType string
const (
AppCompose AppType = "compose"
)
func ParseAppType ¶
func (AppType) ActionHandler ¶
func (a AppType) ActionHandler() (lifecycle.ActionHandlerType, error)
type Application ¶
type Application interface {
// ID is an internal identifier for tracking the application this may or may
// not be the name provided by the user. How this ID is generated is
// determined on the application type level.
ID() string
// Name is the name of the application as defined by the user. If the name
// is not populated by the user a name will be generated based on the
// application type.
Name() string
// Type returns the application type.
Type() AppType
// EnvVars returns the environment variables for the application.
EnvVars() map[string]string
// SetEnvVars sets the environment variables for the application.
SetEnvVars(envVars map[string]string) bool
// Path returns the path to the application on the device.
Path() (string, error)
// Container returns a container by name.
Container(name string) (*Container, bool)
// AddContainer adds a container to the application.
AddContainer(container Container)
// RemoveContainer removes a container from the application.
RemoveContainer(name string) bool
// IsEmbedded returns true if the application is embedded.
IsEmbedded() bool
// Status reports the status of an application using the name as defined by
// the user. In the case there is no name provided it will be populated
// according to the rules of the application type.
Status() (*v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, error)
}
type Container ¶
type Container struct {
ID string
Image string
Name string
Status ContainerStatusType
Restarts int
}
type ContainerStatusType ¶
type ContainerStatusType string
const ( ContainerStatusCreated ContainerStatusType = "created" ContainerStatusInit ContainerStatusType = "init" ContainerStatusRunning ContainerStatusType = "start" ContainerStatusStop ContainerStatusType = "stop" ContainerStatusDie ContainerStatusType = "die" // docker only ContainerStatusDied ContainerStatusType = "died" ContainerStatusRemove ContainerStatusType = "remove" ContainerStatusExited ContainerStatusType = "exited" )
func (ContainerStatusType) String ¶
func (c ContainerStatusType) String() string
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController( podman *client.Podman, manager Manager, readWriter fileio.ReadWriter, log *log.PrefixLogger, ) *Controller
func (*Controller) Sync ¶
func (c *Controller) Sync(ctx context.Context, current, desired *v1alpha1.RenderedDeviceSpec) error
type EmbeddedProvider ¶
type EmbeddedProvider struct{}
EmbeddedProvider is a provider for embedded applications.
type Manager ¶
type Manager interface {
Ensure(app Application) error
Remove(app Application) error
Update(app Application) error
BeforeUpdate(ctx context.Context, desired *v1alpha1.RenderedDeviceSpec) error
AfterUpdate(ctx context.Context) error
Stop(ctx context.Context) error
status.Exporter
}
func NewManager ¶
type MockApplication ¶
type MockApplication struct {
// contains filtered or unexported fields
}
MockApplication is a mock of Application interface.
func NewMockApplication ¶
func NewMockApplication(ctrl *gomock.Controller) *MockApplication
NewMockApplication creates a new mock instance.
func (*MockApplication) AddContainer ¶
func (m *MockApplication) AddContainer(container Container)
AddContainer mocks base method.
func (*MockApplication) Container ¶
func (m *MockApplication) Container(name string) (*Container, bool)
Container mocks base method.
func (*MockApplication) EXPECT ¶
func (m *MockApplication) EXPECT() *MockApplicationMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockApplication) EnvVars ¶
func (m *MockApplication) EnvVars() map[string]string
EnvVars mocks base method.
func (*MockApplication) ID ¶ added in v0.4.0
func (m *MockApplication) ID() string
ID mocks base method.
func (*MockApplication) IsEmbedded ¶
func (m *MockApplication) IsEmbedded() bool
IsEmbedded mocks base method.
func (*MockApplication) Path ¶
func (m *MockApplication) Path() (string, error)
Path mocks base method.
func (*MockApplication) RemoveContainer ¶
func (m *MockApplication) RemoveContainer(name string) bool
RemoveContainer mocks base method.
func (*MockApplication) SetEnvVars ¶
func (m *MockApplication) SetEnvVars(envVars map[string]string) bool
SetEnvVars mocks base method.
func (*MockApplication) Status ¶
func (m *MockApplication) Status() (*v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, error)
Status mocks base method.
type MockApplicationMockRecorder ¶
type MockApplicationMockRecorder struct {
// contains filtered or unexported fields
}
MockApplicationMockRecorder is the mock recorder for MockApplication.
func (*MockApplicationMockRecorder) AddContainer ¶
func (mr *MockApplicationMockRecorder) AddContainer(container any) *gomock.Call
AddContainer indicates an expected call of AddContainer.
func (*MockApplicationMockRecorder) Container ¶
func (mr *MockApplicationMockRecorder) Container(name any) *gomock.Call
Container indicates an expected call of Container.
func (*MockApplicationMockRecorder) EnvVars ¶
func (mr *MockApplicationMockRecorder) EnvVars() *gomock.Call
EnvVars indicates an expected call of EnvVars.
func (*MockApplicationMockRecorder) ID ¶ added in v0.4.0
func (mr *MockApplicationMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockApplicationMockRecorder) IsEmbedded ¶
func (mr *MockApplicationMockRecorder) IsEmbedded() *gomock.Call
IsEmbedded indicates an expected call of IsEmbedded.
func (*MockApplicationMockRecorder) Name ¶
func (mr *MockApplicationMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockApplicationMockRecorder) Path ¶
func (mr *MockApplicationMockRecorder) Path() *gomock.Call
Path indicates an expected call of Path.
func (*MockApplicationMockRecorder) RemoveContainer ¶
func (mr *MockApplicationMockRecorder) RemoveContainer(name any) *gomock.Call
RemoveContainer indicates an expected call of RemoveContainer.
func (*MockApplicationMockRecorder) SetEnvVars ¶
func (mr *MockApplicationMockRecorder) SetEnvVars(envVars any) *gomock.Call
SetEnvVars indicates an expected call of SetEnvVars.
func (*MockApplicationMockRecorder) Status ¶
func (mr *MockApplicationMockRecorder) Status() *gomock.Call
Status indicates an expected call of Status.
func (*MockApplicationMockRecorder) Type ¶
func (mr *MockApplicationMockRecorder) Type() *gomock.Call
Type indicates an expected call of Type.
type MockManager ¶
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) AfterUpdate ¶ added in v0.4.0
func (m *MockManager) AfterUpdate(ctx context.Context) error
AfterUpdate mocks base method.
func (*MockManager) BeforeUpdate ¶ added in v0.4.0
func (m *MockManager) BeforeUpdate(ctx context.Context, desired *v1alpha1.RenderedDeviceSpec) error
BeforeUpdate mocks base method.
func (*MockManager) EXPECT ¶
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) Ensure ¶
func (m *MockManager) Ensure(app Application) error
Ensure mocks base method.
func (*MockManager) Remove ¶
func (m *MockManager) Remove(app Application) error
Remove mocks base method.
func (*MockManager) Status ¶
func (m *MockManager) Status(arg0 context.Context, arg1 *v1alpha1.DeviceStatus) error
Status mocks base method.
func (*MockManager) Stop ¶
func (m *MockManager) Stop(ctx context.Context) error
Stop mocks base method.
func (*MockManager) Update ¶
func (m *MockManager) Update(app Application) error
Update mocks base method.
type MockManagerMockRecorder ¶
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) AfterUpdate ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) AfterUpdate(ctx any) *gomock.Call
AfterUpdate indicates an expected call of AfterUpdate.
func (*MockManagerMockRecorder) BeforeUpdate ¶ added in v0.4.0
func (mr *MockManagerMockRecorder) BeforeUpdate(ctx, desired any) *gomock.Call
BeforeUpdate indicates an expected call of BeforeUpdate.
func (*MockManagerMockRecorder) Ensure ¶
func (mr *MockManagerMockRecorder) Ensure(app any) *gomock.Call
Ensure indicates an expected call of Ensure.
func (*MockManagerMockRecorder) Remove ¶
func (mr *MockManagerMockRecorder) Remove(app any) *gomock.Call
Remove indicates an expected call of Remove.
func (*MockManagerMockRecorder) Status ¶
func (mr *MockManagerMockRecorder) Status(arg0, arg1 any) *gomock.Call
Status indicates an expected call of Status.
type MockMonitor ¶
type MockMonitor struct {
// contains filtered or unexported fields
}
MockMonitor is a mock of Monitor interface.
func NewMockMonitor ¶
func NewMockMonitor(ctrl *gomock.Controller) *MockMonitor
NewMockMonitor creates a new mock instance.
func (*MockMonitor) EXPECT ¶
func (m *MockMonitor) EXPECT() *MockMonitorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMonitor) Status ¶
func (m *MockMonitor) Status() []v1alpha1.DeviceApplicationStatus
Status mocks base method.
type MockMonitorMockRecorder ¶
type MockMonitorMockRecorder struct {
// contains filtered or unexported fields
}
MockMonitorMockRecorder is the mock recorder for MockMonitor.
func (*MockMonitorMockRecorder) Run ¶
func (mr *MockMonitorMockRecorder) Run(ctx any) *gomock.Call
Run indicates an expected call of Run.
func (*MockMonitorMockRecorder) Status ¶
func (mr *MockMonitorMockRecorder) Status() *gomock.Call
Status indicates an expected call of Status.
type Monitor ¶
type Monitor interface {
Run(ctx context.Context)
Status() []v1alpha1.DeviceApplicationStatus
}
type PodmanContainerConfig ¶
type PodmanContainerState ¶
type PodmanContainerState struct {
OciVersion string `json:"OciVersion"`
Status string `json:"Status"`
Running bool `json:"Running"`
Paused bool `json:"Paused"`
Restarting bool `json:"Restarting"`
OOMKilled bool `json:"OOMKilled"`
Dead bool `json:"Dead"`
Pid int `json:"Pid"`
ExitCode int `json:"ExitCode"`
Error string `json:"Error"`
StartedAt string `json:"StartedAt"`
FinishedAt string `json:"FinishedAt"`
Healthcheck string `json:"Healthcheck"`
}
ContainerState represents the container state part of the podman inspect output
type PodmanEvent ¶
type PodmanInspect ¶
type PodmanInspect struct {
Restarts int `json:"RestartCount"`
State PodmanContainerState `json:"State"`
Config PodmanContainerConfig `json:"Config"`
}
PodmanInspect represents the overall structure of podman inspect output
type PodmanMonitor ¶
type PodmanMonitor struct {
// contains filtered or unexported fields
}
func NewPodmanMonitor ¶
func NewPodmanMonitor(log *log.PrefixLogger, exec executer.Executer, podman *client.Podman, bootTime string) *PodmanMonitor
func (*PodmanMonitor) ExecuteActions ¶
func (m *PodmanMonitor) ExecuteActions(ctx context.Context) error
func (*PodmanMonitor) Initialize ¶
func (m *PodmanMonitor) Initialize()
func (*PodmanMonitor) IsInitialized ¶
func (m *PodmanMonitor) IsInitialized() bool
func (*PodmanMonitor) Status ¶
func (m *PodmanMonitor) Status() ([]v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, error)