types

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RestartPolicyAlways        = "always"
	RestartPolicyOnFailure     = "on_failure"
	RestartPolicyExitOnFailure = "exit_on_failure"
	RestartPolicyNo            = "no"
)
View Source
const (
	ProcessStateDisabled    = "Disabled"
	ProcessStateForeground  = "Foreground"
	ProcessStatePending     = "Pending"
	ProcessStateRunning     = "Running"
	ProcessStateLaunching   = "Launching"
	ProcessStateLaunched    = "Launched"
	ProcessStateRestarting  = "Restarting"
	ProcessStateTerminating = "Terminating"
	ProcessStateCompleted   = "Completed"
	ProcessStateSkipped     = "Skipped"
	ProcessStateError       = "Error"
)
View Source
const (
	ProcessHealthReady    = "Ready"
	ProcessHealthNotReady = "Not Ready"
	ProcessHealthUnknown  = PlaceHolderValue
)
View Source
const (
	// ProcessConditionCompleted is the type for waiting until a process has completed (any exit code).
	ProcessConditionCompleted = "process_completed"

	// ProcessConditionCompletedSuccessfully is the type for waiting until a process has completed successfully (exit code 0).
	ProcessConditionCompletedSuccessfully = "process_completed_successfully"

	// ProcessConditionHealthy is the type for waiting until a process is healthy.
	ProcessConditionHealthy = "process_healthy"

	// ProcessConditionStarted is the type for waiting until a process has started (default).
	ProcessConditionStarted = "process_started"

	// ProcessConditionLogReady is the type for waiting until a process has printed a predefined log line
	ProcessConditionLogReady = "process_log_ready"
)
View Source
const (
	ProcessUpdateUpdated = "updated"
	ProcessUpdateRemoved = "removed"
	ProcessUpdateAdded   = "added"
	ProcessUpdateError   = "error"
)
View Source
const DefaultLaunchTimeout = 5
View Source
const DefaultNamespace = "default"
View Source
const PlaceHolderValue = "-"

Variables

This section is empty.

Functions

This section is empty.

Types

type DependsOnConfig

type DependsOnConfig map[string]ProcessDependency

type DeprecationParams

type DeprecationParams struct {
	StartTime time.Time
}

type EnvCmd added in v1.46.0

type EnvCmd map[string]string

type Environment

type Environment []string

type LogRotationConfig added in v0.69.0

type LogRotationConfig struct {
	// Directory to log to when filelogging is enabled
	Directory string `yaml:"directory"`
	// Filename is the name of the logfile which will be placed inside the directory
	Filename string `yaml:"filename"`
	// MaxSize the max size in MB of the logfile before it's rolled
	MaxSize int `yaml:"max_size_mb"`
	// MaxBackups the max number of rolled files to keep
	MaxBackups int `yaml:"max_backups"`
	// MaxAge the max age in days to keep a logfile
	MaxAge int `yaml:"max_age_days"`
	// Compress determines if the rotated log files should be compressed
	// using gzip. The default is not to perform compression.
	Compress bool `json:"compress" yaml:"compress"`
}

LogRotationConfig is the configuration for logging

type LoggerConfig added in v0.69.0

type LoggerConfig struct {
	// Rotation is the configuration for logging rotation
	Rotation *LogRotationConfig `yaml:"rotation"`
	// FieldsOrder is the order in which fields are logged
	FieldsOrder []string `yaml:"fields_order,omitempty"`
	// DisableJSON disables log JSON formatting
	DisableJSON bool `yaml:"disable_json"`
	// TimestampFormat is the format of the timestamp
	TimestampFormat string `yaml:"timestamp_format"`
	// NoColor disables coloring
	NoColor bool `yaml:"no_color"`
	// NoMetadata disables log metadata (process, replica)
	NoMetadata bool `yaml:"no_metadata"`
	// AddTimestamp adds timestamp to log
	AddTimestamp bool `yaml:"add_timestamp"`
	// FlushEachLine flushes the logger on each line
	FlushEachLine bool `yaml:"flush_each_line"`
}

type MemoryState added in v0.77.4

type MemoryState struct {
	Allocated      uint64 `json:"allocated"`
	TotalAllocated uint64 `json:"totalAllocated"`
	SystemMemory   uint64 `json:"systemMemory"`
	GcCycles       uint32 `json:"gcCycles"`
}

type ProcessConfig

type ProcessConfig struct {
	Name              string
	Disabled          bool                   `yaml:"disabled,omitempty"`
	IsDaemon          bool                   `yaml:"is_daemon,omitempty"`
	Command           string                 `yaml:"command"`
	Entrypoint        []string               `yaml:"entrypoint,omitempty"`
	LogLocation       string                 `yaml:"log_location,omitempty"`
	LoggerConfig      *LoggerConfig          `yaml:"log_configuration,omitempty"`
	Environment       Environment            `yaml:"environment,omitempty"`
	RestartPolicy     RestartPolicyConfig    `yaml:"availability,omitempty"`
	DependsOn         DependsOnConfig        `yaml:"depends_on,omitempty"`
	LivenessProbe     *health.Probe          `yaml:"liveness_probe,omitempty"`
	ReadinessProbe    *health.Probe          `yaml:"readiness_probe,omitempty"`
	ReadyLogLine      string                 `yaml:"ready_log_line,omitempty"`
	ShutDownParams    ShutDownParams         `yaml:"shutdown,omitempty"`
	DisableAnsiColors bool                   `yaml:"disable_ansi_colors,omitempty"`
	WorkingDir        string                 `yaml:"working_dir"`
	Namespace         string                 `yaml:"namespace"`
	Replicas          int                    `yaml:"replicas"`
	Extensions        map[string]interface{} `yaml:",inline"`
	Description       string                 `yaml:"description,omitempty"`
	Vars              Vars                   `yaml:"vars,omitempty"`
	IsForeground      bool                   `yaml:"is_foreground"`
	IsTty             bool                   `yaml:"is_tty"`
	IsElevated        bool                   `yaml:"is_elevated"`
	LaunchTimeout     int                    `yaml:"launch_timeout_seconds"`
	OriginalConfig    string
	ReplicaNum        int
	ReplicaName       string
	Executable        string
	Args              []string
}

func (*ProcessConfig) AssignProcessExecutableAndArgs added in v1.34.0

func (p *ProcessConfig) AssignProcessExecutableAndArgs(shellConf *command.ShellConfig, elevatedShellArg string)

func (*ProcessConfig) CalculateReplicaName added in v0.55.0

func (p *ProcessConfig) CalculateReplicaName() string

func (*ProcessConfig) Compare added in v1.27.0

func (p *ProcessConfig) Compare(another *ProcessConfig) bool

Compare returns true if two process configs are equal

func (*ProcessConfig) GetDependencies

func (p *ProcessConfig) GetDependencies() []string

func (*ProcessConfig) IsDeferred added in v0.77.4

func (p *ProcessConfig) IsDeferred() bool

func (*ProcessConfig) ValidateProcessConfig added in v1.34.0

func (p *ProcessConfig) ValidateProcessConfig() error

type ProcessDependency

type ProcessDependency struct {
	Condition  string                 `yaml:",omitempty"`
	Extensions map[string]interface{} `yaml:",inline"`
}

type ProcessFunc

type ProcessFunc func(process ProcessConfig) error

type ProcessPorts added in v0.55.0

type ProcessPorts struct {
	Name     string   `json:"name"`
	TcpPorts []uint16 `json:"tcp_ports"`
	UdpPorts []uint16 `json:"udp_ports"`
}

type ProcessState

type ProcessState struct {
	Name             string        `json:"name"`
	Namespace        string        `json:"namespace"`
	Status           string        `json:"status"`
	SystemTime       string        `json:"system_time"`
	Age              time.Duration `json:"age" swaggertype:"primitive,integer"`
	Health           string        `json:"is_ready"`
	Restarts         int           `json:"restarts"`
	ExitCode         int           `json:"exit_code"`
	Pid              int           `json:"pid"`
	IsElevated       bool          `json:"is_elevated"`
	PasswordProvided bool          `json:"password_provided"`
	Mem              int64         `json:"mem"`
	CPU              float64       `json:"cpu"`
	IsRunning        bool
}

func NewProcessState added in v0.55.0

func NewProcessState(proc *ProcessConfig) *ProcessState

type Processes

type Processes map[string]ProcessConfig

type ProcessesState added in v0.50.0

type ProcessesState struct {
	States []ProcessState `json:"data"`
}

type Project

type Project struct {
	Version             string               `yaml:"version"`
	LogLocation         string               `yaml:"log_location,omitempty"`
	LogLevel            string               `yaml:"log_level,omitempty"`
	LogLength           int                  `yaml:"log_length,omitempty"`
	LoggerConfig        *LoggerConfig        `yaml:"log_configuration,omitempty"`
	LogFormat           string               `yaml:"log_format,omitempty"`
	Processes           Processes            `yaml:"processes"`
	Environment         Environment          `yaml:"environment,omitempty"`
	ShellConfig         *command.ShellConfig `yaml:"shell,omitempty"`
	IsStrict            bool                 `yaml:"is_strict"`
	Vars                Vars                 `yaml:"vars"`
	DisableEnvExpansion bool                 `yaml:"disable_env_expansion"`
	IsTuiDisabled       bool                 `yaml:"is_tui_disabled"`
	ExtendsProject      string               `yaml:"extends,omitempty"`
	EnvCommands         EnvCmd               `yaml:"env_cmds,omitempty"`
	FileNames           []string
	EnvFileNames        []string
}

func (*Project) GetDependenciesOrderNames

func (p *Project) GetDependenciesOrderNames() ([]string, error)

func (*Project) GetElevatedShellArg added in v1.46.0

func (p *Project) GetElevatedShellArg() string

func (*Project) GetLexicographicProcessNames

func (p *Project) GetLexicographicProcessNames() ([]string, error)

func (*Project) GetProcesses added in v0.75.0

func (p *Project) GetProcesses(names ...string) ([]ProcessConfig, error)

func (*Project) WithProcesses

func (p *Project) WithProcesses(names []string, fn ProcessFunc) error

WithProcesses run ProcessFunc on each Process and dependencies in dependency order

type ProjectState added in v0.75.0

type ProjectState struct {
	FileNames         []string      `json:"fileNames"`
	UpTime            time.Duration `json:"upTime" swaggertype:"primitive,integer"`
	StartTime         time.Time     `json:"startTime"`
	ProcessNum        int           `json:"processNum"`
	RunningProcessNum int           `json:"runningProcessNum"`
	UserName          string        `json:"userName"`
	HostName          string        `json:"hostName"`
	Version           string        `json:"version"`
	MemoryState       *MemoryState  `json:"memoryState,omitempty"`
}

type RestartPolicyConfig

type RestartPolicyConfig struct {
	Restart        string `yaml:",omitempty"`
	BackoffSeconds int    `yaml:"backoff_seconds,omitempty"`
	MaxRestarts    int    `yaml:"max_restarts,omitempty"`
	ExitOnEnd      bool   `yaml:"exit_on_end,omitempty"`
	ExitOnSkipped  bool   `yaml:"exit_on_skipped,omitempty"`
}

type ShutDownParams

type ShutDownParams struct {
	ShutDownCommand string `yaml:"command,omitempty"`
	ShutDownTimeout int    `yaml:"timeout_seconds,omitempty"`
	Signal          int    `yaml:"signal,omitempty"`
	ParentOnly      bool   `yaml:"parent_only,omitempty"`
}

type Vars added in v0.75.0

type Vars map[string]any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳