workload

package
v0.0.0-...-ebb3a86 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelWorkloadID   = "explorer.chunks.cloud/workload-id"
	LabelWorkloadName = "explorer.chunks.cloud/workload-name"
	LabelWorkloadType = "explorer.chunks.cloud/workload-type"

	LabelChunkID   = "explorer.chunks.cloud/chunk-id"
	LabelChunkName = "explorer.chunks.cloud/chunk-name"

	LabelFlavorID   = "explorer.chunks.cloud/flavor-id"
	LabelFlavorName = "explorer.chunks.cloud/flavor-name"

	LabelWorkloadPort = "explorer.chunks.cloud/workload-port"
)

Variables

This section is empty.

Functions

func InstanceLabels

func InstanceLabels(instance *instancev1alpha1.Instance) map[string]string

func StateToTransport

func StateToTransport(state State) workloadv1alpha2.WorkloadState

func SystemWorkloadLabels

func SystemWorkloadLabels(name string) map[string]string

SystemWorkloadLabels returns the labels used by system workloads

func WorkloadStatusToTransport

func WorkloadStatusToTransport(status Status) *workloadv1alpha2.WorkloadStatus

Types

type HealthStatus

type HealthStatus string
var (
	HealthStatusHealthy   HealthStatus = "HEALTHY"
	HealthStatusUnhealthy HealthStatus = "UNHEALTHY"
)

type Server

type Server struct {
	workloadv1alpha2.UnimplementedWorkloadServiceServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(store StatusStore) *Server

type Service

type Service interface {
	RunWorkload(ctx context.Context, w Workload, attempt uint) error
	RemoveWorkload(ctx context.Context, id string) error
	GetWorkloadHealth(ctx context.Context, id string) (HealthStatus, error)
}

func NewService

func NewService(
	logger *slog.Logger,
	criService cri.Service,
) Service

type State

type State string
var (
	StateCreating       State = "CREATING"
	StateRunning        State = "RUNNING"
	StateDeleted        State = "DELETED"
	StateCreationFailed State = "CREATION_FAILED"
)

type Status

type Status struct {
	State State
	Port  uint16
}

type StatusStore

type StatusStore interface {
	Update(id string, status Status)
	Get(id string) *Status
	Del(id string)
	View() map[string]Status
}

func NewStore

func NewStore() StatusStore

type Workload

type Workload struct {
	ID              string
	CheckpointImage string
	BaseImage       string

	// below map directly to pod fields
	Name             string
	Namespace        string
	Hostname         string
	Labels           map[string]string
	CPUPeriod        uint64
	CPUQuota         uint64
	MemoryLimitBytes uint64
}

Jump to

Keyboard shortcuts

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