Documentation
¶
Overview ¶
Package types defines the core data structures for the Rune orchestration platform.
Package types contains the canonical data model used across the Rune control plane and CLI. ClusterNetwork lives here so both the allocator (server side) and the CLI (rune admin network status) can share a single struct without an import cycle.
Package types: ingress / expose validation.
ValidateExpose enforces the pre-cast invariants required by the ingress controller:
- acme TLS requires a non-empty Host (the ACME provider needs a hostname to issue against).
- Path, when set, must start with "/".
This is a value-shape check; it does not require any cluster state and is safe to call from cast pipelines and admission tests.
Package types: ingress certificate state.
IngressCertStatus tracks the per-host TLS certificate lifecycle for services exposed via the ingress controller (RUNE-066). Certificate issuance is asynchronous: cast admits the service immediately, and the ACME orchestrator drives the state machine independently, updating IngressCertStatus as it makes progress.
Package types: well-known node and resource labels.
These constants are the single source of truth for label keys the networking layer reads (RUNE-066 ingress controller, future scheduling tickets). Keep them in sync with the operator-facing docs.
Index ¶
- Constants
- func DetectDependencyCycles(adj map[string][]string) []error
- func FormatCPU(cpu float64) string
- func FormatIDRef(rt ResourceType, ns, id string) string
- func FormatMemory(bytes int64) string
- func FormatRef(rt ResourceType, ns, name string) string
- func HasNodeRole(labels map[string]string, role string) bool
- func IsCastFile(filename string) (bool, error)
- func IsEdgeNode(labels map[string]string) bool
- func IsRuneConfigFile(filePath string) (bool, error)
- func IsValidationError(err error) bool
- func MakeDependencyNodeKey(namespace, name string) string
- func NS(namespace string) string
- func ParseCPU(cpu string) (float64, error)
- func ParseMemory(memory string) (int64, error)
- func ValidateExpose(e *ServiceExpose, onEdge bool) error
- func WrapValidationError(err error, format string, args ...interface{}) error
- type AuthConfig
- type CORSPolicy
- type CPUConfig
- type CastFile
- func (cf *CastFile) AddParseError(err error)
- func (cf *CastFile) GetConfigmapSpecs() []*ConfigmapSpec
- func (cf *CastFile) GetConfigmaps() ([]*Configmap, error)
- func (cf *CastFile) GetLineInfo(kind, namespace, name string) (int, bool)
- func (cf *CastFile) GetParseErrors() []error
- func (cf *CastFile) GetSecretSpecs() []*SecretSpec
- func (cf *CastFile) GetSecrets() ([]*Secret, error)
- func (cf *CastFile) GetServiceSpecs() []*ServiceSpec
- func (cf *CastFile) GetServices() ([]*Service, error)
- func (cf *CastFile) GetSpecs() []Spec
- func (cf *CastFile) GetTemplateMap() map[string]string
- func (cf *CastFile) HasParseErrors() bool
- func (cf *CastFile) Lint() []error
- func (cf *CastFile) RestoreTemplateReferences(content string) string
- func (cf *CastFile) Validate() error
- type ClientConfig
- type Cluster
- type ClusterNetwork
- type Configmap
- type ConfigmapMount
- type ConfigmapSpec
- type DeletionOperation
- type DeletionOperationStatus
- type DeletionRequest
- type DeletionResponse
- type DeletionTask
- type DependencyRef
- type DockerConfig
- type EgressRule
- type EncryptionConfig
- type Endpoint
- type EnvFromList
- type EnvFromSource
- type EnvFromSourceSpec
- type Exec
- type ExecOptions
- type ExecStream
- type ExposeServiceTLS
- type Finalizer
- type FinalizerDependency
- type FinalizerInterface
- type FinalizerStatus
- type FinalizerTimeoutConfig
- type FinalizerType
- type Function
- type FunctionCode
- type FunctionDefinition
- type FunctionInvocationRequest
- type FunctionNetworkPolicy
- type FunctionNetworkRule
- type FunctionRun
- type FunctionRunStatus
- type FunctionSpec
- type Gateway
- type GatewayPort
- type GatewaySpec
- type GatewayTLS
- type HTTPRetryPolicy
- type HTTPRewrite
- type HTTPRoute
- type HealthCheck
- type HealthCheckResult
- type HealthFinalizerInterface
- type IngressCertState
- type IngressCertStatus
- type IngressRule
- type Instance
- type InstanceAction
- type InstanceActionType
- type InstanceFinalizerInterface
- type InstanceHealthStatus
- type InstanceIdentity
- type InstanceMetadata
- type InstanceStatus
- type InstanceStatusInfo
- type Job
- type JobArray
- type JobFile
- type JobRun
- type JobRunStatus
- type JobSpec
- type JobTemplate
- type KEKConfig
- type KeyToPath
- type LocalInstances
- type LogConfig
- type LogOptions
- type MemoryConfig
- type Namespace
- type NamespaceQuota
- type NamespaceSpec
- type NamespacedName
- type NamespacedResource
- type NetworkPolicyPeer
- type Node
- type NodeResources
- type NodeStatus
- type PassphraseConfig
- type PluginConfig
- type Policy
- type PolicyRule
- type Probe
- type ProcessSecurityContext
- type ProcessSpec
- type RegistryAuth
- type ResolvedConfigmapMount
- type ResolvedSecretMount
- type Resource
- type ResourceConfig
- type ResourceLimit
- type ResourceRef
- type ResourceType
- type Resources
- type RestartPolicy
- type RetryPolicy
- type RotationAction
- type RotationPolicy
- type Route
- type RouteDestination
- type RouteSpec
- type RuneFile
- type RunesetContext
- type RunesetManifest
- type RunesetSourceType
- type RunnerType
- type RuntimeType
- type ScalingMode
- type ScalingOperation
- type ScalingOperationMetadata
- type ScalingOperationParams
- type ScalingOperationStatus
- type Secret
- type SecretConfig
- type SecretEngine
- type SecretMount
- type SecretSpec
- type SecretsEngine
- type SecretsEngineSpec
- type ServerConfig
- type Service
- type ServiceAffinity
- type ServiceAutoscale
- type ServiceDependency
- type ServiceDiscovery
- type ServiceEndpoints
- type ServiceExpose
- type ServiceFinalizerInterface
- type ServiceMetadata
- type ServiceNetworkPolicy
- type ServicePort
- type ServiceRegistry
- type ServiceRegistryOverride
- type ServiceSpec
- func (s *ServiceSpec) GetEnvWithTemplates(templateMap map[string]string) map[string]string
- func (s *ServiceSpec) GetName() string
- func (s *ServiceSpec) GetNamespace() string
- func (s *ServiceSpec) Kind() string
- func (s *ServiceSpec) RestoreEnvFrom(templateMap map[string]string)
- func (s *ServiceSpec) RestoreTemplateReferences(templateMap map[string]string)
- func (s *ServiceSpec) ToService() (*Service, error)
- func (s *ServiceSpec) Validate() error
- func (s *ServiceSpec) ValidateStructure(data []byte) error
- type ServiceStatus
- type ServiceStatusInfo
- type Spec
- type StoredSecret
- type TCPRoute
- type TLSConfig
- type Token
- type User
- type ValidationError
- type Volume
- type VolumeMount
- type VolumeStorage
Constants ¶
const ( // LabelNodeRole identifies the operational role of a node. // The ingress controller (RUNE-066) runs only on nodes whose // role contains "edge". Multiple roles are comma-separated. LabelNodeRole = "rune.io/role" // NodeRoleEdge marks an edge node — one that owns :80/:443 // and terminates external ingress (HTTP/HTTPS, ACME). NodeRoleEdge = "edge" )
Well-known node labels.
const ( ImagePullPolicyAlways = "Always" ImagePullPolicyIfNotPresent = "IfNotPresent" ImagePullPolicyNever = "Never" )
ImagePullPolicy values for Service.ImagePullPolicy.
const ( ExposeTLSModeManual = "manual" ExposeTLSModeACME = "acme" )
Well-known TLS modes for ExposeServiceTLS.Mode.
const ClusterNetworkName = "cluster"
ClusterNetworkName is the canonical name of the singleton ClusterNetwork resource.
const (
// DefaultNamespace is the default namespace for services.
DefaultNamespace = "default"
)
Variables ¶
This section is empty.
Functions ¶
func DetectDependencyCycles ¶
DetectDependencyCycles runs cycle detection on an adjacency list of service dependency edges. The adjacency list maps node keys ("ns/name") to a slice of neighbor node keys. It returns one error per cycle detected with a human-readable path; returns empty slice if no cycles.
func FormatCPU ¶
FormatCPU formats a CPU value as a string Examples: 0.1 -> "100m", 0.5 -> "500m", 2.0 -> "2"
func FormatIDRef ¶
func FormatIDRef(rt ResourceType, ns, id string) string
func FormatMemory ¶
FormatMemory formats memory bytes as a human-readable string Uses binary units (Ki, Mi, Gi, etc.)
func FormatRef ¶
func FormatRef(rt ResourceType, ns, name string) string
func HasNodeRole ¶
HasNodeRole reports whether labels carry the given role under LabelNodeRole. Empty role or labels return false. Comparison is case-sensitive and exact (no substring match) so that "edge-staging" does not match "edge".
func IsCastFile ¶
IsCastFile performs a lightweight detection to determine if a YAML file appears to define Rune resource specs (services, secrets, configmaps). It does not validate structure; it only checks for presence of known keys.
func IsEdgeNode ¶
IsEdgeNode is shorthand for HasNodeRole(labels, NodeRoleEdge).
func IsRuneConfigFile ¶
IsRuneConfigFile checks if a file appears to be a Rune configuration file
func IsValidationError ¶
IsValidationError checks if an error is a ValidationError.
func MakeDependencyNodeKey ¶
MakeDependencyNodeKey constructs a stable key for a service node as "namespace/name".
func ParseCPU ¶
ParseCPU parses a CPU request/limit string into a float64 (cores) Examples: "100m" -> 0.1, "0.5" -> 0.5, "2" -> 2.0
func ParseMemory ¶
ParseMemory parses a memory request/limit string into bytes Examples: "100Mi" -> 104857600, "1Gi" -> 1073741824, "2G" -> 2000000000
func ValidateExpose ¶
func ValidateExpose(e *ServiceExpose, onEdge bool) error
ValidateExpose checks a ServiceExpose value for the invariants required by the ingress controller. Returns nil if e is nil.
onEdge is reserved for future per-edge checks (currently unused; kept in the signature for API stability).
func WrapValidationError ¶
WrapValidationError wraps an error with additional context.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
APIKeys string `yaml:"api_keys,omitempty"`
Provider string `yaml:"provider,omitempty"`
Token string `yaml:"token,omitempty"`
AllowRemoteAdmin bool `yaml:"allow_remote_admin,omitempty"`
}
AuthConfig represents authentication configuration
type CORSPolicy ¶
type CORSPolicy struct {
// Allowed origins (e.g., "https://example.com")
AllowOrigins []string `json:"allowOrigins" yaml:"allowOrigins"`
// Allowed methods (e.g., "GET", "POST")
AllowMethods []string `json:"allowMethods,omitempty" yaml:"allowMethods,omitempty"`
// Allowed headers
AllowHeaders []string `json:"allowHeaders,omitempty" yaml:"allowHeaders,omitempty"`
// Exposed headers
ExposeHeaders []string `json:"exposeHeaders,omitempty" yaml:"exposeHeaders,omitempty"`
// Max age for CORS preflight requests in seconds
MaxAge int `json:"maxAge,omitempty" yaml:"maxAge,omitempty"`
// Allow credentials
AllowCredentials bool `json:"allowCredentials,omitempty" yaml:"allowCredentials,omitempty"`
}
CORSPolicy defines Cross-Origin Resource Sharing settings.
type CPUConfig ¶
type CPUConfig struct {
DefaultRequest string `yaml:"default_request,omitempty"`
DefaultLimit string `yaml:"default_limit,omitempty"`
}
CPUConfig represents CPU resource configuration
type CastFile ¶
type CastFile struct {
Specs []Spec `yaml:"specs,omitempty"`
Services []ServiceSpec `yaml:"services,omitempty"`
Secrets []SecretSpec `yaml:"secrets,omitempty"`
Configmaps []ConfigmapSpec `yaml:"configmaps,omitempty"`
// contains filtered or unexported fields
}
CastFile represents a YAML file that may contain multiple resource specifications.
func ParseCastFile ¶
ParseCastFile reads and parses a cast file, handling template syntax
func ParseCastFileFromBytes ¶
ParseCastFileFromBytes is a helper used in tests to parse cast YAML content from memory.
func (*CastFile) AddParseError ¶
AddParseError adds a parsing error to the collection
func (*CastFile) GetConfigmapSpecs ¶
func (cf *CastFile) GetConfigmapSpecs() []*ConfigmapSpec
GetConfigmapSpecs returns all configmap specs defined in the cast file.
func (*CastFile) GetConfigmaps ¶
GetConfigmaps converts inline configmap entries to concrete Configmap objects.
func (*CastFile) GetLineInfo ¶
GetLineInfo returns the approximate line number for a spec by kind/namespace/name
func (*CastFile) GetParseErrors ¶
GetParseErrors returns all parsing errors collected during file parsing
func (*CastFile) GetSecretSpecs ¶
func (cf *CastFile) GetSecretSpecs() []*SecretSpec
GetSecretSpecs returns all secret specs defined in the cast file.
func (*CastFile) GetSecrets ¶
GetSecrets converts inline secret entries to concrete Secret objects.
func (*CastFile) GetServiceSpecs ¶
func (cf *CastFile) GetServiceSpecs() []*ServiceSpec
GetServices returns all service specs defined in the cast file.
func (*CastFile) GetServices ¶
GetServices converts service specs to concrete Service objects.
func (*CastFile) GetTemplateMap ¶
GetTemplateMap returns the map of template placeholders to their original template references
func (*CastFile) HasParseErrors ¶
HasParseErrors returns true if any parsing errors were encountered
func (*CastFile) Lint ¶
Lint validates all specs in the cast file and returns a list of errors. It does not stop on first error; all validation errors are collected.
func (*CastFile) RestoreTemplateReferences ¶
RestoreTemplateReferences replaces template placeholders with their original template syntax
type ClientConfig ¶
type ClientConfig struct {
Timeout time.Duration `yaml:"timeout,omitempty"`
Retries int `yaml:"retries,omitempty"`
}
ClientConfig represents client configuration
type Cluster ¶
type Cluster struct {
// Unique identifier for the cluster
ID string `json:"id" yaml:"id"`
// Human-readable name for the cluster
Name string `json:"name" yaml:"name"`
// Version of the cluster schema
Version string `json:"version" yaml:"version"`
// Nodes that are part of this cluster
Nodes []Node `json:"nodes,omitempty" yaml:"nodes,omitempty"`
// Services deployed in this cluster
Services []Service `json:"services,omitempty" yaml:"services,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Cluster represents a collection of nodes running services.
type ClusterNetwork ¶
type ClusterNetwork struct {
// CIDR is the service VIP range, e.g. "10.96.0.0/16". Set once at
// bootstrap; changing it requires a cluster reset.
CIDR string `json:"cidr"`
// AllocatedVIPs maps serviceID → IP (string form, e.g. "10.96.0.7").
// Stored as strings to keep JSON / proto round-trips stable.
AllocatedVIPs map[string]string `json:"allocatedVIPs,omitempty"`
// FreeList is the queue of IPs available for the next allocation.
// IPs returned by Release reach FreeList only after the cooldown
// period elapses. Stored as strings for the same reason as above.
FreeList []string `json:"freeList,omitempty"`
}
ClusterNetwork is the cluster-wide VIP allocation state. It is committed via the OrderedLog by the VIP allocator and surfaced through the Admin API for tooling. There is exactly one ClusterNetwork per cluster, keyed by the literal name "cluster".
The allocator is the only writer; readers (CLI, dashboards) MUST treat the struct as opaque and avoid mutating it.
type Configmap ¶
type Configmap struct {
// Unique identifier for the config
ID string `json:"id" yaml:"id"`
// Human-readable name for the config (DNS-1123 unique name within a namespace)
Name string `json:"name" yaml:"name"`
// Namespace the config belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Configuration data (not encrypted)
Data map[string]string `json:"data" yaml:"data"`
// Current version number
Version int `json:"version" yaml:"version"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Configmap represents a piece of non-sensitive configuration data.
type ConfigmapMount ¶
type ConfigmapMount struct {
// Name of the mount (for identification)
Name string `json:"name" yaml:"name"`
// Path where the config should be mounted
MountPath string `json:"mountPath" yaml:"mountPath"`
// Name of the config to mount
ConfigmapName string `json:"configmapName" yaml:"configmapName"`
// Optional: specific keys to project from the config
Items []KeyToPath `json:"items,omitempty" yaml:"items,omitempty"`
}
ConfigmapMount defines a config to be mounted in a container.
type ConfigmapSpec ¶
type ConfigmapSpec struct {
// Human-readable name for the config (required)
Name string `json:"name" yaml:"name"`
// Namespace the config belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Config data
Data map[string]string `json:"data" yaml:"data"`
// Skip indicates this spec should be ignored by castfile parsing
Skip bool `json:"skip,omitempty" yaml:"skip,omitempty"`
// contains filtered or unexported fields
}
ConfigmapSpec represents the YAML specification for a config (flat form).
func (*ConfigmapSpec) GetName ¶
func (c *ConfigmapSpec) GetName() string
Implement Spec interface for ConfigmapSpec
func (*ConfigmapSpec) GetNamespace ¶
func (c *ConfigmapSpec) GetNamespace() string
func (*ConfigmapSpec) Kind ¶
func (c *ConfigmapSpec) Kind() string
func (*ConfigmapSpec) ToConfigmap ¶
func (c *ConfigmapSpec) ToConfigmap() (*Configmap, error)
ToConfigmap converts a ConfigmapSpec to a Configmap.
func (*ConfigmapSpec) UnmarshalYAML ¶
func (c *ConfigmapSpec) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements custom unmarshalling so `data` can be provided either as a mapping (key: value) or as a sequence of {key, value} objects.
func (*ConfigmapSpec) Validate ¶
func (c *ConfigmapSpec) Validate() error
Validate checks if a config specification is valid.
type DeletionOperation ¶
type DeletionOperation struct {
// Unique identifier for the operation
ID string `json:"id"`
// Namespace the service belongs to
Namespace string `json:"namespace"`
// Name of the service being deleted
ServiceName string `json:"service_name"`
// Total number of instances to delete
TotalInstances int `json:"total_instances"`
// Number of instances deleted so far
DeletedInstances int `json:"deleted_instances"`
// Number of failed instance deletions
FailedInstances int `json:"failed_instances"`
// Time the operation started
StartTime time.Time `json:"start_time"`
// Time the operation ended (if completed/failed/cancelled)
EndTime *time.Time `json:"end_time,omitempty"`
// Current status of the operation (combines previous status and phase)
Status DeletionOperationStatus `json:"status"`
// Whether this is a dry run operation
DryRun bool `json:"dry_run"`
// Reason for failure/cancellation if applicable
FailureReason string `json:"failure_reason,omitempty"`
// List of pending cleanup operations
PendingOperations []string `json:"pending_operations,omitempty"`
// Estimated completion time
EstimatedCompletion *time.Time `json:"estimated_completion,omitempty"`
// Finalizers that need to complete before deletion (ordered by execution)
Finalizers []Finalizer `json:"finalizers,omitempty"`
}
DeletionOperation represents a deletion operation for a service
type DeletionOperationStatus ¶
type DeletionOperationStatus string
DeletionOperationStatus represents the status of a deletion operation
const ( // DeletionOperationStatusInitializing indicates the operation is being set up DeletionOperationStatusInitializing DeletionOperationStatus = "initializing" // DeletionOperationStatusDeletingInstances indicates instances are being deleted DeletionOperationStatusDeletingInstances DeletionOperationStatus = "deleting-instances" // DeletionOperationStatusRunningFinalizers indicates finalizers are executing DeletionOperationStatusRunningFinalizers DeletionOperationStatus = "running-finalizers" // DeletionOperationStatusCompleted indicates the operation completed successfully DeletionOperationStatusCompleted DeletionOperationStatus = "completed" // DeletionOperationStatusFailed indicates the operation failed DeletionOperationStatusFailed DeletionOperationStatus = "failed" )
type DeletionRequest ¶
type DeletionRequest struct {
// Namespace of the service
Namespace string `json:"namespace"`
// Name of the service
Name string `json:"name"`
// Force deletion without confirmation
Force bool `json:"force"`
// Timeout for graceful shutdown
TimeoutSeconds int32 `json:"timeout_seconds"`
// Detach and return immediately
Detach bool `json:"detach"`
// Dry run mode
DryRun bool `json:"dry_run"`
// Grace period for graceful shutdown
GracePeriod int32 `json:"grace_period"`
// Immediate deletion without graceful shutdown
Now bool `json:"now"`
// Don't error if service doesn't exist
IgnoreNotFound bool `json:"ignore_not_found"`
// Optional finalizers to run
Finalizers []string `json:"finalizers,omitempty"`
}
DeletionRequest represents a request to delete a service
type DeletionResponse ¶
type DeletionResponse struct {
// ID of the deletion operation
DeletionID string `json:"deletion_id"`
// Status of the deletion
Status string `json:"status"`
// Warning messages
Warnings []string `json:"warnings,omitempty"`
// Error messages
Errors []string `json:"errors,omitempty"`
// Whether cleanup was partial
PartialCleanup bool `json:"partial_cleanup"`
// Finalizers that will be executed
Finalizers []Finalizer `json:"finalizers,omitempty"`
}
DeletionResponse represents the response from a deletion request
type DeletionTask ¶
type DeletionTask struct {
*worker.BaseTask
// Service to delete
Service *Service `json:"service"`
// Deletion request parameters
Request *DeletionRequest `json:"request"`
// Finalizers to execute
FinalizerTypes []FinalizerType `json:"finalizer_types"`
// Timeout configuration
TimeoutConfig FinalizerTimeoutConfig `json:"timeout_config"`
}
DeletionTask represents a deletion task for the worker pool
type DependencyRef ¶
type DependencyRef struct {
Service string `json:"service,omitempty" yaml:"service,omitempty"`
Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
Configmap string `json:"configmap,omitempty" yaml:"configmap,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}
DependencyRef is the normalized internal representation of a dependency It can represent Service, Secret, or Configmap dependencies. Exactly one of Service/Secret/Configmap should be set.
func (*DependencyRef) GetDependencyResourceName ¶
func (d *DependencyRef) GetDependencyResourceName() string
func (*DependencyRef) GetDependencyResourceType ¶
func (d *DependencyRef) GetDependencyResourceType() ResourceType
type DockerConfig ¶
type DockerConfig struct {
APIVersion string `yaml:"api_version,omitempty"`
FallbackAPIVersion string `yaml:"fallback_api_version,omitempty"`
NegotiationTimeoutSeconds int `yaml:"negotiation_timeout_seconds,omitempty"`
}
DockerConfig represents Docker runner configuration
type EgressRule ¶
type EgressRule struct {
To []NetworkPolicyPeer `json:"to" yaml:"to"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
}
type EncryptionConfig ¶
type EncryptionConfig struct {
Enabled bool `yaml:"enabled"`
KEK *KEKConfig `yaml:"kek,omitempty"`
}
EncryptionConfig represents encryption configuration
type Endpoint ¶
type Endpoint struct {
// Instance ID this endpoint belongs to
InstanceID string `json:"instanceId" yaml:"instanceId"`
// IP address for this endpoint
IP string `json:"ip" yaml:"ip"`
// Port for this endpoint
Port int `json:"port" yaml:"port"`
// Protocol for this endpoint
Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`
// Endpoint-specific metadata
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
// Health status for this endpoint
Healthy bool `json:"healthy" yaml:"healthy"`
// Last health check timestamp
LastCheck time.Time `json:"lastCheck,omitempty" yaml:"lastCheck,omitempty"`
}
Endpoint represents a specific instance endpoint.
type EnvFromList ¶
type EnvFromList []EnvFromSourceSpec
EnvFromList allows envFrom to be either a single item (mapping or scalar) or a list in YAML
func (*EnvFromList) UnmarshalYAML ¶
func (l *EnvFromList) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML supports sequence, mapping, or scalar forms for envFrom
type EnvFromSource ¶
type EnvFromSource struct {
// Exactly one of these will be set
SecretName string `json:"secretName,omitempty" yaml:"secretName,omitempty"`
ConfigmapName string `json:"configmapName,omitempty" yaml:"configmapName,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
}
EnvFromSource is the internal normalized representation of envFrom
type EnvFromSourceSpec ¶
type EnvFromSourceSpec struct {
// One of these must be set
Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
Configmap string `json:"configmap,omitempty" yaml:"configmap,omitempty"`
// Optional namespace; defaults to the service namespace
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Optional prefix to apply to each imported key
Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
// Raw holds the original scalar form (possibly a template placeholder) used during restoration
Raw string `json:"-" yaml:"-"`
}
EnvFromSourceSpec defines an import source for environment variables
func (*EnvFromSourceSpec) UnmarshalYAML ¶
func (e *EnvFromSourceSpec) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML allows envFrom entries to be specified as either a mapping (secret/configmap/namespace/prefix) or a shorthand scalar like "{{secret:name}}", "secret:name", "config:app-settings" or FQDN forms.
type Exec ¶
type Exec struct {
// Command to execute
Command []string `json:"command" yaml:"command"`
// Environment variables
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
}
Exec represents execution configuration for a command
type ExecOptions ¶
type ExecOptions struct {
// Command is the command to execute
Command []string
// Env is a map of environment variables to set for the command
Env map[string]string
// WorkingDir is the working directory for the command
WorkingDir string
// TTY indicates whether to allocate a pseudo-TTY
TTY bool
// TerminalWidth is the initial width of the terminal
TerminalWidth uint32
// TerminalHeight is the initial height of the terminal
TerminalHeight uint32
}
ExecOptions defines options for executing a command in a running instance
type ExecStream ¶
type ExecStream interface {
// Write writes data to the standard input of the process
Write(p []byte) (n int, err error)
// Read reads data from the standard output of the process
Read(p []byte) (n int, err error)
// Stderr provides access to the standard error stream of the process
Stderr() io.Reader
// ResizeTerminal resizes the terminal (if TTY was enabled)
ResizeTerminal(width, height uint32) error
// Signal sends a signal to the process
Signal(sigName string) error
// ExitCode returns the exit code after the process has completed
ExitCode() (int, error)
// Close terminates the exec session and releases resources
Close() error
}
ExecStream provides bidirectional communication with an exec session
type ExposeServiceTLS ¶
type ExposeServiceTLS struct {
// Secret name containing TLS certificate and key
SecretName string `json:"secretName,omitempty" yaml:"secretName,omitempty"`
// Whether to automatically generate a TLS certificate
Auto bool `json:"auto,omitempty" yaml:"auto,omitempty"`
// Mode selects the certificate provisioning strategy.
// Empty / "manual": operator supplies SecretName.
// "acme": ingress controller obtains a cert from Let's Encrypt
// (HTTP-01) for Expose.Host. Auto implies Mode=acme.
// See RUNE-066.
Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
}
ExposeServiceTLS defines TLS configuration for exposed services.
func (*ExposeServiceTLS) IsACME ¶
func (t *ExposeServiceTLS) IsACME() bool
IsACME reports whether the expose configuration requests ACME-managed TLS. Auto: true is treated as Mode=acme.
type Finalizer ¶
type Finalizer struct {
// Unique identifier for the finalizer
ID string `json:"id"`
// Type of finalizer
Type FinalizerType `json:"type"`
// Status of the finalizer
Status FinalizerStatus `json:"status"`
// Error message if finalizer failed
Error string `json:"error,omitempty"`
// Dependencies this finalizer has on other finalizers
Dependencies []FinalizerDependency `json:"dependencies,omitempty"`
// Timestamps
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
Finalizer represents a cleanup operation that must complete before deletion
type FinalizerDependency ¶
type FinalizerDependency struct {
// The type of finalizer that must complete before this one
DependsOn FinalizerType `json:"depends_on"`
// Whether the dependency is required (true) or optional (false)
Required bool `json:"required"`
}
FinalizerDependency represents a dependency between finalizers
type FinalizerInterface ¶
type FinalizerInterface interface {
GetID() string
GetType() FinalizerType
Execute(ctx context.Context, service *Service) error
GetDependencies() []FinalizerDependency
Validate(service *Service) error
}
FinalizerInterface for cleanup operations
type FinalizerStatus ¶
type FinalizerStatus string
FinalizerStatus represents the status of a finalizer
const ( FinalizerStatusPending FinalizerStatus = "pending" FinalizerStatusRunning FinalizerStatus = "running" FinalizerStatusCompleted FinalizerStatus = "completed" FinalizerStatusFailed FinalizerStatus = "failed" )
type FinalizerTimeoutConfig ¶
type FinalizerTimeoutConfig struct {
// Default timeout for all finalizers
DefaultTimeout time.Duration `json:"default_timeout"`
// Timeout for specific finalizer types
TypeTimeouts map[FinalizerType]time.Duration `json:"type_timeouts,omitempty"`
// Whether to fail the entire operation if a finalizer times out
FailOnTimeout bool `json:"fail_on_timeout"`
}
FinalizerTimeoutConfig configures timeout behavior for finalizers
type FinalizerType ¶
type FinalizerType string
FinalizerType represents the type of cleanup operation
const ( // Resource cleanup finalizers FinalizerTypeVolumeCleanup FinalizerType = "volume-cleanup" FinalizerTypeNetworkCleanup FinalizerType = "network-cleanup" FinalizerTypeSecretCleanup FinalizerType = "secret-cleanup" FinalizerTypeConfigCleanup FinalizerType = "config-cleanup" // Service-related finalizers FinalizerTypeServiceDeregister FinalizerType = "service-deregister" FinalizerTypeLoadBalancerCleanup FinalizerType = "load-balancer-cleanup" // Instance-related finalizers FinalizerTypeInstanceCleanup FinalizerType = "instance-cleanup" FinalizerTypeProcessCleanup FinalizerType = "process-cleanup" )
type Function ¶
type Function struct {
// Unique identifier for the function
ID string `json:"id" yaml:"id"`
// Human-readable name for the function
Name string `json:"name" yaml:"name"`
// Namespace the function belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Specification of the function
Spec FunctionSpec `json:"spec" yaml:"spec"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Function represents a managed piece of user code and its execution environment.
type FunctionCode ¶
type FunctionCode struct {
// Inline source code
Inline string `json:"inline,omitempty" yaml:"inline,omitempty"`
}
FunctionCode contains the function's source code, which can be specified inline or as a reference.
type FunctionDefinition ¶
type FunctionDefinition struct {
// Function metadata and spec
Function struct {
// Human-readable name for the function (required)
Name string `json:"name" yaml:"name"`
// Namespace the function belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Function specification
Spec FunctionSpec `json:"spec" yaml:"spec"`
} `json:"function" yaml:"function"`
}
FunctionSpec represents the YAML specification for a function.
func (*FunctionDefinition) ToFunction ¶
func (f *FunctionDefinition) ToFunction() (*Function, error)
ToFunction converts a FunctionDefinition to a Function.
func (*FunctionDefinition) Validate ¶
func (f *FunctionDefinition) Validate() error
Validate checks if a function definition is valid.
type FunctionInvocationRequest ¶
type FunctionInvocationRequest struct {
// Payload for the function (JSON-serializable object)
Payload map[string]interface{} `json:"payload" yaml:"payload"`
// Timeout override (optional)
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
// Asynchronous execution flag
Async bool `json:"async,omitempty" yaml:"async,omitempty"`
}
FunctionInvocationRequest represents a request to invoke a function.
type FunctionNetworkPolicy ¶
type FunctionNetworkPolicy struct {
// Allowed outbound connections
Allow []FunctionNetworkRule `json:"allow" yaml:"allow"`
}
FunctionNetworkPolicy defines what network connections a function is allowed to make.
type FunctionNetworkRule ¶
type FunctionNetworkRule struct {
// Target host or IP
Host string `json:"host" yaml:"host"`
// Allowed ports and protocols (e.g., ["80/tcp", "443/tcp"])
Ports []string `json:"ports" yaml:"ports"`
}
FunctionNetworkRule defines a single allow rule for network connectivity.
type FunctionRun ¶
type FunctionRun struct {
// Unique identifier for the function run
ID string `json:"id" yaml:"id"`
// ID of the function that was executed
FunctionID string `json:"functionId" yaml:"functionId"`
// Namespace the function belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Input payload (JSON-serialized)
Input string `json:"input,omitempty" yaml:"input,omitempty"`
// Output result (JSON-serialized)
Output string `json:"output,omitempty" yaml:"output,omitempty"`
// Execution logs (stdout/stderr)
Logs string `json:"logs,omitempty" yaml:"logs,omitempty"`
// Execution status
Status FunctionRunStatus `json:"status" yaml:"status"`
// Error message (if status is Failed or TimedOut)
Error string `json:"error,omitempty" yaml:"error,omitempty"`
// Start time
StartTime *time.Time `json:"startTime,omitempty" yaml:"startTime,omitempty"`
// End time
EndTime *time.Time `json:"endTime,omitempty" yaml:"endTime,omitempty"`
// Duration in milliseconds
DurationMs int64 `json:"durationMs,omitempty" yaml:"durationMs,omitempty"`
// Invoker information (component/user that triggered the execution)
InvokedBy string `json:"invokedBy,omitempty" yaml:"invokedBy,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
}
FunctionRun represents a single execution of a Function.
type FunctionRunStatus ¶
type FunctionRunStatus string
FunctionRunStatus represents the execution status of a function run.
const ( // FunctionRunStatusPending indicates the function execution is queued FunctionRunStatusPending FunctionRunStatus = "Pending" // FunctionRunStatusRunning indicates the function is currently executing FunctionRunStatusRunning FunctionRunStatus = "Running" // FunctionRunStatusSucceeded indicates the function completed successfully FunctionRunStatusSucceeded FunctionRunStatus = "Succeeded" // FunctionRunStatusFailed indicates the function execution failed FunctionRunStatusFailed FunctionRunStatus = "Failed" // FunctionRunStatusTimedOut indicates the function execution timed out FunctionRunStatusTimedOut FunctionRunStatus = "TimedOut" )
type FunctionSpec ¶
type FunctionSpec struct {
// Runtime environment (e.g., python3.9, nodejs16, go1.18)
Runtime string `json:"runtime" yaml:"runtime"`
// Entrypoint handler (format depends on runtime, e.g., "main.handler")
Handler string `json:"handler" yaml:"handler"`
// Maximum execution time (e.g., "30s", "2m")
Timeout string `json:"timeout" yaml:"timeout"`
// Memory limit (e.g., "128Mi", "1Gi")
MemoryLimit string `json:"memoryLimit" yaml:"memoryLimit"`
// CPU limit (e.g., "100m", "0.5")
CPULimit string `json:"cpuLimit,omitempty" yaml:"cpuLimit,omitempty"`
// Function code
Code FunctionCode `json:"code" yaml:"code"`
// Static environment variables
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
// Network policy for the function
NetworkPolicy *FunctionNetworkPolicy `json:"networkPolicy,omitempty" yaml:"networkPolicy,omitempty"`
}
FunctionSpec defines the execution environment and code for a Function.
type Gateway ¶
type Gateway struct {
// Unique identifier for the gateway
ID string `json:"id" yaml:"id"`
// Human-readable name for the gateway
Name string `json:"name" yaml:"name"`
// Namespace the gateway belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Hostname for the gateway (for virtual hosting)
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
// Whether this is an internal gateway (not exposed outside the mesh)
Internal bool `json:"internal" yaml:"internal"`
// Port configurations for the gateway
Ports []GatewayPort `json:"ports" yaml:"ports"`
// TLS configuration options
TLS *GatewayTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Gateway represents an ingress/egress gateway for the service mesh.
type GatewayPort ¶
type GatewayPort struct {
// Port number
Port int `json:"port" yaml:"port"`
// Protocol for this port (HTTP, HTTPS, TCP, etc.)
Protocol string `json:"protocol" yaml:"protocol"`
// Name for this port (optional)
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}
GatewayPort represents a port exposed by a gateway.
type GatewaySpec ¶
type GatewaySpec struct {
// Gateway metadata and configuration
Gateway struct {
// Human-readable name for the gateway (required)
Name string `json:"name" yaml:"name"`
// Namespace the gateway belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Hostname for the gateway (for virtual hosting)
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"`
// Whether this is an internal gateway (not exposed outside the mesh)
Internal bool `json:"internal" yaml:"internal"`
// Port configurations for the gateway
Ports []GatewayPort `json:"ports" yaml:"ports"`
// TLS configuration options
TLS *GatewayTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
} `json:"gateway" yaml:"gateway"`
}
GatewaySpec represents the YAML specification for a gateway.
func (*GatewaySpec) ToGateway ¶
func (g *GatewaySpec) ToGateway() (*Gateway, error)
ToGateway converts a GatewaySpec to a Gateway.
func (*GatewaySpec) Validate ¶
func (g *GatewaySpec) Validate() error
Validate checks if a gateway specification is valid.
type GatewayTLS ¶
type GatewayTLS struct {
// Mode of TLS operation (PASSTHROUGH, SIMPLE, MUTUAL)
Mode string `json:"mode" yaml:"mode"`
// Secret name containing TLS credentials
SecretName string `json:"secretName,omitempty" yaml:"secretName,omitempty"`
// Minimum TLS version
MinVersion string `json:"minVersion,omitempty" yaml:"minVersion,omitempty"`
// Maximum TLS version
MaxVersion string `json:"maxVersion,omitempty" yaml:"maxVersion,omitempty"`
// Allow client certificate validation
ClientCertificate bool `json:"clientCertificate,omitempty" yaml:"clientCertificate,omitempty"`
}
GatewayTLS represents TLS configuration for a gateway.
type HTTPRetryPolicy ¶
type HTTPRetryPolicy struct {
// Number of retry attempts
Attempts int `json:"attempts" yaml:"attempts"`
// Timeout per retry attempt in milliseconds
PerTryTimeout int `json:"perTryTimeout,omitempty" yaml:"perTryTimeout,omitempty"`
// HTTP status codes that trigger a retry
RetryOn []int `json:"retryOn,omitempty" yaml:"retryOn,omitempty"`
}
HTTPRetryPolicy defines how request retries should be performed.
type HTTPRewrite ¶
type HTTPRewrite struct {
// URI to replace the matched path with
URI string `json:"uri,omitempty" yaml:"uri,omitempty"`
// Host to replace the request host with
Host string `json:"host,omitempty" yaml:"host,omitempty"`
}
HTTPRewrite defines how the path and/or host should be rewritten.
type HTTPRoute ¶
type HTTPRoute struct {
// Path match for this route (e.g., "/api/v1")
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// Path prefix match (e.g., "/api")
PathPrefix string `json:"pathPrefix,omitempty" yaml:"pathPrefix,omitempty"`
// HTTP methods this route applies to (GET, POST, etc.)
Methods []string `json:"methods,omitempty" yaml:"methods,omitempty"`
// Header matches required
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
// Query parameter matches required
QueryParams map[string]string `json:"queryParams,omitempty" yaml:"queryParams,omitempty"`
// Destination service and options
Destination RouteDestination `json:"destination" yaml:"destination"`
// Rewrite options
Rewrite *HTTPRewrite `json:"rewrite,omitempty" yaml:"rewrite,omitempty"`
// Response headers to be added
AddResponseHeaders map[string]string `json:"addResponseHeaders,omitempty" yaml:"addResponseHeaders,omitempty"`
// Request headers to be added
AddRequestHeaders map[string]string `json:"addRequestHeaders,omitempty" yaml:"addRequestHeaders,omitempty"`
// Timeout for this route in milliseconds
Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"`
// Retry policy
Retries *HTTPRetryPolicy `json:"retries,omitempty" yaml:"retries,omitempty"`
// CORS policy
CORS *CORSPolicy `json:"cors,omitempty" yaml:"cors,omitempty"`
}
HTTPRoute represents an HTTP routing rule.
type HealthCheck ¶
type HealthCheck struct {
// Liveness probe checks if the instance is running
Liveness *Probe `json:"liveness,omitempty" yaml:"liveness,omitempty"`
// Readiness probe checks if the instance is ready to receive traffic
Readiness *Probe `json:"readiness,omitempty" yaml:"readiness,omitempty"`
}
HealthCheck represents health check configuration for a service.
func (*HealthCheck) Validate ¶
func (h *HealthCheck) Validate() error
Validate validates the health check configuration.
type HealthCheckResult ¶
type HealthCheckResult struct {
Success bool
Message string
Duration time.Duration
CheckTime time.Time
InstanceID string
CheckType string
}
HealthCheckResult represents the result of a health check execution
type IngressCertState ¶
type IngressCertState string
IngressCertState is a coarse-grained state for the certificate lifecycle. Operator-facing — keep the value space small.
const ( // IngressCertPending means the orchestrator has accepted the // request but no certificate has been issued yet. The service // is reachable over plain HTTP only. IngressCertPending IngressCertState = "Pending" // IngressCertIssued means a usable certificate is in the // secret store and edge nodes are serving it. IngressCertIssued IngressCertState = "Issued" // IngressCertFailed means the most recent issuance attempt // failed. The orchestrator will retry per NextRetry; LastError // carries operator-facing detail. IngressCertFailed IngressCertState = "Failed" )
type IngressCertStatus ¶
type IngressCertStatus struct {
// Host is the hostname the cert is issued for, e.g. api.example.com.
Host string `json:"host" yaml:"host"`
// State is one of Pending, Issued, Failed.
State IngressCertState `json:"state" yaml:"state"`
// IssuedAt is set when State transitions to Issued.
IssuedAt *time.Time `json:"issuedAt,omitempty" yaml:"issuedAt,omitempty"`
// ExpiresAt is the certificate NotAfter from the issued cert.
ExpiresAt *time.Time `json:"expiresAt,omitempty" yaml:"expiresAt,omitempty"`
// LastError is populated when State == Failed.
LastError string `json:"lastError,omitempty" yaml:"lastError,omitempty"`
// NextRetry is set when State == Failed; the orchestrator
// schedules the next attempt at this time.
NextRetry *time.Time `json:"nextRetry,omitempty" yaml:"nextRetry,omitempty"`
}
IngressCertStatus is the per-service cert status surfaced to the operator via `rune get service`. Mirrors the design in _docs/designs/Networking-Layer-Implementation-Plan.md (RUNE-066).
type IngressRule ¶
type IngressRule struct {
From []NetworkPolicyPeer `json:"from" yaml:"from"`
Ports []string `json:"ports,omitempty" yaml:"ports,omitempty"`
}
type Instance ¶
type Instance struct {
NamespacedResource `json:"-" yaml:"-"`
// Runner type for the instance
Runner RunnerType `json:"runner" yaml:"runner"`
// Unique identifier for the instance
ID string `json:"id" yaml:"id"`
// Namespace of the instance
Namespace string `json:"namespace" yaml:"namespace"`
// Human-readable name for the instance
Name string `json:"name" yaml:"name"`
// ID of the service this instance belongs to
ServiceID string `json:"serviceId" yaml:"serviceId"`
// Name of the service this instance belongs to
ServiceName string `json:"serviceName" yaml:"serviceName"`
// ID of the node running this instance
NodeID string `json:"nodeId" yaml:"nodeId"`
// IP address assigned to this instance
IP string `json:"ip" yaml:"ip"`
// Status of the instance
Status InstanceStatus `json:"status" yaml:"status"`
// Detailed status information
StatusMessage string `json:"statusMessage,omitempty" yaml:"statusMessage,omitempty"`
// Container ID or process ID
ContainerID string `json:"containerId,omitempty" yaml:"containerId,omitempty"`
// Process ID for process runner
PID int `json:"pid,omitempty" yaml:"pid,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
// Process-specific configuration for process runner
Process *ProcessSpec `json:"process,omitempty" yaml:"process,omitempty"`
// Execution configuration for commands and environment
Exec *Exec `json:"exec,omitempty" yaml:"exec,omitempty"`
// Resources requirements for the instance
Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
// Environment variables for the instance
Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"`
// Metadata contains additional information about the instance
// Use for storing system properties that aren't part of the core spec
Metadata *InstanceMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
Instance represents a running copy of a service.
func (*Instance) Equals ¶
Equals checks if two instances are functionally equivalent for watch purposes
func (*Instance) GetResourceType ¶
func (i *Instance) GetResourceType() ResourceType
type InstanceAction ¶
type InstanceAction struct {
Type InstanceActionType
Service string
Namespace string
InstanceID string
Timestamp time.Time
}
InstanceAction represents a pending action for an instance
type InstanceActionType ¶
type InstanceActionType string
InstanceActionType represents an action to perform on an instance
const ( // InstanceActionCreate indicates an instance should be created InstanceActionCreate InstanceActionType = "create" // InstanceActionUpdate indicates an instance should be updated InstanceActionUpdate InstanceActionType = "update" // InstanceActionDelete indicates an instance should be deleted InstanceActionDelete InstanceActionType = "delete" )
type InstanceHealthStatus ¶
type InstanceHealthStatus struct {
InstanceID string
Liveness bool
Readiness bool
LastChecked time.Time
}
InstanceHealthStatus represents the health status of an instance
type InstanceIdentity ¶
type InstanceIdentity struct {
// InstanceID is the orchestrator-assigned instance ID. Useful
// for log correlation; not used for matching.
InstanceID string `json:"instanceId" yaml:"instanceId"`
// Service is the service name (no namespace).
Service string `json:"service" yaml:"service"`
// Namespace the service belongs to.
Namespace string `json:"namespace" yaml:"namespace"`
}
InstanceIdentity is the minimum tuple needed to attribute a connection's source IP to a managed service.
type InstanceMetadata ¶
type InstanceMetadata struct {
// Image is the image that the instance is running
Image string `json:"image,omitempty" yaml:"image,omitempty"`
// ImagePullPolicy controls when the runner pulls the container image
// ("Always", "IfNotPresent", "Never"). Propagated from the parent
// Service spec; empty defaults to "Always".
ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`
// ServiceGeneration is the generation of the service that the instance belongs to
ServiceGeneration int64 `json:"serviceGeneration,omitempty" yaml:"serviceGeneration,omitempty"`
// DeletionTimestamp is the timestamp when the instance was marked for deletion
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty" yaml:"deletionTimestamp,omitempty"`
// RestartCount is the number of times this instance has been restarted
RestartCount int `json:"restartCount,omitempty" yaml:"restartCount,omitempty"`
// SecretMounts contains the resolved secret mount information for this instance
SecretMounts []ResolvedSecretMount `json:"secretMounts,omitempty" yaml:"secretMounts,omitempty"`
// ConfigmapMounts contains the resolved config mount information for this instance
ConfigmapMounts []ResolvedConfigmapMount `json:"configMounts,omitempty" yaml:"configMounts,omitempty"`
// Ports declared by the service (propagated for runner use)
Ports []ServicePort `json:"ports,omitempty" yaml:"ports,omitempty"`
// Expose specification from the service (propagated for runner use)
Expose *ServiceExpose `json:"expose,omitempty" yaml:"expose,omitempty"`
// Resolved exposed endpoint on host (best-effort)
ExposedHost string `json:"exposedHost,omitempty" yaml:"exposedHost,omitempty"`
ExposedHostPort int `json:"exposedHostPort,omitempty" yaml:"exposedHostPort,omitempty"`
// ContainerIP is the IP assigned to the container on its primary
// Docker network. Recorded by the runner on Start; consumed by the
// agent to map source IPs to service identity for policy
// enforcement.
ContainerIP string `json:"containerIp,omitempty" yaml:"containerIp,omitempty"`
}
InstanceMetadata contains additional information about the instance
type InstanceStatus ¶
type InstanceStatus string
InstanceStatus represents the current status of an instance.
const ( // InstanceStatusPending indicates the instance is being created. InstanceStatusPending InstanceStatus = "Pending" // InstanceStatusRunning indicates the instance is running. InstanceStatusRunning InstanceStatus = "Running" // InstanceStatusStopped indicates the instance has stopped. InstanceStatusStopped InstanceStatus = "Stopped" // InstanceStatusFailed indicates the instance failed to start or crashed. InstanceStatusFailed InstanceStatus = "Failed" // InstanceStatusDeleted indicates the instance has been marked for deletion // but is retained in the store for a period before garbage collection. InstanceStatusDeleted InstanceStatus = "Deleted" // Process runner specific statuses InstanceStatusCreated InstanceStatus = "Created" InstanceStatusStarting InstanceStatus = "Starting" InstanceStatusExited InstanceStatus = "Exited" InstanceStatusUnknown InstanceStatus = "Unknown" )
type InstanceStatusInfo ¶
type InstanceStatusInfo struct {
Status InstanceStatus
StatusMessage string
InstanceID string
NodeID string
CreatedAt time.Time
UpdatedAt time.Time
}
InstanceStatusInfo contains information about an instance's status
type Job ¶
type Job struct {
// Unique identifier for the job
ID string `json:"id" yaml:"id"`
// Human-readable name for the job
Name string `json:"name" yaml:"name"`
// Namespace the job belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Schedule in cron format (if this is a scheduled job)
Schedule string `json:"schedule,omitempty" yaml:"schedule,omitempty"`
// Template defining the job execution environment
Template JobTemplate `json:"template" yaml:"template"`
// Optional array job configuration
Array *JobArray `json:"array,omitempty" yaml:"array,omitempty"`
// Retry policy for failed job runs
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty" yaml:"retryPolicy,omitempty"`
// How to handle concurrent runs (for scheduled jobs)
ConcurrencyPolicy string `json:"concurrencyPolicy,omitempty" yaml:"concurrencyPolicy,omitempty"`
// Number of successful run records to keep
SuccessfulRunsHistoryLimit int `json:"successfulRunsHistoryLimit,omitempty" yaml:"successfulRunsHistoryLimit,omitempty"`
// Number of failed run records to keep
FailedRunsHistoryLimit int `json:"failedRunsHistoryLimit,omitempty" yaml:"failedRunsHistoryLimit,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Job represents a short-lived workload that runs to completion.
func (*Job) CreateJobRun ¶
CreateJobRun creates a new JobRun for a Job.
type JobArray ¶
type JobArray struct {
// Number of runs to create in the array
Count int `json:"count" yaml:"count"`
// Optional parallelism limit (max concurrent runs)
Parallelism int `json:"parallelism,omitempty" yaml:"parallelism,omitempty"`
}
JobArray defines parameters for array jobs (multiple parallel runs).
type JobFile ¶
type JobFile struct {
// Job definition
Job *JobSpec `json:"job,omitempty" yaml:"job,omitempty"`
// Multiple job definitions
Jobs []JobSpec `json:"jobs,omitempty" yaml:"jobs,omitempty"`
}
JobFile represents a file containing job definitions.
type JobRun ¶
type JobRun struct {
// Unique identifier for the job run
ID string `json:"id" yaml:"id"`
// Human-readable name for the job run
Name string `json:"name" yaml:"name"`
// ID of the job this run belongs to
JobID string `json:"jobId" yaml:"jobId"`
// Namespace the job run belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Node this job run is/was scheduled on
NodeID string `json:"nodeId,omitempty" yaml:"nodeId,omitempty"`
// For array jobs, the index of this run in the array
ArrayIndex int `json:"arrayIndex,omitempty" yaml:"arrayIndex,omitempty"`
// Status of the job run
Status JobRunStatus `json:"status" yaml:"status"`
// Detailed status message
StatusMessage string `json:"statusMessage,omitempty" yaml:"statusMessage,omitempty"`
// Exit code if the job has completed
ExitCode int `json:"exitCode,omitempty" yaml:"exitCode,omitempty"`
// Number of restart attempts so far
RestartCount int `json:"restartCount,omitempty" yaml:"restartCount,omitempty"`
// Start time
StartTime *time.Time `json:"startTime,omitempty" yaml:"startTime,omitempty"`
// Completion time
CompletionTime *time.Time `json:"completionTime,omitempty" yaml:"completionTime,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
JobRun represents a single execution of a Job.
type JobRunStatus ¶
type JobRunStatus string
JobRunStatus represents the current status of a job run.
const ( // JobRunStatusPending indicates the job run is waiting to be scheduled JobRunStatusPending JobRunStatus = "Pending" // JobRunStatusRunning indicates the job run is currently executing JobRunStatusRunning JobRunStatus = "Running" // JobRunStatusSucceeded indicates the job run completed successfully JobRunStatusSucceeded JobRunStatus = "Succeeded" // JobRunStatusFailed indicates the job run failed JobRunStatusFailed JobRunStatus = "Failed" )
type JobSpec ¶
type JobSpec struct {
// Human-readable name for the job (required)
Name string `json:"name" yaml:"name"`
// Namespace the job belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Schedule in cron format (if this is a scheduled job)
Schedule string `json:"schedule,omitempty" yaml:"schedule,omitempty"`
// Template defining the job execution environment
Template JobTemplate `json:"template" yaml:"template"`
// Optional array job configuration
Array *JobArray `json:"array,omitempty" yaml:"array,omitempty"`
// Retry policy for failed job runs
RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty" yaml:"retryPolicy,omitempty"`
// How to handle concurrent runs (for scheduled jobs)
ConcurrencyPolicy string `json:"concurrencyPolicy,omitempty" yaml:"concurrencyPolicy,omitempty"`
// Number of successful run records to keep
SuccessfulRunsHistoryLimit int `json:"successfulRunsHistoryLimit,omitempty" yaml:"successfulRunsHistoryLimit,omitempty"`
// Number of failed run records to keep
FailedRunsHistoryLimit int `json:"failedRunsHistoryLimit,omitempty" yaml:"failedRunsHistoryLimit,omitempty"`
}
JobSpec represents the YAML specification for a job.
type JobTemplate ¶
type JobTemplate struct {
// Container image for the job
Image string `json:"image" yaml:"image"`
// Command to run in the container (overrides image CMD)
Command string `json:"command,omitempty" yaml:"command,omitempty"`
// Arguments to the command
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
// Environment variables for the job
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
// Resource requirements for the job
Resources Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
// Volumes to mount in the job container
Volumes []VolumeMount `json:"volumes,omitempty" yaml:"volumes,omitempty"`
// Secret mounts
SecretMounts []SecretMount `json:"secretMounts,omitempty" yaml:"secretMounts,omitempty"`
// Config mounts
ConfigmapMounts []ConfigmapMount `json:"configmapMounts,omitempty" yaml:"configmapMounts,omitempty"`
}
JobTemplate defines the execution environment for a job.
type KEKConfig ¶
type KEKConfig struct {
Source string `yaml:"source,omitempty"`
File string `yaml:"file,omitempty"`
Passphrase *PassphraseConfig `yaml:"passphrase,omitempty"`
}
KEKConfig represents Key Encryption Key configuration
type KeyToPath ¶
type KeyToPath struct {
// Key in the Secret or Config
Key string `json:"key" yaml:"key"`
// Path where the key should be mounted (relative to mount point)
Path string `json:"path" yaml:"path"`
}
KeyToPath defines mapping from a key in a Secret/Config to a path in the mount.
type LocalInstances ¶
type LocalInstances struct {
// NodeID is the identity of the node these instances live on.
NodeID string `json:"nodeId" yaml:"nodeId"`
// Instances maps a container IP (e.g. "172.17.0.5") to the
// service identity that owns it.
Instances map[string]InstanceIdentity `json:"instances" yaml:"instances"`
}
LocalInstances is the per-node identity table maintained by the orchestrator and consumed by each agent. Each agent watches only its own node's record; the table maps a container IP observed at the agent's data plane to the (service, namespace) tuple that owns the container, so policy enforcement can resolve same-node source IPs back to a service identity without a service-mesh-style sidecar.
Cross-node peer identity is intentionally not derived from this table: a connection arriving at an agent from a different node originates from the remote agent's proxy, not the original container. Cross-node policy uses CIDR/namespace selectors only until data-plane mTLS lands.
type LogConfig ¶
type LogConfig struct {
Level string `yaml:"level,omitempty"`
Format string `yaml:"format,omitempty"`
}
LogConfig represents logging configuration
type LogOptions ¶
type LogOptions struct {
Follow bool
Since time.Time
Until time.Time
Tail int
Timestamps bool
ShowLogs bool // Show container/process logs
ShowEvents bool // Show lifecycle events
ShowStatus bool // Show status changes
Pattern string // Filter logs by pattern
}
LogOptions defines options for retrieving logs
type MemoryConfig ¶
type MemoryConfig struct {
DefaultRequest string `yaml:"default_request,omitempty"`
DefaultLimit string `yaml:"default_limit,omitempty"`
}
MemoryConfig represents memory resource configuration
type Namespace ¶
type Namespace struct {
// Unique identifier for the namespace
ID string `json:"id" yaml:"id"`
// Human-readable name for the namespace
Name string `json:"name" yaml:"name"`
// Optional description for the namespace
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Optional resource quotas for this namespace
Quota *NamespaceQuota `json:"quota,omitempty" yaml:"quota,omitempty"`
// Labels attached to the namespace for organization
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Namespace represents a logical boundary for isolation and scoping of resources.
type NamespaceQuota ¶
type NamespaceQuota struct {
// Maximum CPU allocation for all resources in the namespace (millicores)
CPU int64 `json:"cpu,omitempty" yaml:"cpu,omitempty"`
// Maximum memory allocation for all resources in the namespace (bytes)
Memory int64 `json:"memory,omitempty" yaml:"memory,omitempty"`
// Maximum storage allocation for all resources in the namespace (bytes)
Storage int64 `json:"storage,omitempty" yaml:"storage,omitempty"`
// Maximum number of services allowed in the namespace
Services int `json:"services,omitempty" yaml:"services,omitempty"`
// Maximum number of jobs allowed in the namespace
Jobs int `json:"jobs,omitempty" yaml:"jobs,omitempty"`
// Maximum number of instances (all services combined) allowed in the namespace
Instances int `json:"instances,omitempty" yaml:"instances,omitempty"`
}
NamespaceQuota represents resource quotas for a namespace.
type NamespaceSpec ¶
type NamespaceSpec struct {
// Human-readable name for the namespace (required)
Name string `json:"name" yaml:"name"`
// Optional description for the namespace
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Optional resource quotas for this namespace
Quota *NamespaceQuota `json:"quota,omitempty" yaml:"quota,omitempty"`
// Labels attached to the namespace for organization
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
NamespaceSpec represents the YAML specification for a namespace.
func (*NamespaceSpec) ToNamespace ¶
func (n *NamespaceSpec) ToNamespace() (*Namespace, error)
ToNamespace converts a NamespaceSpec to a Namespace.
func (*NamespaceSpec) Validate ¶
func (n *NamespaceSpec) Validate() error
Validate checks if a namespace specification is valid.
type NamespacedName ¶
type NamespacedName struct {
Namespace string `json:"namespace" yaml:"namespace"`
Name string `json:"name" yaml:"name"`
}
NamespacedName is a struct that contains a namespace and a name.
func (*NamespacedName) GetName ¶
func (n *NamespacedName) GetName() string
func (*NamespacedName) NamespacedName ¶
func (n *NamespacedName) NamespacedName() NamespacedName
func (*NamespacedName) String ¶
func (n *NamespacedName) String() string
type NamespacedResource ¶
type NamespacedResource interface {
NamespacedName() NamespacedName
GetID() string // For resources that also have an ID
GetResourceType() ResourceType
}
type NetworkPolicyPeer ¶
type NetworkPolicyPeer struct {
Service string `json:"service,omitempty" yaml:"service,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
ServiceSelector map[string]string `json:"serviceSelector,omitempty" yaml:"serviceSelector,omitempty"`
CIDR string `json:"cidr,omitempty" yaml:"cidr,omitempty"`
}
type Node ¶
type Node struct {
// Unique identifier for the node
ID string `json:"id" yaml:"id"`
// Human-readable name for the node
Name string `json:"name" yaml:"name"`
// IP address or hostname of the node
Address string `json:"address" yaml:"address"`
// Labels attached to the node for scheduling decisions
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
// Available resources on this node
Resources NodeResources `json:"resources" yaml:"resources"`
// Status of the node
Status NodeStatus `json:"status" yaml:"status"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last heartbeat timestamp
LastHeartbeat time.Time `json:"lastHeartbeat" yaml:"lastHeartbeat"`
}
Node represents a machine that can run service instances.
type NodeResources ¶
type NodeResources struct {
// Available CPU in millicores (1000m = 1 CPU)
CPU int64 `json:"cpu" yaml:"cpu"`
// Available memory in bytes
Memory int64 `json:"memory" yaml:"memory"`
}
NodeResources represents the resources available on a node.
type NodeStatus ¶
type NodeStatus string
NodeStatus represents the current status of a node.
const ( // NodeStatusReady indicates the node is ready to accept instances. NodeStatusReady NodeStatus = "Ready" // NodeStatusNotReady indicates the node is not ready. NodeStatusNotReady NodeStatus = "NotReady" // NodeStatusDraining indicates the node is being drained of instances. NodeStatusDraining NodeStatus = "Draining" )
type PassphraseConfig ¶
PassphraseConfig represents passphrase configuration
type PluginConfig ¶
type PluginConfig struct {
Dir string `yaml:"dir,omitempty"`
Enabled []string `yaml:"enabled,omitempty"`
}
PluginConfig represents plugin configuration
type Policy ¶
type Policy struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"` // DNS-1123 unique name within a namespace
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Rules []PolicyRule `json:"rules" yaml:"rules"`
Builtin bool `json:"builtin" yaml:"builtin"`
}
Policy represents a named set of permission rules
func (*Policy) GetResourceType ¶
func (p *Policy) GetResourceType() ResourceType
type PolicyRule ¶
type PolicyRule struct {
Resource string `json:"resource" yaml:"resource"`
Verbs []string `json:"verbs" yaml:"verbs"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}
PolicyRule defines a single permission rule within a policy
type Probe ¶
type Probe struct {
// Type of probe (http, tcp, exec)
Type string `json:"type" yaml:"type"`
// HTTP path for http probe
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// Port to connect to
Port int `json:"port" yaml:"port"`
// Command to execute for exec probe
Command []string `json:"command,omitempty" yaml:"command,omitempty"`
// Initial delay seconds before starting checks
InitialDelaySeconds int `json:"initialDelaySeconds,omitempty" yaml:"initialDelaySeconds,omitempty"`
// Interval between checks in seconds
IntervalSeconds int `json:"intervalSeconds,omitempty" yaml:"intervalSeconds,omitempty"`
// Timeout for the probe in seconds
TimeoutSeconds int `json:"timeoutSeconds,omitempty" yaml:"timeoutSeconds,omitempty"`
// Failure threshold for the probe
FailureThreshold int `json:"failureThreshold,omitempty" yaml:"failureThreshold,omitempty"`
// Success threshold for the probe
SuccessThreshold int `json:"successThreshold,omitempty" yaml:"successThreshold,omitempty"`
}
Probe represents a health check probe configuration.
type ProcessSecurityContext ¶
type ProcessSecurityContext struct {
// User to run as
User string `json:"user,omitempty" yaml:"user,omitempty"`
// Group to run as
Group string `json:"group,omitempty" yaml:"group,omitempty"`
// Run with read-only filesystem
ReadOnlyFS bool `json:"readOnlyFS,omitempty" yaml:"readOnlyFS,omitempty"`
// Linux capabilities to add
Capabilities []string `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
// Allowed syscalls (seccomp)
AllowedSyscalls []string `json:"allowedSyscalls,omitempty" yaml:"allowedSyscalls,omitempty"`
// Denied syscalls (seccomp)
DeniedSyscalls []string `json:"deniedSyscalls,omitempty" yaml:"deniedSyscalls,omitempty"`
}
ProcessSecurityContext defines security settings for a process
type ProcessSpec ¶
type ProcessSpec struct {
// Command to run
Command string `json:"command" yaml:"command"`
// Command arguments
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
// Working directory for the process
WorkingDir string `json:"workingDir,omitempty" yaml:"workingDir,omitempty"`
// Security settings
SecurityContext *ProcessSecurityContext `json:"securityContext,omitempty" yaml:"securityContext,omitempty"`
}
ProcessSpec defines how to run a service as a process
func (*ProcessSpec) Validate ¶
func (p *ProcessSpec) Validate() error
Validate validates the process specification
type RegistryAuth ¶
type RegistryAuth struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"` // basic | token | ecr
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Token string `json:"token,omitempty" yaml:"token,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
}
RegistryAuth defines supported inline auth types
type ResolvedConfigmapMount ¶
type ResolvedConfigmapMount struct {
// Name of the mount (for identification)
Name string `json:"name" yaml:"name"`
// Path where the config should be mounted
MountPath string `json:"mountPath" yaml:"mountPath"`
// Resolved config data (key -> value)
Data map[string]string `json:"data" yaml:"data"`
// Optional: specific keys to project from the config
Items []KeyToPath `json:"items,omitempty" yaml:"items,omitempty"`
}
ResolvedConfigmapMount contains the resolved config data for mounting
type ResolvedSecretMount ¶
type ResolvedSecretMount struct {
// Name of the mount (for identification)
Name string `json:"name" yaml:"name"`
// Path where the secret should be mounted
MountPath string `json:"mountPath" yaml:"mountPath"`
// Resolved secret data (key -> value)
Data map[string]string `json:"data" yaml:"data"`
// Optional: specific keys to project from the secret
Items []KeyToPath `json:"items,omitempty" yaml:"items,omitempty"`
}
ResolvedSecretMount contains the resolved secret data for mounting
type Resource ¶
type Resource interface {
// String returns a unique identifier for the resource
String() string
// Equals checks if two resources are functionally equivalent
Equals(other Resource) bool
}
Resource is a generic interface that all resources must implement
type ResourceConfig ¶
type ResourceConfig struct {
CPU *CPUConfig `yaml:"cpu,omitempty"`
Memory *MemoryConfig `yaml:"memory,omitempty"`
}
ResourceConfig represents resource limits and requests
type ResourceLimit ¶
type ResourceLimit struct {
// Requested resources (guaranteed)
Request string `json:"request,omitempty" yaml:"request,omitempty"`
// Maximum resources (limit)
Limit string `json:"limit,omitempty" yaml:"limit,omitempty"`
}
ResourceLimit defines request and limit for a resource.
type ResourceRef ¶
type ResourceRef struct {
Type ResourceType
Namespace string
Name string
ID string
Key string
}
ResourceRef is a canonical reference for resources with strongly-typed fields. Name form: rune://<type>/<namespace>/<name>/<key> ID form: rune://<type>/<namespace>/id/<id>/<key> FQDN form: <type>:<name>.<namespace>.rune[/key] Minimal form: <type>:<name>/<key>
func ParseResourceRef ¶
func ParseResourceRef(s string) (ResourceRef, error)
ParseResourceRef parses a reference and returns a ResourceRef.
func ParseResourceRefWithDefaultNamespace ¶
func ParseResourceRefWithDefaultNamespace(s, defaultNamespace string) (ResourceRef, error)
func (ResourceRef) HasKey ¶
func (r ResourceRef) HasKey() bool
func (ResourceRef) IsByID ¶
func (r ResourceRef) IsByID() bool
func (ResourceRef) IsNameRef ¶
func (r ResourceRef) IsNameRef() bool
func (ResourceRef) ToFetchRef ¶
func (r ResourceRef) ToFetchRef() string
func (ResourceRef) ToURI ¶
func (r ResourceRef) ToURI() string
func (ResourceRef) WithDefaultNamespace ¶
func (r ResourceRef) WithDefaultNamespace(ns string) ResourceRef
type ResourceType ¶
type ResourceType string
ResourceType is the type of resource.
const ( // ResourceTypeService is the resource type for services. ResourceTypeService ResourceType = "service" // ResourceTypeInstance is the resource type for instances. ResourceTypeInstance ResourceType = "instance" // ResourceTypeNamespace is the resource type for namespaces. ResourceTypeNamespace ResourceType = "namespace" // ResourceTypeScalingOperation is the resource type for scaling operations. ResourceTypeScalingOperation ResourceType = "scaling_operation" // ResourceTypeDeletionOperation is the resource type for deletion operations. ResourceTypeDeletionOperation ResourceType = "deletion_operation" // ResourceTypeSecret represents secrets (encrypted at rest) ResourceTypeSecret ResourceType = "secret" // ResourceTypeConfigmap represents non-sensitive configs ResourceTypeConfigmap ResourceType = "configmap" // ResourceTypeUser represents user identities ResourceTypeUser ResourceType = "user" // ResourceTypeToken represents authentication tokens ResourceTypeToken ResourceType = "token" // ResourceTypePolicy represents authorization policies ResourceTypePolicy ResourceType = "policy" )
type Resources ¶
type Resources struct {
// CPU request in millicores (1000m = 1 CPU)
CPU ResourceLimit `json:"cpu,omitempty" yaml:"cpu,omitempty"`
// Memory request in bytes
Memory ResourceLimit `json:"memory,omitempty" yaml:"memory,omitempty"`
}
Resources represents resource requirements for a service instance.
type RestartPolicy ¶
type RestartPolicy string
RestartPolicy defines how instances should be restarted
const ( // RestartPolicyAlways means always restart when not explicitly stopped RestartPolicyAlways RestartPolicy = "Always" // RestartPolicyOnFailure means only restart on failure RestartPolicyOnFailure RestartPolicy = "OnFailure" // RestartPolicyNever means never restart automatically, only manual restarts are allowed RestartPolicyNever RestartPolicy = "Never" )
type RetryPolicy ¶
type RetryPolicy struct {
// Number of retry attempts
Count int `json:"count" yaml:"count"`
// Backoff type (fixed or exponential)
Backoff string `json:"backoff" yaml:"backoff"`
// Initial backoff duration in seconds (for fixed or exponential)
BackoffSeconds int `json:"backoffSeconds,omitempty" yaml:"backoffSeconds,omitempty"`
}
RetryPolicy defines when and how to retry failed jobs.
type RotationAction ¶
type RotationAction struct {
// Services to reload (send SIGHUP)
ReloadServices []string `json:"reloadServices,omitempty" yaml:"reloadServices,omitempty"`
// Services to restart (rolling restart)
RestartServices []string `json:"restartServices,omitempty" yaml:"restartServices,omitempty"`
// Job to run
RunJob string `json:"runJob,omitempty" yaml:"runJob,omitempty"`
}
RotationAction defines an action to take after secret rotation.
type RotationPolicy ¶
type RotationPolicy struct {
// Interval between rotations (e.g., "30d", "90d")
Interval string `json:"interval" yaml:"interval"`
// Actions to take after rotation
OnRotate []RotationAction `json:"onRotate,omitempty" yaml:"onRotate,omitempty"`
}
RotationPolicy defines when and how to rotate a secret.
type Route ¶
type Route struct {
// Unique identifier for the route
ID string `json:"id" yaml:"id"`
// Human-readable name for the route
Name string `json:"name" yaml:"name"`
// Namespace the route belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Gateway this route is attached to
Gateway string `json:"gateway" yaml:"gateway"`
// Host or hosts this route matches (e.g., "api.example.com")
Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
// HTTP path-based routing rules
HTTP []HTTPRoute `json:"http,omitempty" yaml:"http,omitempty"`
// TCP routing rules (port-based)
TCP []TCPRoute `json:"tcp,omitempty" yaml:"tcp,omitempty"`
// Priority of this route (higher numbers take precedence)
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
Route represents a rule for routing traffic from a gateway to services.
type RouteDestination ¶
type RouteDestination struct {
// Service name to route to
Service string `json:"service" yaml:"service"`
// Namespace of the service (optional, defaults to route's namespace)
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Port on the service to route to
Port int `json:"port" yaml:"port"`
// Weight for traffic splitting (0-100)
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
// Subset of the service to route to (requires service to have defined subsets)
Subset string `json:"subset,omitempty" yaml:"subset,omitempty"`
}
RouteDestination represents the target of a route.
type RouteSpec ¶
type RouteSpec struct {
// Route metadata and rules
Route struct {
// Human-readable name for the route (required)
Name string `json:"name" yaml:"name"`
// Namespace the route belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Gateway this route is attached to
Gateway string `json:"gateway" yaml:"gateway"`
// Host or hosts this route matches
Hosts []string `json:"hosts,omitempty" yaml:"hosts,omitempty"`
// HTTP path-based routing rules
HTTP []HTTPRoute `json:"http,omitempty" yaml:"http,omitempty"`
// TCP routing rules (port-based)
TCP []TCPRoute `json:"tcp,omitempty" yaml:"tcp,omitempty"`
// Priority of this route (higher numbers take precedence)
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
} `json:"route" yaml:"route"`
}
RouteSpec represents the YAML specification for a route.
type RuneFile ¶
type RuneFile struct {
// Server configuration
Server *ServerConfig `yaml:"server,omitempty"`
// Data directory for persistent storage
DataDir string `yaml:"data_dir,omitempty"`
// Client configuration
Client *ClientConfig `yaml:"client,omitempty"`
// Docker runner configuration
Docker *DockerConfig `yaml:"docker,omitempty"`
// Default namespace
Namespace string `yaml:"namespace,omitempty"`
// Authentication configuration
Auth *AuthConfig `yaml:"auth,omitempty"`
// Resource limits and requests
Resources *ResourceConfig `yaml:"resources,omitempty"`
// Logging configuration
Log *LogConfig `yaml:"log,omitempty"`
// Secret encryption configuration
Secret *SecretConfig `yaml:"secret,omitempty"`
// Plugin configuration
Plugins *PluginConfig `yaml:"plugins,omitempty"`
// contains filtered or unexported fields
}
RuneFile represents a Rune configuration file
func ParseRuneFile ¶
ParseRuneFile parses a Rune configuration file from the given file path
func (*RuneFile) GetLineInfo ¶
GetLineInfo returns the line number for a given key
type RunesetContext ¶
type RunesetContext struct {
Namespace string
Mode string
ReleaseName string
Runeset RunesetManifest
}
func (RunesetContext) GetValues ¶
func (ctx RunesetContext) GetValues() map[string]interface{}
type RunesetManifest ¶
type RunesetManifest struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Namespace string `yaml:"namespace"`
Defaults map[string]interface{} `yaml:"defaults"`
}
func ParseRunesetManifest ¶
func ParseRunesetManifest(manifestPath string) (RunesetManifest, error)
ParseRunesetManifest reads and parses a runeset manifest YAML file.
type RunesetSourceType ¶
type RunesetSourceType string
const ( RunesetSourceTypeDirectory RunesetSourceType = "directory" RunesetSourceTypeRemoteArchive RunesetSourceType = "remote-archive" RunesetSourceTypePackageArchive RunesetSourceType = "package-archive" RunesetSourceTypeGitHub RunesetSourceType = "github" RunesetSourceTypeUnknown RunesetSourceType = "unknown" )
type RunnerType ¶
type RunnerType string
RunnerType is the type of runner for an instance.
const ( RunnerTypeTest RunnerType = "test" RunnerTypeDocker RunnerType = "docker" RunnerTypeProcess RunnerType = "process" )
type RuntimeType ¶
type RuntimeType string
Runtime types
const ( RuntimeTypeContainer RuntimeType = "container" RuntimeTypeProcess RuntimeType = "process" )
type ScalingMode ¶
type ScalingMode string
ScalingMode defines how the scaling operation should be performed
const ( // ScalingModeImmediate indicates scaling should happen immediately ScalingModeImmediate ScalingMode = "immediate" // ScalingModeGradual indicates scaling should happen gradually ScalingModeGradual ScalingMode = "gradual" )
type ScalingOperation ¶
type ScalingOperation struct {
// Unique identifier for the operation
ID string `json:"id"`
// Namespace the service belongs to
Namespace string `json:"namespace"`
// Name of the service being scaled
ServiceName string `json:"service_name"`
// Current scale when operation started
CurrentScale int `json:"current_scale"`
// Target scale to reach
TargetScale int `json:"target_scale"`
// Step size for gradual scaling
StepSize int `json:"step_size"`
// Interval between steps in seconds
Interval int `json:"interval"`
// Time the operation started
StartTime time.Time `json:"start_time"`
// Time the operation ended (if completed/failed/cancelled)
EndTime time.Time `json:"end_time,omitempty"`
// Current status of the operation
Status ScalingOperationStatus `json:"status"`
// Mode of scaling (immediate or gradual)
Mode ScalingMode `json:"mode"`
// Reason for failure/cancellation if applicable
FailureReason string `json:"failure_reason,omitempty"`
}
ScalingOperation represents a scaling operation for a service
func (*ScalingOperation) GetMetadata ¶
func (s *ScalingOperation) GetMetadata() *ScalingOperationMetadata
GetMetadata returns the resource metadata.
type ScalingOperationMetadata ¶
type ScalingOperationMetadata struct {
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
ScalingOperationMetadata represents metadata for a scaling operation
type ScalingOperationParams ¶
type ScalingOperationParams struct {
// Current scale of the service
CurrentScale int
// Target scale to reach
TargetScale int
// Step size for gradual scaling
StepSize int
// Interval between steps in seconds
IntervalSeconds int
// Whether to use gradual scaling
IsGradual bool
}
ScalingOperationParams encapsulates parameters for creating a scaling operation
type ScalingOperationStatus ¶
type ScalingOperationStatus string
ScalingOperationStatus represents the status of a scaling operation
const ( // ScalingOperationStatusInProgress indicates the operation is still running ScalingOperationStatusInProgress ScalingOperationStatus = "in_progress" // ScalingOperationStatusCompleted indicates the operation completed successfully ScalingOperationStatusCompleted ScalingOperationStatus = "completed" // ScalingOperationStatusFailed indicates the operation failed ScalingOperationStatusFailed ScalingOperationStatus = "failed" // ScalingOperationStatusCancelled indicates the operation was cancelled ScalingOperationStatusCancelled ScalingOperationStatus = "cancelled" )
type Secret ¶
type Secret struct {
// Unique identifier for the secret
ID string `json:"id" yaml:"id"`
// Human-readable name for the secret (DNS-1123 unique name within a namespace)
Name string `json:"name" yaml:"name"`
// Namespace the secret belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Type of secret (static or dynamic)
Type string `json:"type" yaml:"type"`
// Static data (encrypted at rest, only for static secrets)
Data map[string]string `json:"-" yaml:"-"` // Not serialized, stored encrypted separately
// Engine configuration for dynamic secrets
Engine *SecretEngine `json:"engine,omitempty" yaml:"engine,omitempty"`
// Rotation configuration
Rotation *RotationPolicy `json:"rotation,omitempty" yaml:"rotation,omitempty"`
// Current version number
Version int `json:"version" yaml:"version"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
// Last rotation timestamp
LastRotated *time.Time `json:"lastRotated,omitempty" yaml:"lastRotated,omitempty"`
}
Secret represents a securely stored piece of sensitive data.
type SecretConfig ¶
type SecretConfig struct {
Encryption *EncryptionConfig `yaml:"encryption,omitempty"`
}
SecretConfig represents secret encryption configuration
type SecretEngine ¶
type SecretEngine struct {
// Name of the engine to use (references a SecretsEngine resource)
Name string `json:"name" yaml:"name"`
// Role or profile to use with the engine (engine-specific)
Role string `json:"role,omitempty" yaml:"role,omitempty"`
// Engine-specific configuration for this secret
Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"`
}
SecretEngine defines a dynamic secret engine configuration.
type SecretMount ¶
type SecretMount struct {
// Name of the mount (for identification)
Name string `json:"name" yaml:"name"`
// Path where the secret should be mounted
MountPath string `json:"mountPath" yaml:"mountPath"`
// Name of the secret to mount
SecretName string `json:"secretName" yaml:"secretName"`
// Optional: specific keys to project from the secret
Items []KeyToPath `json:"items,omitempty" yaml:"items,omitempty"`
}
SecretMount defines a secret to be mounted in a container.
type SecretSpec ¶
type SecretSpec struct {
// Human-readable name for the secret (required)
Name string `json:"name" yaml:"name"`
// Namespace the secret belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Type of secret (static or dynamic)
Type string `json:"type" yaml:"type"`
// Secret data for static secrets (only for creation, not returned in GET)
Data map[string]string `json:"data,omitempty" yaml:"data,omitempty"`
// Single value convenience field (alternative to data.value for simple secrets)
Value string `json:"value,omitempty" yaml:"value,omitempty"`
// Base64-encoded value (for binary data)
ValueBase64 string `json:"valueBase64,omitempty" yaml:"valueBase64,omitempty"`
// Engine configuration for dynamic secrets
Engine *SecretEngine `json:"engine,omitempty" yaml:"engine,omitempty"`
// Rotation configuration
Rotation *RotationPolicy `json:"rotation,omitempty" yaml:"rotation,omitempty"`
// Skip indicates this spec should be ignored by castfile parsing
Skip bool `json:"skip,omitempty" yaml:"skip,omitempty"`
// contains filtered or unexported fields
}
SecretSpec represents the YAML specification for a secret.
func (*SecretSpec) GetName ¶
func (s *SecretSpec) GetName() string
Implement Spec interface for SecretSpec
func (*SecretSpec) GetNamespace ¶
func (s *SecretSpec) GetNamespace() string
func (*SecretSpec) Kind ¶
func (s *SecretSpec) Kind() string
func (*SecretSpec) ToSecret ¶
func (s *SecretSpec) ToSecret() (*Secret, error)
ToSecret converts a SecretSpec to a Secret.
func (*SecretSpec) UnmarshalYAML ¶
func (s *SecretSpec) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements custom unmarshalling so `data` can be provided either as a mapping (key: value) or as a sequence of {key, value} objects.
func (*SecretSpec) Validate ¶
func (s *SecretSpec) Validate() error
Validate checks if a secret specification is valid.
type SecretsEngine ¶
type SecretsEngine struct {
// Unique identifier for the engine
ID string `json:"id" yaml:"id"`
// Human-readable name for the engine
Name string `json:"name" yaml:"name"`
// Namespace the engine belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Type of engine (builtin, function, plugin)
Type string `json:"type" yaml:"type"`
// For function-based engines, the reference to the function
Function string `json:"function,omitempty" yaml:"function,omitempty"`
// For plugin-based engines, the path to the plugin executable
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// Engine-wide configuration
Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
}
SecretsEngine represents a configured secrets engine.
type SecretsEngineSpec ¶
type SecretsEngineSpec struct {
// Engine metadata and configuration
SecretsEngine struct {
// Human-readable name for the engine (required)
Name string `json:"name" yaml:"name"`
// Namespace the engine belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Type of engine (required: builtin, function, plugin)
Type string `json:"type" yaml:"type"`
// For function-based engines, the reference to the function
Function string `json:"function,omitempty" yaml:"function,omitempty"`
// For plugin-based engines, the path to the plugin executable
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// Engine-wide configuration
Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"`
} `json:"secretsEngine" yaml:"secretsEngine"`
}
SecretsEngineSpec represents the YAML specification for a secrets engine.
func (*SecretsEngineSpec) ToSecretsEngine ¶
func (s *SecretsEngineSpec) ToSecretsEngine() (*SecretsEngine, error)
ToSecretsEngine converts a SecretsEngineSpec to a SecretsEngine.
func (*SecretsEngineSpec) Validate ¶
func (s *SecretsEngineSpec) Validate() error
Validate checks if a secrets engine specification is valid.
type ServerConfig ¶
type ServerConfig struct {
GRPCAddress string `yaml:"grpc_address,omitempty"`
HTTPAddress string `yaml:"http_address,omitempty"`
TLS *TLSConfig `yaml:"tls,omitempty"`
}
ServerConfig represents server endpoint configuration
type Service ¶
type Service struct {
NamespacedResource `json:"-" yaml:"-"`
// Unique identifier for the service
ID string `json:"id" yaml:"id"`
// Human-readable name for the service // DNS-1123 unique name within a namespace
Name string `json:"name" yaml:"name"`
// Namespace the service belongs to
Namespace string `json:"namespace" yaml:"namespace"`
// Labels are key/value pairs that can be used to organize and categorize services
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
// Container image for the service
Image string `json:"image,omitempty" yaml:"image,omitempty"`
// Named registry selector for pulling the image (optional)
ImageRegistry string `json:"imageRegistry,omitempty" yaml:"imageRegistry,omitempty"`
// Registry override allowing inline auth or named selection (optional)
Registry *ServiceRegistryOverride `json:"registry,omitempty" yaml:"registry,omitempty"`
// ImagePullPolicy controls when the runner pulls the container image.
// Allowed values: "Always", "IfNotPresent", "Never". Empty defaults to
// "Always" (re-pull on every deploy/restart).
ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`
// Command to run in the container (overrides image CMD)
Command string `json:"command,omitempty" yaml:"command,omitempty"`
// Arguments to the command
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
// Environment variables for the service
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
// Imported environment variables sources (normalized from spec)
EnvFrom []EnvFromSource `json:"envFrom,omitempty" yaml:"envFrom,omitempty"`
// Number of instances to run
Scale int `json:"scale" yaml:"scale"`
// Ports exposed by the service
Ports []ServicePort `json:"ports,omitempty" yaml:"ports,omitempty"`
// Resource requirements for each instance
Resources Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
// Health checks for the service
Health *HealthCheck `json:"health,omitempty" yaml:"health,omitempty"`
// Network policy for controlling traffic
NetworkPolicy *ServiceNetworkPolicy `json:"networkPolicy,omitempty" yaml:"networkPolicy,omitempty"`
// External exposure configuration
Expose *ServiceExpose `json:"expose,omitempty" yaml:"expose,omitempty"`
// Placement preferences and requirements
Affinity *ServiceAffinity `json:"affinity,omitempty" yaml:"affinity,omitempty"`
// Autoscaling configuration
Autoscale *ServiceAutoscale `json:"autoscale,omitempty" yaml:"autoscale,omitempty"`
// Secret mounts
SecretMounts []SecretMount `json:"secretMounts,omitempty" yaml:"secretMounts,omitempty"`
// Config mounts
ConfigmapMounts []ConfigmapMount `json:"configmapMounts,omitempty" yaml:"configmapMounts,omitempty"`
// Service discovery configuration
Discovery *ServiceDiscovery `json:"discovery,omitempty" yaml:"discovery,omitempty"`
// Dependencies this service declares (normalized internal form)
Dependencies []DependencyRef `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
// Status of the service
Status ServiceStatus `json:"status" yaml:"status"`
// IngressCert tracks asynchronous TLS certificate state for the
// ingress controller (RUNE-066). Populated only when Expose is
// configured for ACME-managed TLS. The orchestrator updates this
// field independently of cast; cast does not block on issuance.
IngressCert *IngressCertStatus `json:"ingressCert,omitempty" yaml:"ingressCert,omitempty"`
// Instances of this service currently running
Instances []Instance `json:"instances,omitempty" yaml:"instances,omitempty"`
// Runtime for the service ("container" or "process")
Runtime RuntimeType `json:"runtime,omitempty" yaml:"runtime,omitempty"`
// Process-specific configuration (when Runtime="process")
Process *ProcessSpec `json:"process,omitempty" yaml:"process,omitempty"`
// Restart policy for the service
RestartPolicy RestartPolicy `json:"restart_policy,omitempty" yaml:"restart_policy,omitempty"`
// Metadata for the service
Metadata *ServiceMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
Service represents a deployable application or workload.
func (*Service) CalculateHash ¶
CalculateHash generates a hash of service properties that should trigger reconciliation when changed
func (*Service) Equals ¶
Equals checks if two services are functionally equivalent for watch purposes
func (*Service) GetResourceType ¶
func (s *Service) GetResourceType() ResourceType
type ServiceAffinity ¶
type ServiceAffinity struct {
// Hard constraints (service can only run on nodes matching these)
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
// Soft preferences (scheduler will try to place on nodes matching these)
Preferred []string `json:"preferred,omitempty" yaml:"preferred,omitempty"`
// Run instances near services matching these labels
With []string `json:"with,omitempty" yaml:"with,omitempty"`
// Avoid running instances on nodes with services matching these labels
Avoid []string `json:"avoid,omitempty" yaml:"avoid,omitempty"`
// Try to distribute instances across this topology key (e.g., "zone")
Spread string `json:"spread,omitempty" yaml:"spread,omitempty"`
}
ServiceAffinity defines placement rules for a service.
type ServiceAutoscale ¶
type ServiceAutoscale struct {
// Whether autoscaling is enabled
Enabled bool `json:"enabled" yaml:"enabled"`
// Minimum number of instances
Min int `json:"min" yaml:"min"`
// Maximum number of instances
Max int `json:"max" yaml:"max"`
// Metric to scale on (e.g., cpu, memory)
Metric string `json:"metric" yaml:"metric"`
// Target value for the metric (e.g., 70%)
Target string `json:"target" yaml:"target"`
// Cooldown period between scaling events
Cooldown string `json:"cooldown,omitempty" yaml:"cooldown,omitempty"`
// Maximum number of instances to add/remove in a single scaling event
Step int `json:"step,omitempty" yaml:"step,omitempty"`
}
ServiceAutoscale defines autoscaling behavior for a service.
type ServiceDependency ¶
type ServiceDependency struct {
// Optional raw FQDN captured by YAML parsing helpers
FQDN string `json:"-" yaml:"-"`
Service string `json:"service,omitempty" yaml:"service,omitempty"`
Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
Configmap string `json:"configmap,omitempty" yaml:"configmap,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
}
ServiceDependency is the spec-facing dependency format. YAML supports either string FQDN or this structured form per entry.
func (*ServiceDependency) UnmarshalYAML ¶
func (d *ServiceDependency) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML allows ServiceDependency entries to be specified as either a plain string (FQDN or resource ref) or a structured object.
type ServiceDiscovery ¶
type ServiceDiscovery struct {
// Discovery mode (load-balanced or headless)
Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
// VIP is the cluster virtual IP allocated for this service. Set by
// the control plane on Create via the cluster VIP allocator
// (RUNE-040). Stable for the lifetime of the service ID.
VIP string `json:"vip,omitempty" yaml:"vip,omitempty"`
// LocalityPreference controls how the userspace proxy picks
// endpoints (RUNE-041). One of "" (no preference), "prefer-local"
// (same-node first, fall back to remote), or "local-only" (fail
// closed if no local endpoint).
LocalityPreference string `json:"localityPreference,omitempty" yaml:"localityPreference,omitempty"`
}
ServiceDiscovery defines how a service is discovered by other services.
type ServiceEndpoints ¶
type ServiceEndpoints struct {
// Service full name (namespace.name)
ServiceID string `json:"serviceId" yaml:"serviceId"`
// Individual endpoints (instances) for this service
Endpoints []Endpoint `json:"endpoints" yaml:"endpoints"`
// Service-level metadata
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
ServiceEndpoints represents the discovered endpoints for a service.
type ServiceExpose ¶
type ServiceExpose struct {
// Port or port name to expose
Port string `json:"port" yaml:"port"`
// Host for the exposed service
Host string `json:"host,omitempty" yaml:"host,omitempty"`
// Path prefix for the exposed service
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// TLS configuration for the exposed service
TLS *ExposeServiceTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
}
ServiceExpose defines how a service is exposed externally.
type ServiceMetadata ¶
type ServiceMetadata struct {
// Creation timestamp
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt"`
// Generation of the service
Generation int64 `json:"generation,omitempty" yaml:"generation,omitempty"`
// LastNonZeroScale tracks the most recent non-zero scale to support restart semantics
LastNonZeroScale int `json:"lastNonZeroScale,omitempty" yaml:"lastNonZeroScale,omitempty"`
}
ServiceMetadata represents metadata for a service.
type ServiceNetworkPolicy ¶
type ServiceNetworkPolicy struct {
// Ingress rules (traffic coming into the service)
Ingress []IngressRule `json:"ingress,omitempty" yaml:"ingress,omitempty"`
// Egress rules (traffic going out from the service)
Egress []EgressRule `json:"egress,omitempty" yaml:"egress,omitempty"`
}
ServiceNetworkPolicy represents a network policy embedded in a service spec.
func (*ServiceNetworkPolicy) Validate ¶
func (s *ServiceNetworkPolicy) Validate() error
Validate checks if a service network policy is valid.
type ServicePort ¶
type ServicePort struct {
// Name for this port (used in references)
Name string `json:"name" yaml:"name"`
// Port number
Port int `json:"port" yaml:"port"`
// Target port (if different from port)
TargetPort int `json:"targetPort,omitempty" yaml:"targetPort,omitempty"`
// Protocol (default: TCP)
Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`
}
ServicePort represents a port exposed by a service.
type ServiceRegistry ¶
type ServiceRegistry struct {
// Map of service namespaced names to endpoint information
Services map[string]*ServiceEndpoints `json:"services" yaml:"services"`
// Last update timestamp
LastUpdated time.Time `json:"lastUpdated" yaml:"lastUpdated"`
}
ServiceRegistry represents the discovery registry for services.
type ServiceRegistryOverride ¶
type ServiceRegistryOverride struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Auth *RegistryAuth `json:"auth,omitempty" yaml:"auth,omitempty"`
}
ServiceRegistryOverride allows per-service registry selection or inline auth
func (*ServiceRegistryOverride) Validate ¶
func (r *ServiceRegistryOverride) Validate() error
type ServiceSpec ¶
type ServiceSpec struct {
// Human-readable name for the service (required)
Name string `json:"name" yaml:"name"`
// Namespace the service belongs to (optional, defaults to "default")
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// Labels for the service
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
// Container image for the service (required)
Image string `json:"image" yaml:"image"`
// Command to run in the container (overrides image CMD)
Command string `json:"command,omitempty" yaml:"command,omitempty"`
// Arguments to the command
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
// Environment variables for the service
Env map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
// Import environment variables from secrets/configmaps with optional prefix
EnvFrom EnvFromList `json:"envFrom,omitempty" yaml:"envFrom,omitempty"`
// Number of instances to run (default: 1)
Scale int `json:"scale" yaml:"scale"`
// Ports exposed by the service
Ports []ServicePort `json:"ports,omitempty" yaml:"ports,omitempty"`
// Resource requirements for each instance
Resources *Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
// Health checks for the service
Health *HealthCheck `json:"health,omitempty" yaml:"health,omitempty"`
// Network policy for controlling traffic
NetworkPolicy *ServiceNetworkPolicy `json:"networkPolicy,omitempty" yaml:"networkPolicy,omitempty"`
// External exposure configuration
Expose *ServiceExpose `json:"expose,omitempty" yaml:"expose,omitempty"`
// Placement preferences and requirements
Affinity *ServiceAffinity `json:"affinity,omitempty" yaml:"affinity,omitempty"`
// Autoscaling configuration
Autoscale *ServiceAutoscale `json:"autoscale,omitempty" yaml:"autoscale,omitempty"`
// Secret mounts
SecretMounts []SecretMount `json:"secretMounts,omitempty" yaml:"secretMounts,omitempty"`
// Configmap mounts
ConfigmapMounts []ConfigmapMount `json:"configmapMounts,omitempty" yaml:"configmapMounts,omitempty"`
// Service discovery configuration
Discovery *ServiceDiscovery `json:"discovery,omitempty" yaml:"discovery,omitempty"`
// Named registry selector for pulling the image (optional)
ImageRegistry string `json:"imageRegistry,omitempty" yaml:"imageRegistry,omitempty"`
// Registry override allowing inline auth or named selection (optional)
Registry *ServiceRegistryOverride `json:"registry,omitempty" yaml:"registry,omitempty"`
// ImagePullPolicy controls when the runner pulls the container image.
// Allowed values: "Always" (default), "IfNotPresent", "Never".
ImagePullPolicy string `json:"imagePullPolicy,omitempty" yaml:"imagePullPolicy,omitempty"`
// Skip indicates this spec should be ignored by castfile parsing
Skip bool `json:"skip,omitempty" yaml:"skip,omitempty"`
// Dependencies in user-facing form. Accepts either:
// - FQDN strings (e.g., "db.prod.rune") as YAML sequence entries
// - ResourceRef strings (e.g., "secret:db-creds" or "configmap:app-settings")
// - Structured objects (service/secret/configmap with optional namespace)
// These will be normalized to []DependencyRef in internal Service
Dependencies []ServiceDependency `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
// contains filtered or unexported fields
}
ServiceSpec is the YAML/JSON specification for a service.
func (*ServiceSpec) GetEnvWithTemplates ¶
func (s *ServiceSpec) GetEnvWithTemplates(templateMap map[string]string) map[string]string
GetEnvWithTemplates returns environment variables with template references restored
func (*ServiceSpec) GetName ¶
func (s *ServiceSpec) GetName() string
Implement Spec interface for ServiceSpec
func (*ServiceSpec) GetNamespace ¶
func (s *ServiceSpec) GetNamespace() string
func (*ServiceSpec) Kind ¶
func (s *ServiceSpec) Kind() string
func (*ServiceSpec) RestoreEnvFrom ¶
func (s *ServiceSpec) RestoreEnvFrom(templateMap map[string]string)
RestoreEnvFrom resolves any template placeholders captured in EnvFrom.Raw using the provided templateMap, and populates Secret/Configmap/Namespace accordingly.
func (*ServiceSpec) RestoreTemplateReferences ¶
func (s *ServiceSpec) RestoreTemplateReferences(templateMap map[string]string)
RestoreTemplateReferences restores template references in environment variables This should be called after parsing to restore the original template syntax
func (*ServiceSpec) ToService ¶
func (s *ServiceSpec) ToService() (*Service, error)
ToService converts a ServiceSpec to a Service.
func (*ServiceSpec) Validate ¶
func (s *ServiceSpec) Validate() error
Validate validates the service specification.
func (*ServiceSpec) ValidateStructure ¶
func (s *ServiceSpec) ValidateStructure(data []byte) error
ValidateStructure validates the YAML structure against the service specification Deprecated: ValidateStructure is no longer used; structural checks happen in Validate via validateStructureFromNode.
type ServiceStatus ¶
type ServiceStatus string
ServiceStatus represents the current status of a service.
const ( // ServiceStatusPending indicates the service is being created. ServiceStatusPending ServiceStatus = "Pending" // ServiceStatusRunning indicates the service is running. ServiceStatusRunning ServiceStatus = "Running" // ServiceStatusDeploying indicates the service is being updated. ServiceStatusDeploying ServiceStatus = "Deploying" // ServiceStatusFailed indicates the service failed to deploy or run. ServiceStatusFailed ServiceStatus = "Failed" // ServiceStatusDeleted indicates the service has been deleted. ServiceStatusDeleted ServiceStatus = "Deleted" )
type ServiceStatusInfo ¶
type ServiceStatusInfo struct {
Status ServiceStatus
// ObservedGeneration tracks which generation was last processed by the controller
ObservedGeneration int64 `json:"observedGeneration,omitempty" yaml:"observedGeneration,omitempty"`
// DesiredInstances is the number of instances that should be running
DesiredInstances int
// RunningInstances is the number of instances that are currently running
RunningInstances int
}
ServiceStatusInfo contains a summary of a service's status
type Spec ¶
type Spec interface {
// Validate ensures the spec is structurally and semantically valid.
Validate() error
// GetName returns the resource name declared in the spec.
GetName() string
// GetNamespace returns the resource namespace declared in the spec
// (defaulting behavior may be applied by callers as needed).
GetNamespace() string
// Kind returns the logical resource kind (e.g., "Service", "Secret", "Config").
Kind() string
}
Spec is a common interface implemented by all resource specs that can be validated and identify themselves by name/namespace/kind.
type StoredSecret ¶
type StoredSecret struct {
// Name of the secret
Name string `json:"name"`
// Namespace of the secret
Namespace string `json:"namespace"`
// Version of the secret
Version int `json:"version"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt"`
// Last update timestamp
UpdatedAt time.Time `json:"updatedAt"`
// Ciphertext of the secret
Ciphertext []byte `json:"ciphertext"`
// Wrapped DEK of the secret
WrappedDEK []byte `json:"wrappedDEK"`
}
StoredSecret is the persisted encrypted form of a Secret
type TCPRoute ¶
type TCPRoute struct {
// Port number for this TCP route
Port int `json:"port" yaml:"port"`
// Destination service and options
Destination RouteDestination `json:"destination" yaml:"destination"`
}
TCPRoute represents a TCP routing rule.
type TLSConfig ¶
type TLSConfig struct {
Enabled bool `yaml:"enabled"`
CertFile string `yaml:"cert_file,omitempty"`
KeyFile string `yaml:"key_file,omitempty"`
}
TLSConfig represents TLS configuration
type Token ¶
type Token struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
SubjectID string `json:"subjectId" yaml:"subjectId"`
SubjectType string `json:"subjectType" yaml:"subjectType"` // "user" | "service"
Description string `json:"description,omitempty" yaml:"description,omitempty"`
IssuedAt time.Time `json:"issuedAt" yaml:"issuedAt"`
ExpiresAt *time.Time `json:"expiresAt,omitempty" yaml:"expiresAt,omitempty"`
Revoked bool `json:"revoked" yaml:"revoked"`
SecretHash string `json:"secretHash" yaml:"secretHash"`
}
Token represents an authentication token (opaque secret stored hashed)
func (*Token) GetResourceType ¶
func (t *Token) GetResourceType() ResourceType
type User ¶
type User struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Email string `json:"email,omitempty" yaml:"email,omitempty"`
Policies []string `json:"policies,omitempty" yaml:"policies,omitempty"`
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
}
User represents an identity
func (*User) GetResourceType ¶
func (u *User) GetResourceType() ResourceType
type ValidationError ¶
type ValidationError struct {
Message string
}
ValidationError represents an error that occurs during validation.
func NewValidationError ¶
func NewValidationError(message string) *ValidationError
NewValidationError creates a new ValidationError with the given message.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error returns the error message.
type Volume ¶
type Volume struct {
// Name of the persistent volume
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// Storage details
Storage VolumeStorage `json:"storage,omitempty" yaml:"storage,omitempty"`
}
Volume defines a persistent volume that can be mounted.
type VolumeMount ¶
type VolumeMount struct {
// Name of the volume mount (for identification)
Name string `json:"name" yaml:"name"`
// Path where the volume should be mounted
MountPath string `json:"mountPath" yaml:"mountPath"`
// Volume details
Volume Volume `json:"volume,omitempty" yaml:"volume,omitempty"`
}
VolumeMount defines a volume to be mounted in a job or service container.
type VolumeStorage ¶
type VolumeStorage struct {
// Size of the volume (e.g., "10Gi")
Size string `json:"size" yaml:"size"`
// Storage class to use for provisioning
StorageClassName string `json:"storageClassName" yaml:"storageClassName"`
// Access mode (ReadWriteOnce, ReadOnlyMany, ReadWriteMany)
AccessMode string `json:"accessMode" yaml:"accessMode"`
}
VolumeStorage defines storage requirements for a volume.
Source Files
¶
- castfile.go
- cluster.go
- cluster_network.go
- configmap.go
- configmap_spec.go
- constants.go
- deletion.go
- dependency_graph.go
- discovery.go
- errors.go
- expose_validation.go
- function.go
- ingress_cert.go
- instance.go
- job.go
- labels.go
- local_instances.go
- namespace.go
- network_policy.go
- node.go
- orchestrator.go
- policy.go
- process.go
- ref.go
- resource.go
- resources.go
- runefile.go
- runeset.go
- scaling.go
- secret.go
- secret_spec.go
- service.go
- service_spec.go
- spec.go
- token.go
- types.go
- user.go