process

package
v0.0.0-...-c0e9602 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessManager

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

ProcessManager manages multiple process workloads as a single logical unit. It provides coordinated lifecycle management and status aggregation for all Pod-based processes under its control.

func NewProcessManager

func NewProcessManager(namespace, configDir string, metrics *monitoring.ControllerMetrics,
	monitoringServer *monitoring.MonitoringServer, client kubernetes.Interface) *ProcessManager

NewProcessManager creates a new process manager

func (*ProcessManager) AddProcess

func (m *ProcessManager) AddProcess(config common.ProcessConfig) error

AddProcess adds a process to the manager

func (*ProcessManager) AddWorkload

func (m *ProcessManager) AddWorkload(config any) error

AddWorkload adds a process to the manager

func (*ProcessManager) GetConfig

func (m *ProcessManager) GetConfig() common.BaseWorkloadConfig

GetConfig returns a workload info

func (*ProcessManager) GetName

func (m *ProcessManager) GetName() string

GetName returns the name of the workload

func (*ProcessManager) GetStatus

func (m *ProcessManager) GetStatus() common.WorkloadStatus

GetStatus returns the status of the process manager

func (*ProcessManager) GetType

func (m *ProcessManager) GetType() common.WorkloadType

GetType returns the type of the workload

func (*ProcessManager) GetWorkload

func (m *ProcessManager) GetWorkload(name string) (common.Workload, bool)

GetWorkload finds a process from the manager

func (*ProcessManager) GetWorkloadConfig

func (m *ProcessManager) GetWorkloadConfig(name string) (cfg common.BaseWorkloadConfig, ok bool)

GetWorkloadConfig finds a process from the manager

func (*ProcessManager) GetWorkloadsWithCRD

func (m *ProcessManager) GetWorkloadsWithCRD() (res []common.Workload)

GetWorkloadsWithCRD returns all workloads from the manager with CRD

func (*ProcessManager) RemoveWorkload

func (m *ProcessManager) RemoveWorkload(name string) error

RemoveWorkload removes a process from the manager

func (*ProcessManager) Start

func (m *ProcessManager) Start(ctx context.Context) error

Start initializes the manager and starts all registered Process workloads. It first loads configurations from files if a config directory was provided, then starts each workload with the given Kubernetes client.

func (*ProcessManager) Stop

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

Stop gracefully terminates all managed Process workloads, ensuring proper cleanup of resources.

type ProcessWorkload

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

ProcessWorkload implements a process workload using Kubernetes Pods. It manages the lifecycle of a single Pod, monitoring its health and status, and ensuring it's recreated if terminated unexpectedly.

func NewProcessWorkload

func NewProcessWorkload(config common.ProcessConfig, metrics *monitoring.ControllerMetrics,
	monitoringServer *monitoring.MonitoringServer, client kubernetes.Interface) (*ProcessWorkload, error)

NewProcessWorkload creates a new process workload

func (*ProcessWorkload) GetConfig

func (p *ProcessWorkload) GetConfig() common.BaseWorkloadConfig

GetConfig returns a workload info

func (*ProcessWorkload) GetName

func (p *ProcessWorkload) GetName() string

GetName returns the name of the workload

func (*ProcessWorkload) GetStatus

func (p *ProcessWorkload) GetStatus() common.WorkloadStatus

GetStatus returns the current status of the workload

func (*ProcessWorkload) GetType

func (p *ProcessWorkload) GetType() common.WorkloadType

GetType returns the type of the workload

func (*ProcessWorkload) SetMonitoring

func (p *ProcessWorkload) SetMonitoring(
	metrics *monitoring.ControllerMetrics, monitoringServer *monitoring.MonitoringServer)

func (*ProcessWorkload) Start

func (p *ProcessWorkload) Start(ctx context.Context) error

Start creates or updates the Pod in Kubernetes and begins monitoring its health. It also sets up a watcher to detect unexpected Pod terminations.

func (*ProcessWorkload) Stop

func (p *ProcessWorkload) Stop(ctx context.Context) error

Stop gracefully terminates the Pod, adding controlled shutdown annotations and forcing deletion of stuck Pods if necessary.

func (*ProcessWorkload) String

func (p *ProcessWorkload) String() string

Jump to

Keyboard shortcuts

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