entity

package
v0.0.0-...-d79ed59 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnsibleWorkload

type AnsibleWorkload struct {
	Playbook string
}

AnsibleWorkload represents ansible workload.

func (AnsibleWorkload) Hash

func (a AnsibleWorkload) Hash() string

func (AnsibleWorkload) Kind

func (a AnsibleWorkload) Kind() WorkloadKind

func (AnsibleWorkload) String

func (a AnsibleWorkload) String() string

type Boot

type Boot struct {
	// current boot mode
	CurrentBootMode string

	// pxe interface
	PxeInterface string
}

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder(w Workload) *Builder

func (*Builder) Build

func (jb *Builder) Build() (*Job, error)

func (*Builder) WithConstantRetry

func (jb *Builder) WithConstantRetry(retryInterval time.Duration) *Builder

func (*Builder) WithCron

func (jb *Builder) WithCron(cronSpec string) *Builder

func (*Builder) WithExponentialRetry

func (jb *Builder) WithExponentialRetry(initialInterval time.Duration, maxInterval time.Duration, multiplier float64) *Builder

type CPU

type CPU struct {
	// architecture
	Architecture string

	// count
	Count int64

	// flags
	Flags []string

	// frequency
	Frequency float64

	// model name
	ModelName string
}

type CronJob

type CronJob struct {
	// contains filtered or unexported fields
}

func (*CronJob) CanReconcile

func (cj *CronJob) CanReconcile() bool

func (*CronJob) ComputeNext

func (cj *CronJob) ComputeNext()

func (*CronJob) Next

func (cj *CronJob) Next() time.Time

type DeviceConfiguration

type DeviceConfiguration struct {
	// Heartbeat configuration
	Heartbeat HeartbeatConfiguration

	// List of user defined mounts
	Mounts []Mount

	// Os information
	OsInformation OsInformation

	Profiles map[string]map[string]string
}

func (DeviceConfiguration) Hash

func (d DeviceConfiguration) Hash() string

func (DeviceConfiguration) String

func (d DeviceConfiguration) String() string

type DeviceConfigurationMessage

type DeviceConfigurationMessage struct {
	// configuration
	Configuration DeviceConfiguration

	// Device identifier
	DeviceID string

	// Version
	Version string

	// list of workloads
	Workloads []Workload

	// Defines the interval in seconds between the attempts to evaluate the workloads status and restart those that failed
	// Minimum: > 0
	WorkloadsMonitoringInterval time.Duration
}

func (DeviceConfigurationMessage) Hash

func (DeviceConfigurationMessage) String

type DeviceProfile

type DeviceProfile struct {
	// Name is the name of the profile
	Name string
	// Conditions holds profile's conditions.
	Conditions []ProfileCondition
}
DeviceProfile specify all the conditions of a profile:

```yaml state:

  • perfomance:
  • low: cpu<25%
  • medium: cpu>25%

``` In this example the profile is _perfomance_ and the conditions are _low_ and _medium_. Each condition's expression is evaluated using Variables. The expression is only evaluated when all the variables need it by the expression are present in the variable map.

type Disk

type Disk struct {
	// bootable
	Bootable bool

	// by-id is the World Wide Number of the device which guaranteed to be unique for every storage device
	ByID string

	// by-path is the shortest physical path to the device
	ByPath string

	// drive type
	DriveType string

	// hctl
	Hctl string

	// Determine the disk's unique identifier which is the by-id field if it exists and fallback to the by-path field otherwise
	ID string

	// io perf
	IoPerf *IoPerf

	// Whether the disk appears to be an installation media or not
	IsInstallationMedia bool

	// model
	Model string

	// name
	Name string

	// path
	Path string

	// serial
	Serial string

	// size bytes
	SizeBytes int64

	// smart
	Smart string

	// vendor
	Vendor string

	// wwn
	Wwn string
}

type EnrolementInfo

type EnrolementInfo struct {
	// features
	Features EnrolmentInfoFeatures

	// target namespace
	TargetNamespace string
}

type EnrolmentInfoFeatures

type EnrolmentInfoFeatures struct {
	// hardware
	Hardware HardwareInfo

	// model name
	ModelName string
}

type EventInfo

type EventInfo struct {
	// Message describe the event which has occured.
	Message string

	// Reason is single word description of the subject of the event.
	Reason string

	// Either 'info' or 'warn', which reflect the importance of event.
	// Enum: [info warn]
	Type EventType
}

type EventType

type EventType int
const (
	Info EventType = iota
	Warn
)

func (EventType) String

func (e EventType) String() string

type Future

type Future[T any] struct {
	CancelFunc context.CancelFunc
	// contains filtered or unexported fields
}

func NewFuture

func NewFuture[T any](input chan T) *Future[T]

func (*Future[T]) Poll

func (f *Future[T]) Poll() (value T, isResolved bool)

func (*Future[T]) Resolved

func (f *Future[T]) Resolved() bool

type Gpu

type Gpu struct {

	// Device address (for example "0000:00:02.0")
	Address string

	// ID of the device (for example "3ea0")
	DeviceID string

	// Product name of the device (for example "UHD Graphics 620 (Whiskey Lake)")
	Name string

	// The name of the device vendor (for example "Intel Corporation")
	Vendor string

	// ID of the vendor (for example "8086")
	VendorID string
}

type HardwareInfo

type HardwareInfo struct {
	Boot         Boot
	CPU          CPU
	Disks        []Disk
	Gpus         []Gpu
	HostDevices  []HostDevice
	Hostname     string
	Interfaces   []Interface
	Memory       Memory
	Mounts       []Mount
	SystemVendor SystemVendor
}

type HardwareProfileConfiguration

type HardwareProfileConfiguration struct {
	Include bool
	Scope   Scope
}

type HearbeatStatus

type HearbeatStatus int
const (
	Up HearbeatStatus = iota
	Degraded
)

func (HearbeatStatus) String

func (hs HearbeatStatus) String() string

type Heartbeat

type Heartbeat struct {
	// Events produced by device worker.
	Events []*EventInfo

	// hardware
	Hardware *HardwareInfo

	// status
	// Enum: [up degraded]
	Status HearbeatStatus

	// upgrade
	Upgrade *UpgradeStatus

	// version
	Version string

	// workloads
	Workloads []*WorkloadStatus
}

type HeartbeatConfiguration

type HeartbeatConfiguration struct {
	HardwareProfile HardwareProfileConfiguration

	// period in seconds
	Period time.Duration
}

func (HeartbeatConfiguration) String

func (h HeartbeatConfiguration) String() string

type HostDevice

type HostDevice struct {

	// Type of the device
	DeviceType string

	// Group id
	Gid int64

	// Major of the device
	Major int64

	// Minor of the device
	Minor int64

	// Path of the device
	Path string

	// Owner id
	UID int64
}

type Interface

type Interface struct {

	// biosdevname
	Biosdevname string

	// client id
	ClientID string

	// flags
	Flags []string

	// has carrier
	HasCarrier bool

	// ipv4 addresses
	IPV4Addresses []string

	// ipv6 addresses
	IPV6Addresses []string

	// mac address
	MacAddress string

	// mtu
	Mtu int64

	// name
	Name string

	// product
	Product string

	// speed mbps
	SpeedMbps int64

	// vendor
	Vendor string
}

type IoPerf

type IoPerf struct {
	// 99th percentile of fsync duration in milliseconds
	SyncDuration int64
}

type Job

type Job struct {
	// contains filtered or unexported fields
}

func (*Job) Cron

func (j *Job) Cron() *CronJob

func (*Job) CurrentState

func (j *Job) CurrentState() JobState

func (*Job) ID

func (j *Job) ID() string

func (*Job) IsMarkedForDeletion

func (j *Job) IsMarkedForDeletion() bool

func (*Job) MarkForDeletion

func (j *Job) MarkForDeletion()

func (*Job) Retry

func (j *Job) Retry() *RetryJob

func (*Job) SetCurrentState

func (j *Job) SetCurrentState(currentState JobState)

func (*Job) SetTargetState

func (j *Job) SetTargetState(state JobState) error

func (*Job) ShouldRestart

func (j *Job) ShouldRestart() bool

func (*Job) String

func (j *Job) String() string

func (*Job) TargetState

func (j *Job) TargetState() JobState

func (*Job) Workload

func (j *Job) Workload() Workload

type JobState

type JobState int
const (
	// ReadyState indicates that the task ready to be deloyed
	ReadyState JobState = iota
	// RunningState indicates that the task is running
	RunningState
	// StoppedState indicates that the task has been stopped without error
	StoppedState
	// DegradedState indicates that the task is an degrated state like a pod with containers stopped.
	DegradedState
	// ExitedState indicates that the task has been stopped with an error
	ExitedState
	// ErrorState indicates that deploying of the task has resulted in error.
	ErrorState
	// UnknownState indicates that the task is in an unknown state
	UnknownState
	// InactiveState indicates that the task is in an inactive state.
	InactiveState
)

func (JobState) OneOf

func (ts JobState) OneOf(states ...JobState) bool

func (JobState) String

func (ts JobState) String() string

type Memory

type Memory struct {

	// physical bytes
	PhysicalBytes int64

	// usable bytes
	UsableBytes int64
}

type Message

type Message struct {
	Kind    MessageKind
	Payload interface{}
}

type MessageKind

type MessageKind int
const (
	WorkloadConfigurationMessage MessageKind = iota
	ProfileConfigurationMessage
)

type Mount

type Mount struct {
	// path of the device to be mounted
	Device string

	// destination directory
	Directory string

	// mount options
	Options string

	// type of the mount
	Type string
}

type Option

type Option[T any] struct {
	Value T
	None  bool
}

type OsInformation

type OsInformation struct {
	// automatically upgrade the OS image
	AutomaticallyUpgrade bool

	// the last commit ID
	CommitID string

	// the URL of the hosted commits web server
	HostedObjectsURL string
}

type Pair

type Pair[S, T any] struct {
	Name  S
	Value T
}

type PodWorkload

type PodWorkload struct {
	Name string

	WKind WorkloadKind

	// Namespace of the workload
	Namespace string

	// cron spec
	CronSpec string

	// Rootless is true if workload is to be executed in podman rootless
	Rootless bool

	// Annotations
	Annotations map[string]string

	// secrets
	Secrets map[string]string

	// configmaps
	Configmaps []string

	// image registries auth file
	ImageRegistryAuth string

	// Workload labels
	Labels map[string]string

	WorkloadProfiles []WorkloadProfile

	// specification
	Specification string
}

PodWorkload represents the workload in form of a pod.

func (PodWorkload) Cron

func (p PodWorkload) Cron() string

func (PodWorkload) Hash

func (p PodWorkload) Hash() string

func (PodWorkload) ID

func (p PodWorkload) ID() string

func (PodWorkload) IsRootless

func (p PodWorkload) IsRootless() bool

func (PodWorkload) Kind

func (p PodWorkload) Kind() WorkloadKind

func (PodWorkload) Profiles

func (p PodWorkload) Profiles() []WorkloadProfile

func (PodWorkload) String

func (p PodWorkload) String() string

type ProfileCondition

type ProfileCondition struct {
	// Name is the name of the condition
	Name string
	// requiredVariables holds the name of variables required to evaluate the expression
	RequiredVariables []string
	// Expression is the expression's interpreter for the condition
	Expression *interpreter.Interpreter
}

type RegistrationInfo

type RegistrationInfo struct {
	// Certificate Signing Request to be signed by flotta-operator CA
	CertificateRequest string

	// hardware info
	Hardware HardwareInfo
}

type RegistrationResponse

type RegistrationResponse struct {
	SignedCSR []byte
}

type Result

type Result[T any] struct {
	Value T
	Error error
}

type RetryJob

type RetryJob struct {
	// contains filtered or unexported fields
}

func (*RetryJob) CanReconcile

func (rj *RetryJob) CanReconcile() bool

func (*RetryJob) ComputeNext

func (rj *RetryJob) ComputeNext()

func (*RetryJob) Next

func (rj *RetryJob) Next() time.Time

type Scope

type Scope int
const (
	FullScope Scope = iota
	DeltaScope
)

func (Scope) String

func (s Scope) String() string

type Status

type Status int
const (
	Deploying Status = iota
	Running
	Crashed
	Stopped
)

func (Status) String

func (s Status) String() string

type SystemVendor

type SystemVendor struct {

	// manufacturer
	Manufacturer string

	// product name
	ProductName string

	// serial number
	SerialNumber string

	// Whether the machine appears to be a virtual machine or not
	Virtual bool
}

type UpgradeStatus

type UpgradeStatus struct {
	// current commit ID
	CurrentCommitID string

	// last upgrade status
	// Enum: [succeeded failed]
	LastUpgradeStatus string

	// last upgrade time
	LastUpgradeTime string
}

type Workload

type Workload interface {
	ID() string
	Kind() WorkloadKind
	String() string
	Hash() string
	Cron() string
	IsRootless() bool
	Profiles() []WorkloadProfile
}

type WorkloadKind

type WorkloadKind string
const (
	PodKind     WorkloadKind = "pod"
	AnsibleKind WorkloadKind = "ansible"
	K8SKind     WorkloadKind = "k8s"
)

type WorkloadProfile

type WorkloadProfile struct {
	Name       string
	Conditions []string
}

type WorkloadStatus

type WorkloadStatus struct {
	// last data upload
	LastDataUpload time.Time

	// name
	Name string

	// status
	// Enum: [deploying running crashed stopped]
	Status Status
}

Jump to

Keyboard shortcuts

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