Documentation
¶
Index ¶
- func ClientHeartbeatInit(clientConfigLock *sync.RWMutex, js nats.JetStreamContext, replicas int)
- func DefaultStrategies() map[string]PlacementStrategy
- func DeploymentsHealthRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func DeploymentsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func DeploymentsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func DeploymentsUnbrokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func GetLeaderName(lock *sync.RWMutex, js nats.JetStreamContext) (string, bool)
- func GroupsIdRoute(w http.ResponseWriter, req *http.Request)
- func GroupsRoute(w http.ResponseWriter, req *http.Request)
- func IsPro() bool
- func NodesUnbrokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegisterNodeDispatchHandler(nc *nats.Conn, selfSanitized string) error
- func RegisterRoutes(router *mux.Router)
- func SetMountedStorageProvider(f func() []string)
- func SetNodeIdentityProvider(f func() NodeIdentity)
- func StartResourceSampler()
- func StartScheduler(lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn, self string, ...)
- func StopResourceSampler()
- func StopScheduler()
- type CreateGroupRequest
- type Deployment
- type DeploymentHealth
- type NodeIdentity
- type NodeMetrics
- type NodeResources
- type PlacementInput
- type PlacementStrategy
- type UpdateGroupRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientHeartbeatInit ¶ added in v0.22.11
func ClientHeartbeatInit(clientConfigLock *sync.RWMutex, js nats.JetStreamContext, replicas int)
func DefaultStrategies ¶ added in v0.22.11
func DefaultStrategies() map[string]PlacementStrategy
func DeploymentsHealthRoute ¶ added in v0.22.19
func DeploymentsHealthRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
DeploymentsHealthRoute godoc @Summary Cluster health for all deployments @Description Returns desired vs. actual replica placement per deployment plus @Description scheduler quarantine state (Pro feature). Read-only: safe to call @Description from any node, not just the scheduler leader. @Tags deployments @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 503 {object} utils.HTTPErrorResult @Router /api/constellation/deployments/health [get]
func DeploymentsIdRoute ¶ added in v0.22.11
func DeploymentsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
func DeploymentsRoute ¶ added in v0.22.11
func DeploymentsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
func DeploymentsUnbrokeRoute ¶ added in v0.22.19
func DeploymentsUnbrokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
DeploymentsUnbrokeRoute godoc @Summary Clear a deployment's quarantine @Description Removes a deployment from the scheduler's quarantine set so the @Description next reconcile cycle attempts to place it again (Pro feature). @Tags deployments @Produce json @Security BearerAuth @Param name path string true "Deployment name" @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/constellation/deployments/{name}/unbroke [post]
func GetLeaderName ¶ added in v0.22.19
func GroupsIdRoute ¶ added in v0.22.3
func GroupsIdRoute(w http.ResponseWriter, req *http.Request)
func GroupsRoute ¶ added in v0.22.3
func GroupsRoute(w http.ResponseWriter, req *http.Request)
func NodesUnbrokeRoute ¶ added in v0.22.19
func NodesUnbrokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
NodesUnbrokeRoute godoc @Summary Clear a node's quarantine @Description Removes a node from the scheduler's quarantine set and resets its @Description fail streak so the next reconcile cycle is free to place work on it @Description again (Pro feature). @Tags deployments @Produce json @Security BearerAuth @Param name path string true "Node (device) name" @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/constellation/nodes/{name}/unbroke [post]
func RegisterNodeDispatchHandler ¶ added in v0.22.11
func RegisterRoutes ¶
func SetMountedStorageProvider ¶ added in v0.22.11
func SetMountedStorageProvider(f func() []string)
func SetNodeIdentityProvider ¶ added in v0.22.11
func SetNodeIdentityProvider(f func() NodeIdentity)
func StartResourceSampler ¶ added in v0.22.11
func StartResourceSampler()
func StartScheduler ¶ added in v0.22.11
func StartScheduler(lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn, self string, strategies map[string]PlacementStrategy)
func StopResourceSampler ¶ added in v0.22.11
func StopResourceSampler()
func StopScheduler ¶ added in v0.22.11
func StopScheduler()
Types ¶
type CreateGroupRequest ¶ added in v0.22.3
type CreateGroupRequest struct {
Name string `json:"name" validate:"required"`
Permissions []utils.Permission `json:"permissions"`
}
type Deployment ¶ added in v0.22.11
type Deployment struct {
Name string `json:"name" validate:"required,min=3,max=64,alphanum"`
Replicas int `json:"replicas" validate:"required,min=1"`
// Strategy selects which PlacementStrategy the scheduler uses for this
// deployment. Empty is treated as "round-robin" for back-compat with
// KV entries written before this field existed.
Strategy string `json:"strategy" validate:"omitempty,oneof=round-robin least-busy"`
// Tags filter eligible placement nodes. A deployment with Tags=["gpu"]
// will only land on nodes whose ConstellationDevice.Tags contains "gpu".
// Multiple tags are AND'd: ["gpu","nvme"] requires both. Empty means no
// filter — any node is eligible.
Tags []string `json:"tags,omitempty" validate:"omitempty,dive,min=1,max=64"`
// Storage lists RCLONE remote names this deployment depends on. Checked
// node-side in executeApply before docker.CreateService runs — a missing
// remote produces StatusFail and flows through the existing fail-streak
// quarantine path. Not a placement filter: RCLONE config is cluster-synced
// via constellation, so every eligible node has the same remote set.
// ${storage.NAME} in compose fields resolves to the mount path on apply.
Storage []string `json:"storage,omitempty" validate:"omitempty,dive,min=1,max=64"`
Compose docker.DockerServiceCreateRequest `json:"compose" validate:"required"`
}
type DeploymentHealth ¶ added in v0.22.19
type DeploymentHealth struct {
Desired int `json:"desired"`
Actual int `json:"actual"`
Nodes []string `json:"nodes"`
Broken bool `json:"broken"`
BrokenReason string `json:"brokenReason,omitempty"`
// Version is the desired (current) spec version. UpToDate counts how many of
// the nodes reporting this deployment are running that version. Updating is
// true while a spec change is still rolling out — i.e. at least one reporting
// node is on an older version. A deployment is only fully healthy when
// Actual == Desired AND UpToDate == Actual (Updating == false).
Version int `json:"version"`
UpToDate int `json:"upToDate"`
Updating bool `json:"updating"`
}
DeploymentHealth is the per-deployment cluster status returned by the health endpoint. `desired` is the configured replica count; `actual` is how many nodes currently report running it (from each node's constellation-nodes heartbeat); `broken` mirrors the scheduler's quarantine state.
type NodeIdentity ¶ added in v0.22.11
type NodeMetrics ¶ added in v0.22.11
type NodeResources ¶ added in v0.22.11
func GetCurrentResources ¶ added in v0.22.11
func GetCurrentResources() NodeResources
type PlacementInput ¶ added in v0.22.11
type PlacementInput struct {
Deployment Deployment
EligibleNodes []string
CurrentlyOn []string
NodeMetrics map[string]NodeMetrics
}
type PlacementStrategy ¶ added in v0.22.11
type PlacementStrategy interface {
Choose(in PlacementInput) []string
}
PlacementStrategy is the interface implemented by deployment placement strategies in Cosmos Pro. The free build ships no implementations; the scheduler entry points return early before any strategy is consulted.
type UpdateGroupRequest ¶ added in v0.22.3
type UpdateGroupRequest struct {
Name *string `json:"name,omitempty"`
Permissions []utils.Permission `json:"permissions,omitempty"`
}