Documentation
¶
Index ¶
- Constants
- type AgentBuildRequest
- type AgentBuildResponse
- type AgentBuildStatusResponse
- type Build
- type BuildLog
- type BuildStatus
- type CreateBuildPayload
- type CreateFleetPayload
- type CreateGatewayPayload
- type CreateMachinePayload
- type CreateSecretPayload
- type ExecOptions
- type ExecResult
- type Fleet
- type FleetStatus
- type Gateway
- type GuestConfig
- type HealthCheck
- type HealthStatus
- type InitConfig
- type LogEntry
- type Machine
- type MachineConfig
- type MachineDestroyEventPayload
- type MachineEvent
- type MachineEventPayload
- type MachineEventType
- type MachineExitedEventPayload
- type MachinePrepareFailedEventPayload
- type MachineStartEventPayload
- type MachineStartFailedEventPayload
- type MachineStartedEventPayload
- type MachineStatus
- type MachineStopEventPayload
- type MachineVersion
- type Metadata
- type Namespace
- type Node
- type Origin
- type PrivateNetwork
- type Resources
- type RestartPolicy
- type RestartPolicyConfig
- type Secret
- type SecretRef
- type StopConfig
- type UpdateFleetMetadataPayload
- type UpdateMachineMetadataPayload
- type UpdateSecretPayload
- type VolumeMount
- type Workload
Constants ¶
const ( // MaxLabels is the maximum number of labels allowed per resource MaxLabels = 64 // MaxAnnotations is the maximum number of annotations allowed per resource MaxAnnotations = 32 // MaxLabelKeyLength is the maximum length for label keys MaxLabelKeyLength = 63 // MaxLabelValueLength is the maximum length for label values MaxLabelValueLength = 255 // MaxAnnotationKeyLength is the maximum length for annotation keys MaxAnnotationKeyLength = 253 // MaxAnnotationValueLength is the maximum length for annotation values (64KB) MaxAnnotationValueLength = 65536 // ReservedMetadataPrefix is the reserved prefix for system metadata ReservedMetadataPrefix = "ravel." )
Metadata validation constants
const DefaultStopSignal = "SIGTERM"
const DefaultStopTimeout = 5 // in seconds
const MaxStopTimeout = 30 // in seconds
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentBuildRequest ¶
type AgentBuildRequest struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
ImageName string `json:"image_name"`
Tag string `json:"tag"`
Registry string `json:"registry"`
Dockerfile string `json:"dockerfile"`
BuildArgs map[string]string `json:"build_args"`
Target string `json:"target"`
NoCache bool `json:"no_cache"`
}
AgentBuildRequest is sent to the agent to start a build
type AgentBuildResponse ¶
type AgentBuildResponse struct {
Id string `json:"id"`
Status BuildStatus `json:"status"`
}
AgentBuildResponse is returned by the agent after starting a build
type AgentBuildStatusResponse ¶
type AgentBuildStatusResponse struct {
Id string `json:"id"`
Status BuildStatus `json:"status"`
Digest string `json:"digest,omitempty"`
Error string `json:"error,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
AgentBuildStatusResponse is returned by the agent for build status queries
type Build ¶
type Build struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
NodeId string `json:"node_id,omitempty"`
ImageName string `json:"image_name"`
Tag string `json:"tag"`
Registry string `json:"registry"`
FullImage string `json:"full_image"`
Status BuildStatus `json:"status"`
Digest string `json:"digest,omitempty"`
Error string `json:"error,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
CreatedAt time.Time `json:"created_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
Build represents a container image build
type BuildLog ¶
type BuildLog struct {
Timestamp time.Time `json:"timestamp"`
Stream string `json:"stream"`
Message string `json:"message"`
}
BuildLog represents a single log entry from a build
type BuildStatus ¶
type BuildStatus string
BuildStatus represents the current state of a build
const ( BuildStatusPending BuildStatus = "pending" BuildStatusBuilding BuildStatus = "building" BuildStatusPushing BuildStatus = "pushing" BuildStatusCompleted BuildStatus = "completed" BuildStatusFailed BuildStatus = "failed" )
type CreateBuildPayload ¶
type CreateBuildPayload struct {
ImageName string `json:"image_name"`
Tag string `json:"tag,omitempty"`
Registry string `json:"registry"`
Dockerfile string `json:"dockerfile,omitempty"`
BuildArgs map[string]string `json:"build_args,omitempty"`
Target string `json:"target,omitempty"`
NoCache bool `json:"no_cache,omitempty"`
}
CreateBuildPayload is the request payload for creating a new build
type CreateFleetPayload ¶
type CreateGatewayPayload ¶
type CreateMachinePayload ¶
type CreateMachinePayload struct {
Region string `json:"region"`
Config MachineConfig `json:"config"`
SkipStart bool `json:"skip_start,omitempty"`
EnableMachineGateway bool `json:"enable_machine_gateway,omitempty"`
Metadata *Metadata `json:"metadata,omitempty"`
}
type CreateSecretPayload ¶
type ExecOptions ¶
func (*ExecOptions) GetTimeout ¶
func (e *ExecOptions) GetTimeout() time.Duration
type ExecResult ¶
type FleetStatus ¶
type FleetStatus string
const ( FleetStatusActive FleetStatus = "active" FleetStatusDestroyed FleetStatus = "destroyed" )
type GuestConfig ¶
type HealthCheck ¶
type HealthCheck struct {
Exec []string `json:"exec,omitempty" doc:"Command to run for health check"`
Interval int `json:"interval,omitempty" doc:"Interval in seconds between health checks (default: 30)"`
Timeout int `json:"timeout,omitempty" doc:"Timeout in seconds for health check (default: 5)"`
Retries int `json:"retries,omitempty" doc:"Number of consecutive failures before unhealthy (default: 3)"`
}
type HealthStatus ¶
type HealthStatus string
const ( HealthStatusUnknown HealthStatus = "unknown" HealthStatusHealthy HealthStatus = "healthy" HealthStatusUnhealthy HealthStatus = "unhealthy" HealthStatusStarting HealthStatus = "starting" )
type InitConfig ¶
type Machine ¶
type Machine struct {
Id string `json:"id"`
Namespace string `json:"namespace"`
FleetId string `json:"fleet"`
InstanceId string `json:"instance_id"`
MachineVersion string `json:"machine_version"`
Region string `json:"region"`
Config MachineConfig `json:"config"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Events []MachineEvent `json:"events"`
Status MachineStatus `json:"state"`
Health HealthStatus `json:"health,omitempty"`
GatewayEnabled bool `json:"gateway_enabled"`
Metadata *Metadata `json:"metadata,omitempty"`
}
type MachineConfig ¶
type MachineConfig struct {
Image string `json:"image"`
Guest GuestConfig `json:"guest"`
Workload Workload `json:"workload,omitempty"`
StopConfig *StopConfig `json:"stop_config,omitempty"`
}
type MachineEvent ¶
type MachineEvent struct {
Id string `json:"id"`
MachineId string `json:"machine_id"`
InstanceId string `json:"instance_id"`
Status MachineStatus `json:"status"`
Type MachineEventType `json:"type"`
Origin Origin `json:"origin"`
Payload MachineEventPayload `json:"payload"`
Timestamp time.Time `json:"timestamp"`
}
func (MachineEvent) EventType ¶
func (me MachineEvent) EventType() MachineEventType
type MachineEventPayload ¶
type MachineEventPayload struct {
PrepareFailed *MachinePrepareFailedEventPayload `json:"prepare_failed,omitempty"`
Stop *MachineStopEventPayload `json:"stop,omitempty"`
Start *MachineStartEventPayload `json:"start,omitempty"`
StartFailed *MachineStartFailedEventPayload `json:"start_failed,omitempty"`
Started *MachineStartedEventPayload `json:"started,omitempty"`
Exited *MachineExitedEventPayload `json:"stopped,omitempty"`
Destroy *MachineDestroyEventPayload `json:"destroy,omitempty"`
}
type MachineEventType ¶
type MachineEventType string
const ( MachineCreated MachineEventType = "machine.created" MachinePrepare MachineEventType = "machine.prepare" MachinePrepared MachineEventType = "machine.prepared" MachinePrepareFailed MachineEventType = "machine.prepare_failed" MachineStart MachineEventType = "machine.start" MachineStartFailed MachineEventType = "machine.start_failed" MachineStarted MachineEventType = "machine.started" MachineStop MachineEventType = "machine.stop" MachineStopFailed MachineEventType = "machine.stop_failed" MachineExited MachineEventType = "machine.exited" MachineDestroy MachineEventType = "machine.destroy" MachineDestroyed MachineEventType = "machine.destroyed" )
type MachinePrepareFailedEventPayload ¶
type MachinePrepareFailedEventPayload struct {
Error string `json:"error"`
}
type MachineStartEventPayload ¶
type MachineStartEventPayload struct {
IsRestart bool `json:"is_restart"`
}
type MachineStartFailedEventPayload ¶
type MachineStartFailedEventPayload struct {
Error string `json:"error"`
}
type MachineStatus ¶
type MachineStatus string
const ( MachineStatusCreated MachineStatus = "created" MachineStatusPreparing MachineStatus = "preparing" MachineStatusStarting MachineStatus = "starting" MachineStatusRunning MachineStatus = "running" MachineStatusStopping MachineStatus = "stopping" MachineStatusStopped MachineStatus = "stopped" MachineStatusDestroying MachineStatus = "destroying" MachineStatusDestroyed MachineStatus = "destroyed" )
type MachineStopEventPayload ¶
type MachineStopEventPayload struct {
Config *StopConfig `json:"config,omitempty"`
}
type MachineVersion ¶
type MachineVersion struct {
Id string `json:"id"`
MachineId string `json:"machine_id"`
Namespace string `json:"namespace"`
Config MachineConfig `json:"config"`
Resources Resources `json:"resources"`
}
type Metadata ¶
type Metadata struct {
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
Metadata represents labels and annotations for resources (fleets and machines). Labels are key-value pairs used for organization and filtering. Annotations are key-value pairs for storing larger metadata like descriptions or JSON data.
type Node ¶
type Node struct {
Id string `json:"id"`
Address string `json:"address"`
AgentPort int `json:"agent_port"`
HttpProxyPort int `json:"proxy_port"`
Region string `json:"region"`
HeartbeatedAt time.Time `json:"heartbeated_at"`
}
func (*Node) AgentAddress ¶
func (*Node) HttpProxyAddress ¶
type PrivateNetwork ¶
type Resources ¶
type Resources struct {
CpusMHz int `json:"cpus_mhz" toml:"cpus_mhz"` // in MHz
MemoryMB int `json:"memory_mb" toml:"memory_mb"` // in MB
}
type RestartPolicy ¶
type RestartPolicy string
const ( RestartPolicyAlways RestartPolicy = "always" RestartPolicyOnFailure RestartPolicy = "on-failure" RestartPolicyNever RestartPolicy = "never" )
type RestartPolicyConfig ¶
type RestartPolicyConfig struct {
Policy RestartPolicy `json:"policy,omitempty"`
MaxRetries int `json:"max_retries,omitempty"`
}
type StopConfig ¶
type StopConfig struct {
Timeout *int `json:"timeout,omitempty"` // in seconds
Signal *string `json:"signal,omitempty"`
}
func GetDefaultStopConfig ¶
func GetDefaultStopConfig() *StopConfig
type UpdateFleetMetadataPayload ¶
type UpdateFleetMetadataPayload struct {
Metadata Metadata `json:"metadata"`
}
UpdateFleetMetadataPayload is the request payload for updating fleet metadata
type UpdateMachineMetadataPayload ¶
type UpdateMachineMetadataPayload struct {
Metadata Metadata `json:"metadata"`
}
UpdateMachineMetadataPayload is the request payload for updating machine metadata
type UpdateSecretPayload ¶
type UpdateSecretPayload struct {
Value string `json:"value" minLength:"1" doc:"New secret value"`
}
type VolumeMount ¶
type Workload ¶
type Workload struct {
Restart RestartPolicyConfig `json:"restart,omitempty"`
Env []string `json:"env,omitempty"`
Secrets []SecretRef `json:"secrets,omitempty"`
Volumes []VolumeMount `json:"volumes,omitempty"`
Init InitConfig `json:"init,omitempty"`
HealthCheck *HealthCheck `json:"health_check,omitempty"`
PrivateNetworks []PrivateNetwork `json:"private_networks,omitempty"`
AutoDestroy bool `json:"auto_destroy,omitempty"`
}