applications

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package applications is a generated GoMock package.

Index

Constants

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

Variables

This section is empty.

Functions

func EnsureDependenciesFromType

func EnsureDependenciesFromType(appType AppType) error

EnsureDependenciesFromType ensures that the dependencies required for the given app type are available.

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

func NewApplication[T any](name string, provider T, appType AppType) *application[T]

Types

type AppType

type AppType string
const (
	AppCompose AppType = "compose"
)

func ParseAppType

func ParseAppType(s string) (AppType, error)

func TypeFromImage

func TypeFromImage(ctx context.Context, podman *client.Podman, image string) (AppType, error)

TypeFromImage returns the app type from the image label.

func (AppType) ActionHandler

func (a AppType) ActionHandler() (lifecycle.ActionHandlerType, error)

type Application

type Application interface {
	Name() string
	Type() AppType
	EnvVars() map[string]string
	SetEnvVars(envVars map[string]string) bool
	Path() (string, error)
	Container(name string) (*Container, bool)
	AddContainer(container Container)
	RemoveContainer(name string) bool
	IsEmbedded() bool
	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 (
	ContainerStatusInit    ContainerStatusType = "init"
	ContainerStatusRunning ContainerStatusType = "start"
	ContainerStatusDie     ContainerStatusType = "die" // docker only
	ContainerStatusDied    ContainerStatusType = "died"
	ContainerStatusRemove  ContainerStatusType = "remove"
	ContainerStatusExited  ContainerStatusType = "exited"
)

func (ContainerStatusType) String

func (c ContainerStatusType) String() string

func (ContainerStatusType) Vaild

func (c ContainerStatusType) Vaild() bool

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
	ExecuteActions(ctx context.Context) error
	Status() ([]v1alpha1.DeviceApplicationStatus, v1alpha1.DeviceApplicationsSummaryStatus, error)
	Stop(ctx context.Context) error
}

func NewManager

func NewManager(log *log.PrefixLogger, exec executer.Executer, podmanClient *client.Podman) Manager

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

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) IsEmbedded

func (m *MockApplication) IsEmbedded() bool

IsEmbedded mocks base method.

func (*MockApplication) Name

func (m *MockApplication) Name() string

Name 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

Status mocks base method.

func (*MockApplication) Type

func (m *MockApplication) Type() AppType

Type 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) IsEmbedded

func (mr *MockApplicationMockRecorder) IsEmbedded() *gomock.Call

IsEmbedded indicates an expected call of IsEmbedded.

func (*MockApplicationMockRecorder) Name

Name indicates an expected call of Name.

func (*MockApplicationMockRecorder) Path

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

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) 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) ExecuteActions

func (m *MockManager) ExecuteActions(ctx context.Context) error

ExecuteActions mocks base method.

func (*MockManager) Remove

func (m *MockManager) Remove(app Application) error

Remove mocks base method.

func (*MockManager) Status

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) Ensure

func (mr *MockManagerMockRecorder) Ensure(app any) *gomock.Call

Ensure indicates an expected call of Ensure.

func (*MockManagerMockRecorder) ExecuteActions

func (mr *MockManagerMockRecorder) ExecuteActions(ctx any) *gomock.Call

ExecuteActions indicates an expected call of ExecuteActions.

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() *gomock.Call

Status indicates an expected call of Status.

func (*MockManagerMockRecorder) Stop

func (mr *MockManagerMockRecorder) Stop(ctx any) *gomock.Call

Stop indicates an expected call of Stop.

func (*MockManagerMockRecorder) Update

func (mr *MockManagerMockRecorder) Update(app any) *gomock.Call

Update indicates an expected call of Update.

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) Run

func (m *MockMonitor) Run(ctx context.Context)

Run mocks base method.

func (*MockMonitor) Status

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 PodmanContainerConfig struct {
	Labels map[string]string `json:"Labels"`
}

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 PodmanEvent struct {
	ID         string            `json:"ID"`
	Image      string            `json:"Image"`
	Name       string            `json:"Name"`
	Status     string            `json:"Status"`
	Type       string            `json:"Type"`
	Attributes map[string]string `json:"Attributes"`
}

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) *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) Run

func (m *PodmanMonitor) Run(ctx context.Context) error

func (*PodmanMonitor) Stop

func (m *PodmanMonitor) Stop(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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