Documentation
¶
Index ¶
- type AccessControl
- type Cluster
- type DeployStrategy
- type Event
- type HeaderManipulation
- type HealthCheck
- type HealthCheckType
- type HealthStatus
- type Ingress
- type IngressBackend
- type IngressPath
- type IngressRule
- type IngressTLS
- type Network
- type NetworkConfig
- type Node
- type NodeResources
- type NodeRole
- type NodeStatus
- type PathRewrite
- type PathType
- type PortMapping
- type PublishMode
- type RateLimit
- type ResourceRequirements
- type RestartCondition
- type RestartPolicy
- type Secret
- type Service
- type ServiceMode
- type TLSCertificate
- type Task
- type TaskState
- type UpdateConfig
- type Volume
- type VolumeMount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControl ¶
type AccessControl struct {
AllowedIPs []string // IP whitelist (CIDR notation, e.g., "192.168.1.0/24")
DeniedIPs []string // IP blacklist (CIDR notation)
}
AccessControl defines IP-based access control
type Cluster ¶
type Cluster struct {
ID string
CreatedAt time.Time
Managers []*Node
Workers []*Node
NetworkConfig *NetworkConfig
}
Cluster represents the entire Warren cluster
type DeployStrategy ¶
type DeployStrategy string
DeployStrategy defines how updates are deployed
const ( DeployStrategyRolling DeployStrategy = "rolling" DeployStrategyBlueGreen DeployStrategy = "blue-green" DeployStrategyCanary DeployStrategy = "canary" )
type Event ¶
type Event struct {
Type string
Timestamp time.Time
NodeID string
ServiceID string
TaskID string
Message string
Data map[string]string
}
Event represents a cluster event (for streaming API)
type HeaderManipulation ¶
type HeaderManipulation struct {
Add map[string]string // Headers to add (e.g., {"X-Custom": "value"})
Set map[string]string // Headers to set/overwrite (e.g., {"X-Frame-Options": "DENY"})
Remove []string // Headers to remove (e.g., ["X-Powered-By"])
}
HeaderManipulation defines header modification rules
type HealthCheck ¶
type HealthCheck struct {
Type HealthCheckType // "http", "tcp", "exec"
Endpoint string // URL or address
Command []string // For exec type
Interval time.Duration
Timeout time.Duration
Retries int
}
HealthCheck defines container health checking
type HealthCheckType ¶
type HealthCheckType string
HealthCheckType defines the type of health check
const ( HealthCheckHTTP HealthCheckType = "http" HealthCheckTCP HealthCheckType = "tcp" HealthCheckExec HealthCheckType = "exec" )
type HealthStatus ¶
type HealthStatus struct {
Healthy bool
Message string
CheckedAt time.Time
ConsecutiveFailures int
ConsecutiveSuccesses int
}
HealthStatus tracks the current health state of a task
type Ingress ¶
type Ingress struct {
ID string
Name string
Rules []*IngressRule
TLS *IngressTLS
Labels map[string]string
CreatedAt time.Time
UpdatedAt time.Time
}
Ingress represents HTTP/HTTPS routing rules for external access
type IngressBackend ¶
type IngressBackend struct {
ServiceName string // Service to route to
Port int // Service port to connect to
}
IngressBackend defines the backend service for routing
type IngressPath ¶
type IngressPath struct {
Path string // Path to match (e.g., "/api", "/web")
PathType PathType // "Prefix" or "Exact"
Backend *IngressBackend // Backend service to route to
Rewrite *PathRewrite // Path rewriting configuration (M7.3)
Headers *HeaderManipulation // Header manipulation (M7.3)
RateLimit *RateLimit // Rate limiting configuration (M7.3)
AccessControl *AccessControl // Access control rules (M7.3)
}
IngressPath defines a path-based routing rule
type IngressRule ¶
type IngressRule struct {
Host string // Hostname to match (e.g., "api.example.com", "*.example.com")
Paths []*IngressPath // Path-based routing rules
}
IngressRule defines routing rules for an ingress
type IngressTLS ¶
type IngressTLS struct {
Enabled bool // Enable HTTPS
SecretName string // Secret containing TLS cert/key (PEM format)
Hosts []string // Hosts covered by this TLS config
AutoTLS bool // Enable Let's Encrypt automatic certificates (M7.3)
Email string // Email for Let's Encrypt notifications (M7.3)
}
IngressTLS defines TLS configuration for HTTPS
type Network ¶
type Network struct {
ID string
Name string
Subnet string // CIDR (e.g., "10.0.1.0/24")
Gateway string
Driver string // "wireguard"
}
Network represents an overlay network
type NetworkConfig ¶
type NetworkConfig struct {
ClusterSubnet string // Overall cluster subnet (e.g., "10.0.0.0/16")
ServiceSubnet string // Subnet for service VIPs (e.g., "10.0.1.0/24")
NodeIPs map[string]net.IP // Node ID -> Overlay IP mapping
}
NetworkConfig represents cluster-wide network configuration
type Node ¶
type Node struct {
ID string
Role NodeRole
Address string // Host IP address
OverlayIP net.IP // WireGuard overlay IP
Hostname string
Labels map[string]string
Resources *NodeResources
Status NodeStatus
LastHeartbeat time.Time
CreatedAt time.Time
}
Node represents a manager or worker node in the cluster
type NodeResources ¶
type NodeResources struct {
// Total capacity
CPUCores int
MemoryBytes int64
DiskBytes int64
// Currently allocated (reserved by tasks)
CPUAllocated float64
MemoryAllocated int64
DiskAllocated int64
}
NodeResources tracks resource capacity and allocation
type NodeStatus ¶
type NodeStatus string
NodeStatus represents the current state of a node
const ( NodeStatusReady NodeStatus = "ready" NodeStatusDown NodeStatus = "down" NodeStatusDraining NodeStatus = "draining" NodeStatusUnknown NodeStatus = "unknown" )
type PathRewrite ¶
type PathRewrite struct {
StripPrefix string // Strip this prefix from the path (e.g., "/api/v1" → "/")
ReplacePath string // Replace entire path with this (takes precedence over StripPrefix)
}
PathRewrite defines path rewriting rules
type PortMapping ¶
type PortMapping struct {
Name string
ContainerPort int // Port inside container (target port)
HostPort int // Port on host/cluster (published port)
Protocol string // "tcp" or "udp"
PublishMode PublishMode // "host" or "ingress"
}
PortMapping defines port exposure
type PublishMode ¶
type PublishMode string
PublishMode defines how a port is published
const ( // PublishModeHost publishes port only on the node running the task PublishModeHost PublishMode = "host" // PublishModeIngress publishes port on all nodes with routing mesh PublishModeIngress PublishMode = "ingress" )
type RateLimit ¶
type RateLimit struct {
RequestsPerSecond float64 // Requests allowed per second
Burst int // Burst capacity (token bucket size)
}
RateLimit defines rate limiting configuration
type ResourceRequirements ¶
type ResourceRequirements struct {
// Limits (maximum allowed)
CPULimit float64 // Cores (e.g., 0.5 = 50% of one core)
MemoryLimit int64 // Bytes
// Reservations (guaranteed minimum)
CPUReservation float64
MemoryReservation int64
}
ResourceRequirements defines resource limits and reservations
type RestartCondition ¶
type RestartCondition string
RestartCondition defines when to restart
const ( RestartNever RestartCondition = "never" RestartOnFailure RestartCondition = "on-failure" RestartAlways RestartCondition = "always" )
type RestartPolicy ¶
type RestartPolicy struct {
Condition RestartCondition
MaxAttempts int
Delay time.Duration
}
RestartPolicy defines container restart behavior
type Secret ¶
type Secret struct {
ID string
Name string
Data []byte // Encrypted with AES-256-GCM
CreatedAt time.Time
UpdatedAt time.Time
}
Secret represents encrypted sensitive data
type Service ¶
type Service struct {
ID string
Name string
Image string
Replicas int
Mode ServiceMode
DeployStrategy DeployStrategy
UpdateConfig *UpdateConfig
Env []string
Ports []*PortMapping
Networks []string
Secrets []string
Volumes []*VolumeMount
Labels map[string]string
HealthCheck *HealthCheck
RestartPolicy *RestartPolicy
Resources *ResourceRequirements
StopTimeout int // Seconds to wait before force-killing tasks (default: 10)
CreatedAt time.Time
UpdatedAt time.Time
}
Service represents a user-defined workload
type ServiceMode ¶
type ServiceMode string
ServiceMode defines how a service is scheduled
const ( ServiceModeReplicated ServiceMode = "replicated" // N replicas ServiceModeGlobal ServiceMode = "global" // One per node )
type TLSCertificate ¶
type TLSCertificate struct {
ID string // Unique identifier
Name string // Certificate name (e.g., "example-com-cert")
Hosts []string // Hostnames covered by this cert (e.g., ["example.com", "*.example.com"])
CertPEM []byte // Certificate in PEM format
KeyPEM []byte // Private key in PEM format (encrypted in storage)
Issuer string // Certificate issuer (e.g., "Let's Encrypt", "self-signed", "manual")
NotBefore time.Time // Certificate valid from
NotAfter time.Time // Certificate valid until
AutoRenew bool // Enable automatic renewal (M7.3)
Labels map[string]string // Labels for organization
CreatedAt time.Time
UpdatedAt time.Time
}
TLSCertificate represents a TLS certificate for ingress
type Task ¶
type Task struct {
ID string
ServiceID string
ServiceName string
NodeID string
ContainerID string
DesiredState TaskState
ActualState TaskState
Image string
Env []string
Ports []*PortMapping
Mounts []*VolumeMount
Secrets []string // Secret names to mount
HealthCheck *HealthCheck
HealthStatus *HealthStatus // Current health check status
RestartPolicy *RestartPolicy
Resources *ResourceRequirements
StopTimeout int // Seconds to wait before force-killing (default: 10)
CreatedAt time.Time
StartedAt time.Time
FinishedAt time.Time
ExitCode int
Error string
}
Task represents a single running instance of a service
type UpdateConfig ¶
type UpdateConfig struct {
Parallelism int // How many tasks to update simultaneously
Delay time.Duration // Delay between batches
FailureAction string // "pause", "rollback", "continue"
CanaryWeight int // 0-100 (for canary strategy)
}
UpdateConfig controls how service updates are performed
type Volume ¶
type Volume struct {
ID string
Name string
Driver string // "local", "nfs", etc.
NodeID string // Node affinity (for local volumes)
MountPath string // Host mount path
Options map[string]string // Driver-specific options
CreatedAt time.Time
}
Volume represents persistent storage
type VolumeMount ¶
type VolumeMount struct {
Source string // Volume name
Target string // Container path
ReadOnly bool
}
VolumeMount defines a volume mount point