orchestrator

package
v0.4.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Health

type Health struct {
	Path             string `json:"path,omitempty"`
	IntervalSeconds  int    `json:"interval_seconds,omitempty"`
	TimeoutSeconds   int    `json:"timeout_seconds,omitempty"`
	HealthyThreshold int    `json:"healthy_threshold,omitempty"`
}

type Instance

type Instance struct {
	ID      string `json:"id"`
	Node    string `json:"node"`
	Address string `json:"address"`
	Healthy bool   `json:"healthy"`
	Ready   bool   `json:"ready"`
}

type K3sProvider

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

func NewK3sProvider

func NewK3sProvider(kubeconfig, namespace string) *K3sProvider

func (*K3sProvider) Apply

func (p *K3sProvider) Apply(ctx context.Context, workload Workload) (Status, error)

func (*K3sProvider) ID

func (p *K3sProvider) ID() ProviderID

func (*K3sProvider) Metrics

func (p *K3sProvider) Metrics(ctx context.Context, id string) (Usage, error)

func (*K3sProvider) Ready

func (p *K3sProvider) Ready(ctx context.Context) error

func (*K3sProvider) Remove

func (p *K3sProvider) Remove(ctx context.Context, id string) error

func (*K3sProvider) Resize

func (p *K3sProvider) Resize(ctx context.Context, id string, resources Resources) (Status, error)

func (*K3sProvider) Scale

func (p *K3sProvider) Scale(ctx context.Context, id string, replicas int) (Status, error)

func (*K3sProvider) Status

func (p *K3sProvider) Status(ctx context.Context, id string) (Status, error)

func (*K3sProvider) Validate

func (p *K3sProvider) Validate(_ context.Context, workload Workload) error

type MetricsProvider

type MetricsProvider interface {
	Metrics(context.Context, string) (Usage, error)
}

type NodeIdentity

type NodeIdentity struct {
	ID        string `json:"id"`
	Hostname  string `json:"hostname"`
	ClusterID string `json:"cluster_id"`
}

type Placement

type Placement struct {
	Constraints        []string `json:"constraints,omitempty"`
	MaxReplicasPerNode uint64   `json:"max_replicas_per_node,omitempty"`
}

type Provider

type ProviderID

type ProviderID string
const (
	ProviderStandalone ProviderID = "standalone"
	ProviderSwarm      ProviderID = "swarm"
	ProviderK3s        ProviderID = "k3s"
)

type Resources

type Resources struct {
	CPURequest    float64 `json:"cpu_request,omitempty"`
	CPULimit      float64 `json:"cpu_limit,omitempty"`
	MemoryRequest uint64  `json:"memory_request,omitempty"`
	MemoryLimit   uint64  `json:"memory_limit,omitempty"`
}

type Status

type Status struct {
	Workload  string     `json:"workload"`
	Desired   int        `json:"desired"`
	Available int        `json:"available"`
	Instances []Instance `json:"instances"`
}

type SwarmProvider

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

func NewSwarmProvider

func NewSwarmProvider(client swarmClient) *SwarmProvider

func NewSwarmProviderFromEnv

func NewSwarmProviderFromEnv() (*SwarmProvider, error)

func (*SwarmProvider) Apply

func (p *SwarmProvider) Apply(ctx context.Context, workload Workload) (Status, error)

func (*SwarmProvider) Close

func (p *SwarmProvider) Close() error

func (*SwarmProvider) EnsureLocalNodeLabel

func (p *SwarmProvider) EnsureLocalNodeLabel(ctx context.Context, key, value string) (NodeIdentity, error)

func (*SwarmProvider) ID

func (p *SwarmProvider) ID() ProviderID

func (*SwarmProvider) LocalNodeIdentity

func (p *SwarmProvider) LocalNodeIdentity(ctx context.Context) (NodeIdentity, error)

func (*SwarmProvider) Placement

func (p *SwarmProvider) Placement(ctx context.Context, id string) (Placement, error)

func (*SwarmProvider) Ready

func (p *SwarmProvider) Ready(ctx context.Context) error

func (*SwarmProvider) Remove

func (p *SwarmProvider) Remove(ctx context.Context, id string) error

func (*SwarmProvider) Resize

func (p *SwarmProvider) Resize(ctx context.Context, id string, resources Resources) (Status, error)

func (*SwarmProvider) Scale

func (p *SwarmProvider) Scale(ctx context.Context, id string, replicas int) (Status, error)

func (*SwarmProvider) Status

func (p *SwarmProvider) Status(ctx context.Context, id string) (Status, error)

func (*SwarmProvider) Validate

func (p *SwarmProvider) Validate(_ context.Context, workload Workload) error

type Usage

type Usage struct {
	CPUPercent    float64 `json:"cpu_percent"`
	MemoryPercent float64 `json:"memory_percent"`
}

type Workload

type Workload struct {
	ID          string            `json:"id"`
	Image       string            `json:"image"`
	Port        int               `json:"port,omitempty"`
	Replicas    int               `json:"replicas"`
	Resources   Resources         `json:"resources"`
	Health      Health            `json:"health"`
	Labels      map[string]string `json:"labels,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`
	Entrypoint  []string          `json:"entrypoint,omitempty"`
	Command     []string          `json:"command,omitempty"`
	WorkingDir  string            `json:"working_dir,omitempty"`
	Networks    []string          `json:"networks,omitempty"`
	Placement   Placement         `json:"placement,omitempty"`
	Stateful    bool              `json:"stateful"`
}

Jump to

Keyboard shortcuts

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