Documentation
¶
Index ¶
- Constants
- func ApplyStateReseed(lock *sync.RWMutex, js nats.JetStreamContext)
- func CIAllBuildsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIBuildActionRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIBuildIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIBuildLogsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIBuildsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIConnectionReposRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIConnectionsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIConnectionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIDetectRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIImagePullAuth(host string) (string, string)
- func CIProjectCopyRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIProjectWebhookRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIProjectsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIProjectsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIRunnersRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func CIWebhookRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- 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 FunctionRuntimesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func FunctionsDeployRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func FunctionsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func FunctionsInvokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func FunctionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func FunctionsVersionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func GetLeaderName(lock *sync.RWMutex, nc *nats.Conn, 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 ListManagedDBsRunningHere() ([]string, error)
- func ListSeaweedFSMastersRunningHere() ([]string, error)
- func ManagedDBBackupRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBBackupRunRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBConnectionRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBDatabaseIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBDatabasesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBRestoreRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBRotateRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func ManagedDBRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func NodesUnbrokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegisterCIResponder(nc *nats.Conn, self string) (*nats.Subscription, error)
- func RegisterManagedDBResponder(nc *nats.Conn, self string) (*nats.Subscription, error)
- func RegisterNodeDispatchHandler(nc *nats.Conn, selfSanitized string) error
- func RegisterRegistryProtocolRoutes(router *mux.Router)
- func RegisterRoutes(router *mux.Router)
- func RegisterSeaweedFSResponder(nc *nats.Conn, self string) (*nats.Subscription, error)
- func RegistriesServedHere(lock *sync.RWMutex, js nats.JetStreamContext, nodeTags []string) []string
- func RegistryGCRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryGenericFileRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryGenericPackageIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryGenericPackagesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryGenericVersionIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryGenericVersionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistrySettingsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryStaticActivateRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryStaticSiteIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryStaticSitesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryStaticVersionDownloadRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryStaticVersionIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryStaticVersionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryTokenIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RegistryTokensRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func RemoveStateFiles()
- func SeaweedFSBackupRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSBackupRunRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSDrainRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSJobsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSRepairRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSReplaceMasterRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSRestrictRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSS3RouteRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSStatusRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSStorageRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SeaweedFSUpgradeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func SetCIClusterDomainProvider(f func() string)
- func SetCIMetricPusher(f func(key string, value int, label, unit, object, setOperation, agglo string))
- func SetManagedDatabaseProvider(f func() []ManagedDatabase)
- func SetMountedStorageProvider(f func() []string)
- func SetNodeIdentityProvider(f func() NodeIdentity)
- func SetRegistryClusterHandles(f func() (*sync.RWMutex, nats.JetStreamContext, *nats.Conn))
- func SetRegistryNodeProvider(f func() RegistryNodeInfo)
- func SetSeaweedFSClusterHandles(f func() (*sync.RWMutex, nats.JetStreamContext, *nats.Conn))
- func SetSeaweedFSMetricPusher(f func(key string, value int, max uint64, label, unit, object string))
- func SetSeaweedFSProvider(f func() []SeaweedFSStatus)
- func SetStateClusterHandles(fn func() (*sync.RWMutex, nats.JetStreamContext, *nats.Conn))
- func StageStateReseed() error
- func StartCIScheduler()
- func StartFeatureMetrics()
- func StartFunctionTriggers()
- func StartManagedDBBackupReconciler()
- func StartRegistryGC()
- func StartRegistryServing()
- func StartResourceSampler()
- func StartScheduler(lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn, self string, ...)
- func StartSchedulerWithOptions(lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn, self string, ...)
- func StartSeaweedFSReconciler()
- func StartStateMirror()
- func StateImportRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func StateRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func StateStartEmptyRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- func StopResourceSampler()
- func StopScheduler()
- func TagNodesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, ...)
- type CIBuildSettings
- type CIBuildTriggerRequest
- type CICopyRequest
- type CICopyResult
- type CIDeployRule
- type CIDeployTemplate
- type CIDetectRequest
- type CIEnvironment
- type CIGitConnection
- type CIGitConnectionView
- type CIPreview
- type CIProject
- type CIProjectStats
- type CIRegistryTarget
- type CIRepository
- type CISecret
- type CISource
- type CITrust
- type CIWebhook
- type CreateGroupRequest
- type Deployment
- type DeploymentFunction
- type DeploymentHealth
- type Function
- type FunctionCronTrigger
- type FunctionDeployRequest
- type FunctionHandler
- type FunctionInvokeRequest
- type FunctionLimits
- type FunctionRelease
- type FunctionSource
- type FunctionTriggers
- type ManagedDBBackup
- type ManagedDBBackupRequest
- type ManagedDBCreateRequest
- type ManagedDBLogicalRequest
- type ManagedDBRestoreRequest
- type ManagedDBUpdateRequest
- type ManagedDatabase
- type ManagedLogicalDB
- type NodeIdentity
- type NodeMetrics
- type NodeResources
- type PlacementInput
- type PlacementStrategy
- type ProState
- type RegistryCreateRequest
- type RegistryInstance
- type RegistryNodeInfo
- type RegistrySettingsRequest
- type RegistryStaticActivateRequest
- type RegistryStaticSiteSettings
- type RegistryStats
- type RegistryStatus
- type RegistryStorage
- type RegistryToken
- type RegistryTokenCreateRequest
- type SchedulerOptions
- type SeaweedFSCreateRequest
- type SeaweedFSDrainRequest
- type SeaweedFSInstance
- type SeaweedFSReplaceMasterRequest
- type SeaweedFSRestrictRequest
- type SeaweedFSRouteRequest
- type SeaweedFSStatus
- type SeaweedFSStorageRequest
- type SeaweedFSUpgradeRequest
- type StateImportResult
- type StateSummary
- type SwfsJobsConfig
- type SwfsMaster
- type SwfsNodeUsage
- type SwfsUsage
- type UpdateGroupRequest
Constants ¶
const ( StateMirrorFile = "backup.cosmos-state.json" StateReseedFile = "reseed.cosmos-state.json" ImportingKey = "__importing__" )
Variables ¶
This section is empty.
Functions ¶
func ApplyStateReseed ¶ added in v0.24.0
func ApplyStateReseed(lock *sync.RWMutex, js nats.JetStreamContext)
func CIAllBuildsRoute ¶ added in v0.24.0
func CIAllBuildsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIAllBuildsRoute godoc @Summary List recent builds across CI projects @Description Returns the most recent builds of every project, newest first (Pro feature) @Tags ci @Produce json @Security BearerAuth @Param limit query int false "Maximum number of builds" @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/builds [get]
func CIBuildActionRoute ¶ added in v0.24.0
func CIBuildActionRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIBuildActionRoute godoc @Summary Act on a build of a CI project @Description Runs one action on the build: cancel, retry, approve (a pull-request build waiting for @Description approval) or deploy (Pro feature). @Tags ci @Produce json @Security BearerAuth @Param name path string true "CI project name" @Param number path int true "Build number" @Param action path string true "Action" Enums(cancel, retry, approve, deploy) @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/projects/{name}/builds/{number}/{action} [post]
func CIBuildIdRoute ¶ added in v0.24.0
func CIBuildIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIBuildIdRoute reads one build (GET) or deletes its record (DELETE).
func CIBuildLogsRoute ¶ added in v0.24.0
func CIBuildLogsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIBuildLogsRoute godoc @Summary Read the logs of a build step @Description Returns the output of one step from chunk `from`. The answer carries `next`, the chunk to @Description ask for on the next poll, and `done` once the step has finished (Pro feature). @Tags ci @Produce json @Security BearerAuth @Param name path string true "CI project name" @Param number path int true "Build number" @Param job query string false "Job name (empty: the build's own steps)" @Param step query int false "Step index" @Param from query int false "First chunk to return" @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/projects/{name}/builds/{number}/logs [get]
func CIBuildsRoute ¶ added in v0.24.0
func CIBuildsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIBuildsRoute lists (GET, ?limit=) or triggers (POST {branch, sha}) builds of a project.
func CIConnectionReposRoute ¶ added in v0.24.0
func CIConnectionReposRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIConnectionReposRoute godoc @Summary List the repositories a git connection can reach @Description Asks the provider which repositories the connection's token can access, most recently @Description updated first, and filters them by ?q=. Plain git connections cannot list (Pro feature). @Tags ci @Produce json @Security BearerAuth @Param name path string true "Connection name" @Param q query string false "Filter on the repository name" @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/connections/{name}/repos [get]
func CIConnectionsIdRoute ¶ added in v0.24.0
func CIConnectionsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIConnectionsIdRoute reads (GET), replaces (PUT) or deletes (DELETE) a connection.
func CIConnectionsRoute ¶ added in v0.24.0
func CIConnectionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIConnectionsRoute lists (GET) or creates (POST) git connections.
func CIDetectRoute ¶ added in v0.24.0
func CIDetectRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIDetectRoute godoc @Summary Detect what CI would build from a repository @Description Clones the repository and reports what CI would do with it, without creating anything (Pro feature). @Tags ci @Accept json @Produce json @Security BearerAuth @Param body body CIDetectRequest true "Repository to inspect" @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/detect [post]
func CIImagePullAuth ¶ added in v0.24.0
CIImagePullAuth is wired as docker.ImagePullAuthProvider.
func CIProjectCopyRoute ¶ added in v0.24.0
func CIProjectCopyRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIProjectCopyRoute godoc @Summary Copy secrets and environment variables from another CI project @Description Copies the chosen sets (secrets, build env, runtime env) of the source project onto this one. @Description Same-named entries are replaced, the others kept. Secret values never leave the server (Pro feature). @Tags ci @Accept json @Produce json @Security BearerAuth @Param name path string true "Project name (destination)" @Param body body CICopyRequest true "What to copy and from where" @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/projects/{name}/copy [post]
func CIProjectWebhookRoute ¶ added in v0.24.0
func CIProjectWebhookRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIProjectWebhookRoute godoc @Summary Rotate or re-register the webhook of a CI project @Description rotate mints a new webhook secret; register re-creates the hook on the git provider (Pro feature) @Tags ci @Produce json @Security BearerAuth @Param name path string true "CI project name" @Param action path string true "Action" Enums(rotate, register) @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/projects/{name}/webhook/{action} [post]
func CIProjectsIdRoute ¶ added in v0.24.0
func CIProjectsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIProjectsIdRoute reads (GET), replaces (PUT) or deletes (DELETE) a project.
func CIProjectsRoute ¶ added in v0.24.0
func CIProjectsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIProjectsRoute lists (GET) or creates (POST) projects.
func CIRunnersRoute ¶ added in v0.24.0
func CIRunnersRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIRunnersRoute godoc @Summary List the CI build capacity of the cluster @Description Returns every node with its running jobs, buildkitd state, architecture and the @Description platforms it can build for (native and emulated) (Pro feature) @Tags ci @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/runners [get]
func CIWebhookRoute ¶ added in v0.24.0
func CIWebhookRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
CIWebhookRoute godoc @Summary Receive a CI provider webhook @Description Accepts a push / pull-request delivery for the named project and queues a build (Pro feature) @Tags ci @Accept json @Produce json @Param name path string true "CI project name" @Success 200 {object} utils.APIResponse @Router /api/constellation/ci/hooks/{name} [post]
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 FunctionRuntimesRoute ¶ added in v0.24.0
func FunctionRuntimesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
FunctionRuntimesRoute godoc @Summary List the function runtimes @Description Returns the runtime table: key, label, default image and the registry type it reads packages from (Pro feature) @Tags functions @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Router /api/constellation/function-runtimes [get]
func FunctionsDeployRoute ¶ added in v0.24.0
func FunctionsDeployRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
FunctionsDeployRoute godoc @Summary Deploy a version of a function @Description Pins a published version of the function's package and (re)writes the deployment (Pro feature) @Tags functions @Accept json @Produce json @Security BearerAuth @Param name path string true "Function name" @Param body body FunctionDeployRequest false "Version to deploy" @Success 200 {object} utils.APIResponse @Router /api/constellation/functions/{name}/deploy [post]
func FunctionsIdRoute ¶ added in v0.24.0
func FunctionsIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
FunctionsIdRoute reads (GET), replaces (PUT) or deletes (DELETE) a function.
func FunctionsInvokeRoute ¶ added in v0.24.0
func FunctionsInvokeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
FunctionsInvokeRoute godoc @Summary Invoke a function @Description Invokes the function from this node and returns the node, status, body and duration (admin test) (Pro feature) @Tags functions @Accept json @Produce json @Security BearerAuth @Param name path string true "Function name" @Param body body FunctionInvokeRequest false "Request to send" @Success 200 {object} utils.APIResponse @Router /api/constellation/functions/{name}/invoke [post]
func FunctionsRoute ¶ added in v0.24.0
func FunctionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
FunctionsRoute lists (GET) or creates (POST) functions.
func FunctionsVersionsRoute ¶ added in v0.24.0
func FunctionsVersionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
FunctionsVersionsRoute godoc @Summary List the published versions of a function @Description Returns the versions of the function's package, newest first, with the registry's latest and the active one flagged (Pro feature) @Tags functions @Produce json @Security BearerAuth @Param name path string true "Function name" @Success 200 {object} utils.APIResponse @Router /api/constellation/functions/{name}/versions [get]
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 ListManagedDBsRunningHere ¶ added in v0.24.0
func ListSeaweedFSMastersRunningHere ¶ added in v0.24.0
ListSeaweedFSMastersRunningHere returns the instance names with a running master container on this host (liveness only).
func ManagedDBBackupRoute ¶ added in v0.24.0
func ManagedDBBackupRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
ManagedDBBackupRoute handles the backup configuration of one instance.
func ManagedDBBackupRunRoute ¶ added in v0.24.0
func ManagedDBBackupRunRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
ManagedDBBackupRunRoute triggers a backup now.
func ManagedDBBackupSnapshotsRoute ¶ added in v0.24.0
func ManagedDBBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
ManagedDBBackupSnapshotsRoute lists an instance's snapshots.
func ManagedDBConnectionRoute ¶ added in v0.24.0
func ManagedDBConnectionRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
ManagedDBConnectionRoute returns the unredacted connection info for one instance.
func ManagedDBDatabaseIdRoute ¶ added in v0.24.0
func ManagedDBDatabaseIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
ManagedDBDatabaseIdRoute handles one logical database of one instance.
func ManagedDBDatabasesRoute ¶ added in v0.24.0
func ManagedDBDatabasesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
ManagedDBDatabasesRoute handles the logical-database collection of one instance.
func ManagedDBIdRoute ¶ added in v0.24.0
func ManagedDBIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
ManagedDBIdRoute handles the per-instance endpoint.
func ManagedDBRestoreRoute ¶ added in v0.24.0
func ManagedDBRestoreRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
ManagedDBRestoreRoute restores a snapshot into a brand-new instance.
func ManagedDBRotateRoute ¶ added in v0.24.0
func ManagedDBRotateRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
ManagedDBRotateRoute rotates one logical database role's password.
func ManagedDBRoute ¶ added in v0.24.0
func ManagedDBRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
ManagedDBRoute handles the collection endpoint.
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 RegisterCIResponder ¶ added in v0.24.0
RegisterCIResponder subscribes this node to its own op subject.
func RegisterManagedDBResponder ¶ added in v0.24.0
RegisterManagedDBResponder subscribes to this node's managed-DB op subject; self must be the constellation device name verbatim.
func RegisterNodeDispatchHandler ¶ added in v0.22.11
func RegisterRegistryProtocolRoutes ¶ added in v0.24.0
RegisterRegistryProtocolRoutes wires the protocol endpoints onto the router. Called from InitServer BEFORE proxy.BuildFromConfig so the direct handler wins over the materialized loopback route (mux matches in registration order). /v2 is claimed before the npm and generic catch-alls, which live at the root.
func RegisterRoutes ¶
func RegisterSeaweedFSResponder ¶ added in v0.24.0
RegisterSeaweedFSResponder subscribes this node to its own op subject.
func RegistriesServedHere ¶ added in v0.24.0
RegistriesServedHere returns the registry endpoint names this node serves, given its tags; a KV failure degrades to an empty list.
func RegistryGCRoute ¶ added in v0.24.0
func RegistryGCRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryGCRoute godoc @Summary Run a registry's garbage collection now @Description Starts a mark-and-sweep of the registry's blob store and reconciles its @Description stored-size and package counters. Returns 202 immediately; the outcome @Description arrives as a cosmos.registry.gc event. Blobs younger than 24 hours are @Description never collected, whether or not anything references them (Pro feature). @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Success 202 {object} utils.APIResponse @Router /api/constellation/registries/{name}/gc [post]
func RegistryGenericFileRoute ¶ added in v0.24.0
func RegistryGenericFileRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryGenericFileRoute godoc @Summary Download one file of a package version @Description Streams the file (the version may be "latest"); accepts a Cosmos token @Description with the Resources read permission OR a registry deploy token with pull @Description scope (Pro feature). @Tags registry @Produce octet-stream @Security BearerAuth @Param name path string true "Registry name" @Param package path string true "Package name" @Param version path string true "Version, or latest" @Param file path string true "Filename" @Success 200 {file} binary @Router /api/constellation/registries/{name}/packages/{package}/versions/{version}/files/{file} [get]
func RegistryGenericPackageIdRoute ¶ added in v0.24.0
func RegistryGenericPackageIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryGenericPackageIdRoute godoc @Summary Get one package @Description Returns the package with its versions and files (Pro feature) @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param package path string true "Package name" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/packages/{package} [get]
func RegistryGenericPackagesRoute ¶ added in v0.24.0
func RegistryGenericPackagesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryGenericPackagesRoute godoc @Summary List the packages of a registry @Description Returns every package with its versions and their files. Works for every @Description registry type but static: a docker image's versions are its manifests @Description (named by digest, with the tags resolving to each), an npm package's are @Description its published versions with their dist-tags (Pro feature) @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/packages [get]
func RegistryGenericVersionIdRoute ¶ added in v0.24.0
func RegistryGenericVersionIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryGenericVersionIdRoute godoc @Summary Delete one package version @Description Removes the version and its file entries; the stored files are reclaimed @Description by the next GC pass. For generic and pypi, "latest" is re-pointed at the @Description newest remaining version; for docker (a manifest, by digest) and npm every @Description tag resolving to the deleted version is dropped instead (Pro feature). @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param package path string true "Package name" @Param version path string true "Version" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/packages/{package}/versions/{version} [delete]
func RegistryGenericVersionsRoute ¶ added in v0.24.0
func RegistryGenericVersionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryGenericVersionsRoute godoc @Summary Upload files into a generic package version @Description Stores one or more files under a version. Accepts a multipart form (every @Description file part is stored under its own filename) or a single raw file as the @Description request body, in which case the filename query parameter is required. @Description Query parameters: version (default: a UTC timestamp), filename. A file @Description that already exists in the version is refused (409): upload a new version @Description or delete it first. Accepts a Cosmos token with the Resources permission @Description OR a registry deploy token with push scope on an access that exposes this @Description registry (Pro feature). @Tags registry @Accept octet-stream @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param package path string true "Package name" @Param version query string false "Version (default: UTC timestamp)" @Param filename query string false "Filename, required for a raw body" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/packages/{package}/versions [post]
func RegistryIdRoute ¶ added in v0.24.0
func RegistryIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
func RegistryRoute ¶ added in v0.24.0
func RegistryRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
func RegistrySettingsRoute ¶ added in v0.24.0
func RegistrySettingsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistrySettingsRoute godoc @Summary Update a registry's settings @Description Replaces the quota, the host, the visibility, the anonymous-pull policy, the @Description serving tags or the whole user-facing route. Absent fields keep their stored @Description value (Pro feature). @Tags registry @Accept json @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param body body RegistrySettingsRequest true "Settings to change" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/settings [put]
func RegistryStaticActivateRoute ¶ added in v0.24.0
func RegistryStaticActivateRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryStaticActivateRoute godoc @Summary Activate a static-site deployment @Description Moves the site's active pointer. This is BOTH deploy and rollback: the @Description deployments are immutable, so switching between them is instant and @Description cannot half-apply. Accepts a Cosmos token with the Resources permission @Description OR a registry deploy token with push scope (Pro feature). @Tags registry @Accept json @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param site path string true "Site name" @Param body body RegistryStaticActivateRequest true "Deployment to activate" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/sites/{site}/activate [post]
func RegistryStaticSiteIdRoute ¶ added in v0.24.0
func RegistryStaticSiteIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryStaticSiteIdRoute godoc @Summary Get one static site @Description Returns the site with its deployments (Pro feature) @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param site path string true "Site name" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/sites/{site} [get]
func RegistryStaticSitesRoute ¶ added in v0.24.0
func RegistryStaticSitesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryStaticSitesRoute godoc @Summary List the sites of a static registry @Description Returns every site with its deployments, which one is active, and its @Description route configuration (Pro feature) @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/sites [get]
func RegistryStaticVersionDownloadRoute ¶ added in v0.24.0
func RegistryStaticVersionDownloadRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryStaticVersionDownloadRoute godoc @Summary Download one static-site deployment archive @Description Streams the zip exactly as it was uploaded (the version may be "active" @Description for the one currently served). Accepts a Cosmos token with the Resources @Description read permission OR a registry deploy token with pull scope (Pro feature). @Tags registry @Produce application/zip @Security BearerAuth @Param name path string true "Registry name" @Param site path string true "Site name" @Param version path string true "Deployment version, or active" @Success 200 {file} binary @Router /api/constellation/registries/{name}/sites/{site}/versions/{version}/download [get]
func RegistryStaticVersionIdRoute ¶ added in v0.24.0
func RegistryStaticVersionIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryStaticVersionIdRoute godoc @Summary Delete one static-site deployment @Description Removes the deployment record; the stored zip is reclaimed by the next @Description GC pass. Refused for the deployment that is currently active (Pro feature). @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param site path string true "Site name" @Param version path string true "Deployment version" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/sites/{site}/versions/{version} [delete]
func RegistryStaticVersionsRoute ¶ added in v0.24.0
func RegistryStaticVersionsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryStaticVersionsRoute godoc @Summary Upload a static-site deployment @Description Stores a zip as one immutable deployment. Accepts a multipart form @Description (field "file") or the raw zip as the request body. Query parameters: @Description version (default: a UTC timestamp), activate (default true for the @Description site's first deployment), host/internal/spa/tags to configure the @Description site's route on first upload. Accepts a Cosmos token with the @Description Resources permission OR a deploy token of this registry with push scope @Description (Pro feature). @Tags registry @Accept octet-stream @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param site path string true "Site name" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/sites/{site}/versions [post]
func RegistryTokenIdRoute ¶ added in v0.24.0
func RegistryTokenIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryTokenIdRoute godoc @Summary Revoke a registry deploy token @Description Removes the token; it stops working on this node at once and on the others @Description within their cache TTL (Pro feature). @Tags registry @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param tokenName path string true "Token name" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/tokens/{tokenName} [delete]
func RegistryTokensRoute ¶ added in v0.24.0
func RegistryTokensRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
RegistryTokensRoute godoc @Summary Mint a registry deploy token @Description Creates a deploy token on the registry. The raw token is returned ONCE, in this @Description response, and never stored. Scopes default to pull+push (Pro feature). @Tags registry @Accept json @Produce json @Security BearerAuth @Param name path string true "Registry name" @Param body body RegistryTokenCreateRequest true "Token to mint" @Success 200 {object} utils.APIResponse @Router /api/constellation/registries/{name}/tokens [post]
func RemoveStateFiles ¶ added in v0.24.0
func RemoveStateFiles()
func SeaweedFSBackupRoute ¶ added in v0.24.0
func SeaweedFSBackupRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
func SeaweedFSBackupRunRoute ¶ added in v0.24.0
func SeaweedFSBackupRunRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
SeaweedFSBackupRunRoute starts a metadata backup now, on the job-locus node.
SeaweedFSBackupRunRoute godoc @Summary Run the metadata backup of a managed SeaweedFS instance now @Description Starts a metadata backup on the node running the instance's jobs (Pro feature) @Tags seaweedfs @Produce json @Security BearerAuth @Param name path string true "Instance name" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/backup/run [post]
func SeaweedFSBackupSnapshotsRoute ¶ added in v0.24.0
func SeaweedFSBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
SeaweedFSBackupSnapshotsRoute lists metadata snapshots, resolved on the locus node.
SeaweedFSBackupSnapshotsRoute godoc @Summary List the metadata snapshots of a managed SeaweedFS instance @Description Returns the snapshots of the metadata-backup repository (Pro feature) @Tags seaweedfs @Produce json @Security BearerAuth @Param name path string true "Instance name" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/backup/snapshots [get]
func SeaweedFSDrainRoute ¶ added in v0.24.0
func SeaweedFSDrainRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
SeaweedFSDrainRoute evacuates one live volume server (body: {"device": "<device name>"}).
SeaweedFSDrainRoute godoc @Summary Drain a volume server of a managed SeaweedFS instance @Description Starts the evacuation of one live volume server, so its node can be untagged afterwards @Description without ever being under-replicated (Pro feature). @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SeaweedFSDrainRequest true "Device to drain" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/drain [post]
func SeaweedFSIdRoute ¶ added in v0.24.0
func SeaweedFSIdRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
func SeaweedFSJobsRoute ¶ added in v0.24.0
func SeaweedFSJobsRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
SeaweedFSJobsRoute replaces the instance's maintenance-job configuration.
SeaweedFSJobsRoute godoc @Summary Configure the maintenance jobs of a managed SeaweedFS instance @Description Replaces the maintenance-job configuration; the schedules are re-registered within a minute (Pro feature) @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SwfsJobsConfig true "Job configuration" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/jobs [put]
func SeaweedFSRepairRoute ¶ added in v0.24.0
func SeaweedFSRepairRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
SeaweedFSRepairRoute starts the "this hardware is gone" repair job on the locus node.
SeaweedFSRepairRoute godoc @Summary Repair a managed SeaweedFS instance after losing hardware @Description Starts the repair job that restores the replication of the volumes a lost node held (Pro feature) @Tags seaweedfs @Produce json @Security BearerAuth @Param name path string true "Instance name" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/repair [post]
func SeaweedFSReplaceMasterRoute ¶ added in v0.24.0
func SeaweedFSReplaceMasterRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
SeaweedFSReplaceMasterRoute swaps one pinned master for another manager (body: {"oldDevice": "...", "newDevice": "..."} — newDevice optional).
SeaweedFSReplaceMasterRoute godoc @Summary Replace a master of a managed SeaweedFS instance @Description Swaps one pinned master for another manager (the next live manager outside the set when @Description newDevice is absent), then starts the rolling master re-provision (Pro feature). @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SeaweedFSReplaceMasterRequest true "Master to replace" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/replace-master [post]
func SeaweedFSRestrictRoute ¶ added in v0.24.0
func SeaweedFSRestrictRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
SeaweedFSRestrictRoute toggles constellation-only access (compose rewrite + version bump).
SeaweedFSRestrictRoute godoc @Summary Restrict a managed SeaweedFS instance to the constellation @Description Toggles constellation-only access to the S3 endpoint. The filers are cycled one @Description node at a time to apply it (Pro feature). @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SeaweedFSRestrictRequest true "Restriction to apply" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/restrict [post]
func SeaweedFSRoute ¶ added in v0.24.0
func SeaweedFSRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
func SeaweedFSS3RouteRoute ¶ added in v0.24.0
func SeaweedFSS3RouteRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
SeaweedFSS3RouteRoute godoc @Summary Update the S3 endpoint's proxy route @Description Replaces the user-facing settings of the instance's S3 route (auth, @Description shield, whitelist...). Name, mode, target, tunnel and owner are @Description forced server-side; the restriction flag is mirrored onto the record. @Description The route lives in the filer deployment's compose, so this is a compose @Description rewrite + version bump; nodes apply it without recreating the filers @Description (Pro feature). @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SeaweedFSRouteRequest true "Route to store" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/route [put]
func SeaweedFSStatusRoute ¶ added in v0.24.0
func SeaweedFSStatusRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
SeaweedFSStatusRoute is the unredacted view: full status plus the S3 credentials and endpoint URLs.
SeaweedFSStatusRoute godoc @Summary Get a managed SeaweedFS instance with its S3 credentials @Description Returns the unredacted instance status (S3 access and secret keys included) and @Description the S3 endpoint URLs. Hands out a credential, so it needs the write permission (Pro feature). @Tags seaweedfs @Produce json @Security BearerAuth @Param name path string true "Instance name" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/status [get]
func SeaweedFSStorageRoute ¶ added in v0.24.0
func SeaweedFSStorageRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
SeaweedFSStorageRoute changes the per-node storage cap. Shrinking below what a node already holds deletes nothing; the node just stops receiving new volumes until it is back under the ceiling.
SeaweedFSStorageRoute godoc @Summary Change the per-node storage cap of a managed SeaweedFS instance @Description Sets the storage cap per node (0 = unlimited) and rolls the volume servers one node at a @Description time. Lowering it below what a node holds deletes nothing: the node just stops receiving @Description new volumes until it is back under the cap (Pro feature). @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SeaweedFSStorageRequest true "Storage cap" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/storage [put]
func SeaweedFSUpgradeRoute ¶ added in v0.24.0
func SeaweedFSUpgradeRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn)
SeaweedFSUpgradeRoute starts a rolling upgrade (body: {"image": "..."}).
SeaweedFSUpgradeRoute godoc @Summary Upgrade a managed SeaweedFS instance @Description Starts a rolling upgrade to the given image: the masters one at a time, then the volume @Description and filer deployments one node at a time (Pro feature). @Tags seaweedfs @Accept json @Produce json @Security BearerAuth @Param name path string true "Instance name" @Param body body SeaweedFSUpgradeRequest true "Image to upgrade to" @Success 200 {object} utils.APIResponse @Router /api/constellation/seaweedfs/{name}/upgrade [post]
func SetCIClusterDomainProvider ¶ added in v0.24.0
func SetCIClusterDomainProvider(f func() string)
SetCIClusterDomainProvider is the exported setter, same pattern as SetRegistryNodeProvider.
func SetCIMetricPusher ¶ added in v0.24.0
func SetCIMetricPusher(f func(key string, value int, label, unit, object, setOperation, agglo string))
SetCIMetricPusher wires the metrics sink for CI counters.
func SetManagedDatabaseProvider ¶ added in v0.24.0
func SetManagedDatabaseProvider(f func() []ManagedDatabase)
SetManagedDatabaseProvider is wired by constellation to ListManagedDatabases.
func SetMountedStorageProvider ¶ added in v0.22.11
func SetMountedStorageProvider(f func() []string)
SetMountedStorageProvider is wired by constellation to storage.CachedRemoteStorageList.
func SetNodeIdentityProvider ¶ added in v0.22.11
func SetNodeIdentityProvider(f func() NodeIdentity)
SetNodeIdentityProvider is wired by the constellation package at startup.
func SetRegistryClusterHandles ¶ added in v0.24.0
func SetRegistryNodeProvider ¶ added in v0.24.0
func SetRegistryNodeProvider(f func() RegistryNodeInfo)
func SetSeaweedFSClusterHandles ¶ added in v0.24.0
func SetSeaweedFSMetricPusher ¶ added in v0.24.0
func SetSeaweedFSProvider ¶ added in v0.24.0
func SetSeaweedFSProvider(f func() []SeaweedFSStatus)
SetSeaweedFSProvider is wired by constellation to ListSeaweedFSWithStatus.
func SetStateClusterHandles ¶ added in v0.24.0
func StageStateReseed ¶ added in v0.24.0
func StageStateReseed() error
func StartCIScheduler ¶ added in v0.24.0
func StartCIScheduler()
StartCIScheduler starts the leader loop, once per process.
func StartFeatureMetrics ¶ added in v0.24.0
func StartFeatureMetrics()
func StartFunctionTriggers ¶ added in v0.24.0
func StartFunctionTriggers()
func StartManagedDBBackupReconciler ¶ added in v0.24.0
func StartManagedDBBackupReconciler()
func StartRegistryGC ¶ added in v0.24.0
func StartRegistryGC()
StartRegistryGC starts the reconciler that keeps this node's registry GC jobs in sync with leadership.
func StartRegistryServing ¶ added in v0.24.0
func StartRegistryServing()
StartRegistryServing starts the registry KV watcher and the upload-session janitor.
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 StartSchedulerWithOptions ¶ added in v0.23.0
func StartSchedulerWithOptions(lock *sync.RWMutex, js nats.JetStreamContext, nc *nats.Conn, self string, strategies map[string]PlacementStrategy, opts SchedulerOptions)
func StartSeaweedFSReconciler ¶ added in v0.24.0
func StartSeaweedFSReconciler()
func StartStateMirror ¶ added in v0.24.0
func StartStateMirror()
func StateImportRoute ¶ added in v0.24.0
func StateImportRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
StateImportRoute godoc @Summary Import a Pro state file @Description Body is a state file as produced by the export. Writes every record that does not already @Description exist and leaves existing ones untouched; never creates containers or touches quarantine @Description state. Returns created/present counts per bucket. Pro feature. @Tags state @Accept json @Produce json @Security BearerAuth @Param body body ProState true "State file" @Success 200 {object} utils.APIResponse @Router /api/constellation/state/import [post]
func StateRoute ¶ added in v0.24.0
func StateRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
StateRoute godoc @Summary Get the Pro state mirror summary @Description Returns record counts per bucket as held by the on-disk state mirror (backup.cosmos-state.json), @Description when it was written, whether a reform reseed is pending and whether an import is marked in @Description progress (which freezes the scheduler). Pro feature. @Tags state @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Router /api/constellation/state [get]
func StateStartEmptyRoute ¶ added in v0.24.0
func StateStartEmptyRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
StateStartEmptyRoute godoc @Summary Clear a frozen state import @Description Removes the import-in-progress marker left by a failed import or reseed, accepting the @Description deployments bucket as it is and letting the scheduler reconcile again. Pro feature. @Tags state @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Router /api/constellation/state/start-empty [post]
func StopResourceSampler ¶ added in v0.22.11
func StopResourceSampler()
func StopScheduler ¶ added in v0.22.11
func StopScheduler()
func TagNodesRoute ¶ added in v0.24.0
func TagNodesRoute(w http.ResponseWriter, req *http.Request, lock *sync.RWMutex, js nats.JetStreamContext)
TagNodesRoute godoc @Summary Which nodes a tag set selects @Description Returns the nodes whose tags satisfy every requested tag (AND @Description semantics; an empty tag set matches every node), each flagged with @Description whether it is currently heartbeating, plus the cluster totals the @Description UI needs for a "matches N of M nodes" hint (Pro feature). @Description Read-only and answerable from any node. @Tags deployments @Produce json @Security BearerAuth @Param tags query string false "Comma-separated tags, ANDed together" @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 405 {object} utils.HTTPErrorResult @Router /api/constellation/tag-nodes [get]
Types ¶
type CIBuildSettings ¶ added in v0.24.0
type CIBuildSettings struct {
Strategy string `json:"strategy,omitempty"`
Dockerfile string `json:"dockerfile,omitempty"`
PublishDir string `json:"publishDir,omitempty"`
Env map[string]string `json:"env,omitempty"`
// Platform is the image platform (default: the build node's).
Platform string `json:"platform,omitempty"`
TimeoutMinutes int `json:"timeoutMinutes,omitempty"`
}
CIBuildSettings are the UI overrides of the detected strategy. Everything here is also settable in cosmos.json `build`, which wins when present.
type CIBuildTriggerRequest ¶ added in v0.24.0
type CIBuildTriggerRequest struct {
// Branch defaults to the project's default branch.
Branch string `json:"branch,omitempty"`
// SHA pins the commit; empty builds the branch head.
SHA string `json:"sha,omitempty"`
}
CIBuildTriggerRequest is the body of a manual build. Both fields are optional.
type CICopyRequest ¶ added in v0.24.0
type CICopyRequest struct {
// From is the project to copy from.
From string `json:"from"`
// Secrets copies the project secrets, values and PR availability included.
Secrets bool `json:"secrets"`
// BuildEnv copies the build-time environment (build.env).
BuildEnv bool `json:"buildEnv"`
// RuntimeEnv copies the runtime environment of the deploy template (deploy.template.env).
RuntimeEnv bool `json:"runtimeEnv"`
}
CICopyRequest is the body of the copy endpoint: what to take from another project. Copied entries replace same-named ones; the rest is kept.
type CICopyResult ¶ added in v0.24.0
type CICopyResult struct {
Secrets int `json:"secrets"`
BuildEnv int `json:"buildEnv"`
RuntimeEnv int `json:"runtimeEnv"`
}
CICopyResult counts what was copied.
type CIDeployRule ¶ added in v0.24.0
type CIDeployRule struct {
Enabled bool `json:"enabled"`
Type string `json:"type,omitempty"`
// Name is the default target (deployment or site) name.
Name string `json:"name,omitempty"`
// Environments: branch glob -> environment. A branch matching no entry is
// built but not deployed.
Environments map[string]CIEnvironment `json:"environments,omitempty"`
// PullRequests enables preview deployments, one per open PR, named
// <name>pr<number>, removed when the PR closes or after PreviewTTL.
PullRequests bool `json:"pullRequests"`
PreviewTTL string `json:"previewTtl,omitempty"`
// PreviewHost is the hostname template of previews; {{pr}} and {{name}}
// are substituted ("pr-{{pr}}.preview.example.com").
PreviewHost string `json:"previewHost,omitempty"`
Template CIDeployTemplate `json:"template"`
}
CIDeployRule is the UI deploy rule; cosmos.json `deploy` overrides it.
type CIDeployTemplate ¶ added in v0.24.0
type CIDeployTemplate struct {
Replicas int `json:"replicas,omitempty"`
Port int `json:"port,omitempty"`
Host string `json:"host,omitempty"`
Env map[string]string `json:"env,omitempty"`
Tags []string `json:"tags,omitempty"`
Strategy string `json:"strategy,omitempty"`
// Healthcheck is a command run inside the container (["CMD", ...]).
Healthcheck []string `json:"healthcheck,omitempty"`
MemLimit int64 `json:"memLimit,omitempty"`
// SPA / Internal apply to static sites.
SPA bool `json:"spa,omitempty"`
Internal bool `json:"internal,omitempty"`
}
CIDeployTemplate is used when CI has to CREATE the deployment (first deploy). Afterwards the deployment is an ordinary user deployment and only its image is touched.
type CIDetectRequest ¶ added in v0.24.0
type CIDetectRequest struct {
Source CISource `json:"source"`
Build CIBuildSettings `json:"build"`
// Project names an existing project whose stored git credentials are used when Source has
// neither a connection nor a token.
Project string `json:"project,omitempty"`
}
CIDetectRequest is the body of the detect endpoint.
type CIEnvironment ¶ added in v0.24.0
type CIEnvironment struct {
// Name is the environment label ("production", "staging").
Name string `json:"name"`
// Deployment / Site is the target name; empty = the rule's default name.
Deployment string `json:"deployment,omitempty"`
// Host is the route hostname the target gets when CI creates it.
Host string `json:"host,omitempty"`
AutoDeploy bool `json:"autoDeploy"`
// Env sets or overrides environment variables of the deployed
// application for this environment only: the service the UI template
// creates, or the cosmos.json services that take the artifact. Values
// may use the build variables and the project secrets (${NAME}).
Env map[string]string `json:"env,omitempty"`
}
CIEnvironment maps a branch to a deployment target.
type CIGitConnection ¶ added in v0.24.0
type CIGitConnection struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
// Provider is one of github, gitlab, gitea, bitbucket or git.
Provider string `json:"provider"`
// Host is the git host the token is valid for (github.com,
// git.example.com). The UI offers the connection for repositories on
// that host, and self-hosted repository listings derive the API base
// from it; empty matches the provider's public host. A pasted URL is
// reduced to its hostname on save.
Host string `json:"host,omitempty"`
// APIURL overrides the provider API base for self-hosted instances;
// empty derives it from the repository URL.
APIURL string `json:"apiUrl,omitempty"`
// Token authenticates clones and provider API calls. Write-only
// through the API: reads answer "****" when set.
Token string `json:"token,omitempty"`
// Username pairs with Token for providers that need one (Bitbucket app
// passwords, plain git basic auth). Defaults per provider.
Username string `json:"username,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
CISource is where the code comes from. CIGitConnection is a set of git credentials shared by projects: one token per provider (or per self-hosted instance) instead of one per repository. A project names it in CISource.Connection; its token, username and API URL then stand in for the project's own.
type CIGitConnectionView ¶ added in v0.24.0
type CIGitConnectionView struct {
CIGitConnection
Projects []string `json:"projects"`
}
CIGitConnectionView is a connection as the API returns it: redacted, plus the projects using it.
type CIPreview ¶ added in v0.24.0
type CIPreview struct {
PR int `json:"pr"`
Branch string `json:"branch"`
Deployment string `json:"deployment"`
Host string `json:"host,omitempty"`
Build int `json:"build"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt"`
}
CIPreview is one live pull-request preview deployment.
type CIProject ¶ added in v0.24.0
type CIProject struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Source CISource `json:"source"`
Build CIBuildSettings `json:"build"`
Deploy CIDeployRule `json:"deploy"`
Registry CIRegistryTarget `json:"registry"`
Secrets []CISecret `json:"secrets,omitempty"`
Trust CITrust `json:"trust"`
// Tags select the nodes builds may run on (AND semantics, like
// deployments). Empty = any node.
Tags []string `json:"tags,omitempty"`
Enabled bool `json:"enabled"`
Webhook CIWebhook `json:"webhook"`
// LastBuildNumber is the per-project build counter (CAS-bumped).
LastBuildNumber int `json:"lastBuildNumber"`
Previews []CIPreview `json:"previews,omitempty"`
Stats CIProjectStats `json:"stats"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
CIProject is the persistent record of one connected repository.
type CIProjectStats ¶ added in v0.24.0
type CIProjectStats struct {
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
LastStatus string `json:"lastStatus,omitempty"`
LastBuild int `json:"lastBuild,omitempty"`
LastBuildAt time.Time `json:"lastBuildAt,omitempty"`
LastDurationMs int64 `json:"lastDurationMs,omitempty"`
}
CIProjectStats is the running tally shown on cards.
type CIRegistryTarget ¶ added in v0.24.0
type CIRegistryTarget struct {
// ArtifactQuotaBytes caps the project's stored file artifacts (0: the
// default, ciDefaultArtifactQuota).
ArtifactQuotaBytes int64 `json:"artifactQuotaBytes,omitempty"`
// Registry: the docker registry to push to (its host prefixes the image); Image: repository name (default: project name).
Registry string `json:"registry,omitempty"`
Image string `json:"image,omitempty"`
// StaticRegistry receives static-site archives.
StaticRegistry string `json:"staticRegistry,omitempty"`
// PackageRegistry receives the package of an npm / pypi strategy. Empty
// on save picks the only registry of that type.
PackageRegistry string `json:"packageRegistry,omitempty"`
// Tokens are Cosmos-minted deploy tokens keyed by registry. Never user-visible.
Tokens map[string]string `json:"tokens,omitempty"`
}
CIRegistryTarget is where artifacts go.
type CIRepository ¶ added in v0.24.0
type CIRepository struct {
// FullName is owner/repo (groups included on GitLab).
FullName string `json:"fullName"`
// URL is the https clone URL.
URL string `json:"url"`
DefaultBranch string `json:"defaultBranch,omitempty"`
Private bool `json:"private"`
Description string `json:"description,omitempty"`
}
CIRepository is one repository a connection can reach.
type CISecret ¶ added in v0.24.0
type CISecret struct {
Name string `json:"name"`
Value string `json:"value,omitempty"`
AvailableToPRs bool `json:"availableToPRs"`
UpdatedAt time.Time `json:"updatedAt"`
}
CISecret is a project secret. Value is write-only through the API.
type CISource ¶ added in v0.24.0
type CISource struct {
Provider string `json:"provider"`
// RepoURL is the https clone URL (https://github.com/owner/repo[.git]).
// An ssh clone URL (git@host:owner/repo.git, ssh://host/owner/repo) is
// accepted on save and converted to its https form: clones and provider
// calls authenticate with the token over https.
RepoURL string `json:"repoUrl"`
// Connection names a CIGitConnection whose credentials this project
// uses. When set, Token and Username below are ignored (and cleared on
// save); APIURL still applies when given, else the connection's does.
Connection string `json:"connection,omitempty"`
// APIURL overrides the provider API base for self-hosted GitLab / Gitea /
// GitHub Enterprise; empty derives it from RepoURL.
APIURL string `json:"apiUrl,omitempty"`
// Token authenticates clones and provider API calls (webhook creation,
// commit statuses, collaborator checks) for a project without a
// connection. Write-only through the API.
Token string `json:"token,omitempty"`
// Username pairs with Token for providers that need one (Bitbucket app
// passwords, plain git basic auth). Defaults per provider.
Username string `json:"username,omitempty"`
// RootDir is the sub-folder to build (monorepos).
RootDir string `json:"rootDir,omitempty"`
// Branches is the UI branch filter (globs). Empty = every branch. Rules
// inside cosmos.json / .woodpecker.yml apply INSIDE this filter.
Branches []string `json:"branches,omitempty"`
// DefaultBranch is what a manual run builds when no branch is given.
DefaultBranch string `json:"defaultBranch,omitempty"`
}
type CITrust ¶ added in v0.24.0
type CITrust struct {
// PullRequests: off | collaborators | nosecrets | approval.
PullRequests string `json:"pullRequests"`
}
CITrust is the per-project trust model.
type CIWebhook ¶ added in v0.24.0
type CIWebhook struct {
// Secret signs inbound deliveries (HMAC / shared token, per provider).
Secret string `json:"secret"`
// ProviderHookID is the id of the hook Cosmos created through the provider
// API, when it could.
ProviderHookID string `json:"providerHookId,omitempty"`
Registered bool `json:"registered"`
Error string `json:"error,omitempty"`
LastDeliveryAt time.Time `json:"lastDeliveryAt,omitempty"`
}
CIWebhook is the inbound hook state.
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 is the fixed replica count (the original mode). Exactly one of
// the three replica modes must be configured — fixed (Replicas), autoscale
// (MinReplicas/MaxReplicas) or fill (ReplicaFill); ValidateReplicaConfig
// enforces the exclusivity since struct tags can't express it. In every
// mode, Tags restricts which nodes are eligible.
Replicas int `json:"replicas,omitempty" validate:"omitempty,min=1"`
// MinReplicas/MaxReplicas switch the deployment to load-based autoscaling:
// each reconcile cycle the leader targets the current replica count clamped
// to [min,max], stepping up by one when the nodes running the deployment
// average above DeployScaleUpThreshold busyness (max of CPU%/RAM% from
// heartbeats) and down by one below DeployScaleDownThreshold, at most one
// step per DeployScaleCooldown. Nodes without trusted metrics
// (MonitoringOn=false) hold the count steady.
// Use Tags to restrict which nodes autoscaled replicas may land on — the
// same affinity filter as the other modes.
MinReplicas int `json:"minReplicas,omitempty" validate:"omitempty,min=1"`
MaxReplicas int `json:"maxReplicas,omitempty" validate:"omitempty,min=1"`
// ReplicaFill switches the deployment to fill mode: exactly one replica on
// EVERY alive, non-broken node matching Tags (every node when Tags is
// empty — DaemonSet-style). The replica count follows the eligible node
// set as nodes join/leave. Exclusive with the other two modes.
ReplicaFill bool `json:"replicaFill,omitempty"`
// ReplicaFillMode refines fill mode (only valid with ReplicaFill). The tag
// set still defines the placement universe; the sub-mode sets how much of
// it is occupied:
// - "full" (default, empty string): one replica on every eligible node,
// always.
// - "bare": load-based between 1 and the whole eligible set — the
// autoscale stepper (busyness thresholds + cooldown) with min=1 and
// max=eligible node count. Idle collapses to one replica.
// - "empty": bare, plus every container carries the cosmos-lazy label so
// the idle floor replica is stopped by the lazy layer and woken by the
// proxy on the next request — the tag scales from zero.
ReplicaFillMode string `json:"replicaFillMode,omitempty" validate:"omitempty,oneof=full bare empty"`
// 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 is the service spec the nodes apply. Exclusive with Function:
// a deployment declares one or the other (ValidateDeploymentSpec).
Compose docker.DockerServiceCreateRequest `json:"compose"`
// Function makes this a function deployment: the compose is DERIVED from
// it (one service per handler, see functions.go) when the scheduler
// dispatches. Its Source.Token is redacted by the API and preserved across
// user updates.
Function *DeploymentFunction `json:"function,omitempty"`
// PreserveVolumesOnRemove keeps the deployment's named volumes on disk when a
// replica is removed — a fill-mode scale-down (node untagged) or a full delete.
// Stamped as the cosmos-deployment-keep-volumes label on the containers so the
// node-side teardown honors it even for orphan removal, which runs after the
// KV record is already gone. Used by system-owned data deployments (managed
// SeaweedFS volume servers) where a stray untag must never destroy data.
PreserveVolumesOnRemove bool `json:"preserveVolumesOnRemove,omitempty"`
// Owner marks a deployment as system-owned (e.g. "seaweedfs:<instance>").
// Owned deployments are created and mutated exclusively by the owning Go
// feature: the HTTP API refuses user create/update/delete on them so a UI
// action can't desync the owner's record from the deployed spec. Empty for
// every user-created deployment.
Owner string `json:"owner,omitempty"`
// Version is a monotonic integer bumped on every create/update. It is
// server-assigned (the client never sets it) and is stamped onto every
// container as the cosmos-deployment-version label so the scheduler can tell
// a node running a stale spec from one running the current spec. A bump
// triggers a rolling re-apply across the nodes already running the deployment;
// see runReconcileCycle. Pre-version KV records and pre-version containers both
// read as 0, so upgrading an existing install causes no spurious re-apply.
Version int `json:"version"`
}
type DeploymentFunction ¶ added in v0.24.0
type DeploymentFunction struct {
Runtime string `json:"runtime" validate:"required"`
// Image overrides the runtime's default image (private mirror, patched
// runtime); it must honour the same contract.
Image string `json:"image,omitempty"`
Source FunctionSource `json:"source"`
Handlers []FunctionHandler `json:"handlers" validate:"required,min=1,dive"`
Env map[string]string `json:"env,omitempty"`
Limits FunctionLimits `json:"limits"`
Rev int `json:"rev"`
Releases []FunctionRelease `json:"releases,omitempty"`
}
DeploymentFunction is the `function` attribute of a Deployment, exclusive with `compose`.
type DeploymentHealth ¶ added in v0.22.19
type DeploymentHealth struct {
// Desired is mode-dependent: the fixed count, the alive tag-matching node count in full-fill,
// or the current actual clamped to [min,max] in autoscale.
Desired int `json:"desired"`
Actual int `json:"actual"`
// echo of the deployment's replica-mode config so the UI needn't re-fetch the spec
MinReplicas int `json:"minReplicas,omitempty"`
MaxReplicas int `json:"maxReplicas,omitempty"`
ReplicaFill bool `json:"replicaFill,omitempty"`
// echoes the fill sub-mode ("" = full)
ReplicaFillMode string `json:"replicaFillMode,omitempty"`
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 Function ¶ added in v0.24.0
type Function struct {
Name string `json:"name" validate:"required,min=3,max=40,alphanum"`
// Deployment is the deployment carrying the handler; on create, empty
// means "fn<name>".
Deployment string `json:"deployment,omitempty"`
Runtime string `json:"runtime" validate:"required"`
Image string `json:"image,omitempty"`
Source FunctionSource `json:"source"`
Handler string `json:"handler" validate:"required,min=1,max=128"`
Entry string `json:"entry,omitempty"`
Env map[string]string `json:"env,omitempty"`
Tags []string `json:"tags,omitempty" validate:"omitempty,dive,min=1,max=64"`
Limits FunctionLimits `json:"limits"`
Route utils.ProxyRouteConfig `json:"route"`
Triggers FunctionTriggers `json:"triggers"`
Rev int `json:"rev"`
Releases []FunctionRelease `json:"releases,omitempty"`
// Status is "created" (no version pinned yet) or "deployed".
Status string `json:"status"`
// Siblings are the other handlers of the same deployment.
Siblings []string `json:"siblings,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Function is the API view of ONE handler of a function deployment: the deployment-level settings flattened next to the handler's own. It is what the Functions page reads and what create/update accept.
type FunctionCronTrigger ¶ added in v0.24.0
type FunctionCronTrigger struct {
Name string `json:"name" validate:"required,min=1,max=64"`
Enabled bool `json:"enabled"`
// Crontab is the 6-field form used everywhere in Cosmos (seconds first).
Crontab string `json:"crontab" validate:"required"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Body string `json:"body,omitempty"`
}
FunctionCronTrigger invokes the function on a schedule, from the leader, through the function's own route.
type FunctionDeployRequest ¶ added in v0.24.0
type FunctionDeployRequest struct {
// Version to pin; empty or "latest" = the registry's latest.
Version string `json:"version,omitempty"`
}
FunctionDeployRequest is the body of the deploy endpoint.
type FunctionHandler ¶ added in v0.24.0
type FunctionHandler struct {
Name string `json:"name" validate:"required,min=3,max=40,alphanum"`
Handler string `json:"handler" validate:"required,min=1,max=128"`
// Entry is FUNCTION_SOURCE: node = file inside the package, python =
// module path. Empty = the package's main / import name.
Entry string `json:"entry,omitempty"`
// Env is merged over the deployment-level env for this handler only.
Env map[string]string `json:"env,omitempty"`
// Route is the user-facing part of the function's URL (host, path, auth,
// shield, restrictions...). Name, mode, target, tunnel and visibility are
// forced when the compose is derived.
Route utils.ProxyRouteConfig `json:"route"`
Triggers FunctionTriggers `json:"triggers"`
}
FunctionHandler is one function exposed by a function deployment: a container running the package with FUNCTION_TARGET=Handler, fronted by Route, invoked by Triggers. Name is the function name — unique cluster-wide because it names the container and the route.
type FunctionInvokeRequest ¶ added in v0.24.0
type FunctionInvokeRequest struct {
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Body string `json:"body,omitempty"`
}
FunctionInvokeRequest is the body of the invoke endpoint. Method defaults to POST.
type FunctionLimits ¶ added in v0.24.0
type FunctionLimits struct {
MemoryMB int `json:"memoryMB,omitempty" validate:"omitempty,min=32,max=1048576"`
CPU float64 `json:"cpu,omitempty" validate:"omitempty,min=0"`
TimeoutSec int `json:"timeoutSec,omitempty" validate:"omitempty,min=1,max=86400"`
// IdleTTL is how long a replica stays awake without connections before the
// lazy layer stops it (Go duration string).
IdleTTL string `json:"idleTTL,omitempty"`
}
FunctionLimits are the only bounds a function has; they map to docker limits and the route timeout. No software limits.
type FunctionRelease ¶ added in v0.24.0
type FunctionRelease struct {
Rev int `json:"rev"`
Version string `json:"version"`
DeployedAt time.Time `json:"deployedAt"`
DeployedBy string `json:"deployedBy,omitempty"`
}
FunctionRelease is one deploy in the record's history.
type FunctionSource ¶ added in v0.24.0
type FunctionSource struct {
// Registry is the registry instance name; its type must match the runtime
// (npm for node*, pypi for python*).
Registry string `json:"registry" validate:"required,min=3,max=27"`
// Package is the package name in that registry (npm name, possibly scoped;
// PyPI project name, normalized on save).
Package string `json:"package" validate:"required,min=1,max=214"`
// Version is the PINNED version the deployment runs; set by deploy, never
// a tag. Empty until the first deploy.
Version string `json:"version,omitempty"`
// Token is the read-only registry token minted for this function on the
// registry (named "function-<name>"). Persisted, redacted in API output.
Token string `json:"token,omitempty"`
}
FunctionSource says where the code comes from: a package in a cluster registry, downloaded from that registry's own host (internal ones included).
type FunctionTriggers ¶ added in v0.24.0
type FunctionTriggers struct {
Cron []FunctionCronTrigger `json:"cron,omitempty" validate:"omitempty,dive"`
}
FunctionTriggers groups the trigger kinds (cron only in v1).
type ManagedDBBackup ¶ added in v0.24.0
type ManagedDBBackup struct {
// Enabled gates scheduled jobs only; manual runs and snapshot listing still work.
Enabled bool `json:"enabled"`
// Repository is a restic repository (path or rclone:<remote>:<path>), resolved on the home node.
Repository string `json:"repository"`
// Password is generated once and never regenerated; redacted like the superuser password.
Password string `json:"password"`
// Crontab and CrontabForget are 6-field (seconds-first) schedules, validated at configure time.
Crontab string `json:"crontab"`
CrontabForget string `json:"crontabForget"`
// RetentionPolicy is passed verbatim to `restic forget` as arguments.
RetentionPolicy string `json:"retentionPolicy"`
ConfiguredAt time.Time `json:"configuredAt"`
}
ManagedDBBackup is the backup configuration of one instance.
type ManagedDBBackupRequest ¶ added in v0.24.0
type ManagedDBBackupRequest struct {
Enabled bool `json:"enabled"`
Repository string `json:"repository" validate:"omitempty,max=512"`
Crontab string `json:"crontab" validate:"omitempty,max=128"`
CrontabForget string `json:"crontabForget" validate:"omitempty,max=128"`
RetentionPolicy string `json:"retentionPolicy" validate:"omitempty,max=512"`
}
ManagedDBBackupRequest is the configure-backup body.
type ManagedDBCreateRequest ¶ added in v0.24.0
type ManagedDBCreateRequest struct {
Name string `json:"name" validate:"required,min=3,max=48,alphanum"`
Engine string `json:"engine" validate:"omitempty,oneof=postgres"`
// Image overrides the pinned default; never inferred from a running container.
Image string `json:"image" validate:"omitempty,max=128"`
// Port overrides proxy listen-port allocation. Zero means "allocate one".
Port int `json:"port" validate:"omitempty,min=1024,max=65535"`
// Pointer: the default is true, so a plain bool cannot tell "client sent
// false" from "client omitted the field".
RestrictToConstellation *bool `json:"restrictToConstellation"`
}
ManagedDBCreateRequest is the create-instance body.
type ManagedDBLogicalRequest ¶ added in v0.24.0
type ManagedDBLogicalRequest struct {
Database string `json:"database" validate:"required,min=1,max=48"`
Role string `json:"role" validate:"omitempty,min=1,max=48"`
}
ManagedDBLogicalRequest is the create-logical-database / rotate body.
type ManagedDBRestoreRequest ¶ added in v0.24.0
type ManagedDBRestoreRequest struct {
// SourceName's backup configuration (repository AND password) is used to
// read the snapshot; the source instance itself is never touched.
SourceName string `json:"sourceName" validate:"required"`
// SnapshotID is a restic snapshot id, long or short; "latest" works.
SnapshotID string `json:"snapshotId" validate:"required"`
// NewName is the instance to create. It must not exist.
NewName string `json:"newName" validate:"required,min=3,max=48"`
// Databases restricts what is restored; empty means every logical database.
Databases []string `json:"databases"`
// Port and RestrictToConstellation default as in a plain create (allocate a
// port; restrict to the constellation).
Port int `json:"port" validate:"omitempty,min=1024,max=65535"`
RestrictToConstellation *bool `json:"restrictToConstellation"`
}
ManagedDBRestoreRequest is the restore-as-a-new-instance body.
type ManagedDBUpdateRequest ¶ added in v0.24.0
type ManagedDBUpdateRequest struct {
RestrictToConstellation *bool `json:"restrictToConstellation"`
// Route replaces the user-facing half of the proxy route; its RestrictToConstellation wins when both are sent.
Route *utils.ProxyRouteConfig `json:"route,omitempty"`
}
ManagedDBUpdateRequest is the edit-instance body. Only settings that can be changed without recreating the container appear here.
type ManagedDatabase ¶ added in v0.24.0
type ManagedDatabase struct {
Name string `json:"name" validate:"required,min=3,max=48,alphanum"`
Engine string `json:"engine" validate:"omitempty,oneof=postgres"`
// Image is the exact image tag the container was created from, captured at
// creation. Version is its human-readable major ("17").
Image string `json:"image"`
Version string `json:"version,omitempty"`
// HomeNode is the constellation device name of the node running the
// container, stored verbatim — the same string used as the
// constellation-nodes KV key and in NATS subjects (device names are
// validated at creation against `^[a-z0-9_-]{3,32}$`, so no transformation
// is needed), which is what lets it be matched against a heartbeat and
// formatted into SubjectManagedDBOp without further translation.
HomeNode string `json:"homeNode"`
// HomeNodeName is the raw, human-visible device name, for display only.
HomeNodeName string `json:"homeNodeName,omitempty"`
// HomeIP is the home node's Nebula IP. Applications connect here directly;
// it is what ${db.<name>.host} expands to.
HomeIP string `json:"homeIP"`
// Port is the port Cosmos's own socket proxy LISTENS on for this instance —
// not a docker port publish. The container publishes nothing; it is reachable
// only on its cosmos network, and every client connection arrives through the
// proxy route derived from this record (see buildManagedDBProxyRoute).
Port int `json:"port"`
// RestrictToConstellation is mirrored onto the proxy route, where
// TCPSmartShieldMiddleware closes any connection from an IP outside the
// constellation. Defaults to true on create: a database published to the
// whole internet by omission is not a defensible default.
RestrictToConstellation bool `json:"restrictToConstellation"`
// Route is the user-facing half of the proxy route; buildManagedDBProxyRoute forces the rest.
Route utils.ProxyRouteConfig `json:"route" validate:"-"`
// SuperUser / SuperPassword are the instance's bootstrap superuser. Stored
// in the clear, matching the posture the rest of the cluster state already
// takes for secrets it must be able to hand back (device API keys in the
// store, TLS private keys in the config). Redacted out of the list API;
// readable only through the connection-info endpoint.
SuperUser string `json:"superUser"`
SuperPassword string `json:"superPassword"`
CreatedAt time.Time `json:"createdAt"`
// Databases holds the per-application logical databases carved out of this
// instance, keyed by logical database name.
Databases map[string]ManagedLogicalDB `json:"databases,omitempty"`
// Backup is the instance's restic backup configuration, nil until an
// operator configures one. Interpreted entirely on the HOME node: it is the
// node that runs the dumps and owns the cron jobs.
Backup *ManagedDBBackup `json:"backup,omitempty"`
}
ManagedDatabase is the persistent record of one managed database instance. It is written once by the node that creates the instance and is thereafter the authority on the instance's existence, credentials and home node. Heartbeats never write it — they only flip the derived live/stale status reported by the list API, so an instance whose home node is down still appears (marked down) instead of vanishing.
func ListManagedDatabases ¶ added in v0.24.0
func ListManagedDatabases(lock *sync.RWMutex, js nats.JetStreamContext) ([]ManagedDatabase, error)
ListManagedDatabases returns every stored record, sorted by name.
type ManagedLogicalDB ¶ added in v0.24.0
type ManagedLogicalDB struct {
Name string `json:"name"`
Role string `json:"role"`
Password string `json:"password"`
CreatedAt time.Time `json:"createdAt"`
}
ManagedLogicalDB is one application's database-and-role pair inside an instance.
type NodeIdentity ¶ added in v0.22.11
type NodeIdentity struct {
// human-visible constellation device name
DeviceName string
// wire identity (constellation-nodes KV key and per-node NATS subjects); identical to DeviceName
SanitizedName string
// Nebula IP, e.g. "100.64.0.3"
IP string
// node mode: 0 = free, 1 = pro client, 2 = lighthouse/relay; exposed as ${node_mode}
CosmosNode int
}
NodeIdentity is exposed to template expansion as ${node_*} variables.
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 ProState ¶ added in v0.24.0
type ProState struct {
Version int `json:"version"`
ExportedAt time.Time `json:"exportedAt"`
Node string `json:"node"`
Buckets map[string]map[string]json.RawMessage `json:"buckets"`
}
ProState is the on-disk and over-the-wire format: raw KV values per bucket.
type RegistryCreateRequest ¶ added in v0.24.0
type RegistryCreateRequest struct {
Name string `json:"name"`
// Type is docker, npm, static, generic or pypi. Required and immutable afterwards.
Type string `json:"type"`
QuotaBytes int64 `json:"quotaBytes,omitempty"`
Storage RegistryStorage `json:"storage"`
Host string `json:"host,omitempty"`
Internal bool `json:"internal,omitempty"`
AllowAnonymousPull bool `json:"allowAnonymousPull,omitempty"`
Tags []string `json:"tags,omitempty"`
// Route's Host / RestrictToConstellation win over the scalars above when set.
Route *utils.ProxyRouteConfig `json:"route,omitempty"`
}
RegistryCreateRequest is the POST body: storage plus endpoint. Static registries take no host (their sites do).
type RegistryInstance ¶ added in v0.24.0
type RegistryInstance struct {
// Name is alphanumeric and lowercased, like SeaweedFSInstance.Name, so
// every derived identifier (bucket, KV key, route name) is valid without transformation.
Name string `json:"name" validate:"required,min=3,max=27,alphanum"`
// Type is the protocol this registry's contents speak. Immutable.
Type string `json:"type" validate:"required,oneof=docker npm static generic pypi"`
Storage RegistryStorage `json:"storage"`
// QuotaBytes caps the registry's stored size; 0 is unlimited.
QuotaBytes int64 `json:"quotaBytes"`
// Host is the registry's own hostname; required for every type but static, whose sites publish on their own routes.
Host string `json:"host,omitempty"`
// Internal restricts the endpoint to the constellation: the materialized
// route carries RestrictToConstellation, and the direct mux handler
// enforces the same check itself, because a request can reach the handler
// without ever passing through the route.
Internal bool `json:"internal"`
AllowAnonymousPull bool `json:"allowAnonymousPull"`
// Tags select the serving nodes with nodeMatchesTags AND-semantics. Unlike
// SeaweedFS, EMPTY is meaningful and is the default: no tag filter, so
// every node serves the endpoint. A default tag here would silently make a
// fresh registry unreachable on an untagged cluster.
Tags []string `json:"tags"`
Tokens []RegistryToken `json:"tokens,omitempty"`
// Route is the user-facing half of the serving route; identity fields are forced at render (BuildRegistryRoute).
Route utils.ProxyRouteConfig `json:"route" validate:"-"`
// IndexDB is the managed database instance holding this registry's package
// index, IndexDatabase the logical database on it. The SeaweedFS filer's
// instance for a managed-storage registry, a dedicated instance
// (RegistryIndexDBName) otherwise. Set at creation, never changed.
IndexDB string `json:"indexDB,omitempty"`
IndexDatabase string `json:"indexDatabase,omitempty"`
// ManagedByKind / ManagedByName mark a registry a feature created for
// itself (kind "ci", name "artifacts": the CI artifact store). Such a
// registry cannot be deleted by hand.
ManagedByKind string `json:"managedByKind,omitempty"`
ManagedByName string `json:"managedByName,omitempty"`
// Status: provisioning -> ready; deleting during teardown.
Status string `json:"status"`
CreatedAt time.Time `json:"createdAt"`
}
RegistryInstance is one registry's persistent record: typed storage plus the endpoint publishing it.
type RegistryNodeInfo ¶ added in v0.24.0
RegistryNodeInfo is what the serving paths need to know about this node. It is separate from NodeIdentity because that one is the template-expansion identity and deliberately carries no secret.
type RegistrySettingsRequest ¶ added in v0.24.0
type RegistrySettingsRequest struct {
QuotaBytes *int64 `json:"quotaBytes,omitempty"`
Host *string `json:"host,omitempty"`
Internal *bool `json:"internal,omitempty"`
AllowAnonymousPull *bool `json:"allowAnonymousPull,omitempty"`
Tags *[]string `json:"tags,omitempty"`
// Route's Host / RestrictToConstellation win over the scalars above when both are sent.
Route *utils.ProxyRouteConfig `json:"route,omitempty"`
}
RegistrySettingsRequest is the PUT body; pointers keep absent fields at their stored value. The type is deliberately absent: it is immutable.
type RegistryStaticActivateRequest ¶ added in v0.24.0
type RegistryStaticActivateRequest struct {
Version string `json:"version"`
}
RegistryStaticActivateRequest is the POST body of the activate endpoint.
type RegistryStaticSiteSettings ¶ added in v0.24.0
type RegistryStaticSiteSettings struct {
Host *string `json:"host,omitempty"`
Internal *bool `json:"internal,omitempty"`
SPA *bool `json:"spa,omitempty"`
Tags *[]string `json:"tags,omitempty"`
// Route replaces the user-facing half of the serving route; its Host / RestrictToConstellation win over the scalars above.
Route *utils.ProxyRouteConfig `json:"route,omitempty"`
}
RegistryStaticSiteSettings is the shape of a site's route configuration. Pointers so an absent field keeps its stored value: a CI upload that only sends a zip must not clear the hostname the site is published on.
type RegistryStats ¶ added in v0.24.0
type RegistryStats struct {
SizeBytes int64 `json:"sizeBytes"`
PackageCount int64 `json:"packageCount"`
VersionCount int64 `json:"versionCount"`
PullCount int64 `json:"pullCount"`
PushCount int64 `json:"pushCount"`
UpdatedAt time.Time `json:"updatedAt"`
}
RegistryStats is the per-registry rollup, maintained by CAS increments from every serving node and reconciled by the sweep.
type RegistryStatus ¶ added in v0.24.0
type RegistryStatus struct {
RegistryInstance
// ServingNodes are the devices whose heartbeat advertises this registry.
ServingNodes []string `json:"servingNodes"`
Stats RegistryStats `json:"stats"`
}
RegistryStatus: a record plus derived serving nodes and stored-size rollup — nothing here is persisted.
func ListRegistriesWithStatus ¶ added in v0.24.0
func ListRegistriesWithStatus(lock *sync.RWMutex, js nats.JetStreamContext) ([]RegistryStatus, error)
ListRegistriesWithStatus returns records, their serving nodes and their stats; a failed stats read leaves the zero rollup.
type RegistryStorage ¶ added in v0.24.0
type RegistryStorage struct {
Backend string `json:"backend" validate:"required,oneof=seaweedfs s3 local"`
// SeaweedFS is the managed instance name when Backend is "seaweedfs".
SeaweedFS string `json:"seaweedfs,omitempty"`
// Bucket is the object-store bucket for both S3-family backends. Generated
// as RegistryBucketName(name) for managed SeaweedFS.
Bucket string `json:"bucket,omitempty"`
// External S3 only.
Endpoint string `json:"endpoint,omitempty"`
AccessKey string `json:"accessKey,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
Region string `json:"region,omitempty"`
// Path is the filesystem root when Backend is "local".
Path string `json:"path,omitempty"`
}
RegistryStorage describes where a registry's blobs live. Exactly one backend family's fields are meaningful; the others stay zero.
type RegistryToken ¶ added in v0.24.0
type RegistryToken struct {
Name string `json:"name" validate:"required,min=1,max=64"`
TokenHash string `json:"tokenHash"`
TokenSuffix string `json:"tokenSuffix"`
// Scopes are "pull"/"push", optionally type-qualified ("docker:push").
Scopes []string `json:"scopes,omitempty"`
// ExpiresAt zero means never.
ExpiresAt time.Time `json:"expiresAt,omitempty"`
// LastUsedAt is written lazily by the protocol paths (throttled) — a CAS
// write per pull would make the record the registry's bottleneck.
LastUsedAt time.Time `json:"lastUsedAt,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
RegistryToken is a deploy credential stored ON the registry record, so it replicates with it and any serving node can verify a push without a second lookup. Only the hash is kept — the raw token is shown once, at mint.
type RegistryTokenCreateRequest ¶ added in v0.24.0
type RegistryTokenCreateRequest struct {
Name string `json:"name"`
Scopes []string `json:"scopes,omitempty"`
ExpiryDays int `json:"expiryDays,omitempty"`
}
RegistryTokenCreateRequest mints a deploy token; the raw value only ever appears in the response.
type SchedulerOptions ¶ added in v0.23.0
type SchedulerOptions struct {
FollowerOnly bool
}
type SeaweedFSCreateRequest ¶ added in v0.24.0
type SeaweedFSCreateRequest struct {
Name string `json:"name"`
Tags []string `json:"tags,omitempty"`
Image string `json:"image,omitempty"`
FilerReplicas int `json:"filerReplicas,omitempty"`
IndexMode string `json:"indexMode,omitempty"`
DefaultReplication string `json:"defaultReplication,omitempty"`
VolumeSizeLimitMB int `json:"volumeSizeLimitMB,omitempty"`
MinFreeSpace string `json:"minFreeSpace,omitempty"`
MaxStorageGBPerNode int `json:"maxStorageGBPerNode,omitempty"`
RestrictToConstellation *bool `json:"restrictToConstellation,omitempty"`
}
SeaweedFSCreateRequest is the POST body; RestrictToConstellation is a *bool so "absent" defaults to true.
type SeaweedFSDrainRequest ¶ added in v0.24.0
type SeaweedFSDrainRequest struct {
// Device is the constellation device name of the volume server to evacuate.
Device string `json:"device"`
}
SeaweedFSDrainRequest is the body of the drain endpoint.
type SeaweedFSInstance ¶ added in v0.24.0
type SeaweedFSInstance struct {
// Name is alphanumeric (like Deployment and ManagedDatabase names) so every
// derived identifier — the filer database "swfs<name>", docker names, NATS
// tokens, restic tags — is valid without transformation. Max 27 keeps every
// derived name inside its consumer's own length limit.
Name string `json:"name" validate:"required,min=3,max=27,alphanum"`
// Image is the exact SeaweedFS image every tier runs, captured at creation.
// Changed only by the rolling-upgrade flow.
Image string `json:"image"`
// Tags select the volume-server (and filer placement) nodes. The volume
// deployment fills them: one volume server per tagged, alive node.
Tags []string `json:"tags" validate:"required,min=1,dive,min=1,max=64"`
// Masters is the pinned, persisted master set — see SwfsMaster.
Masters []SwfsMaster `json:"masters"`
// The four allocated listen ports. gRPC twins are port+SeaweedFSGRPCOffset.
// MasterPort/VolumePort/FilerPort are published on each node's Nebula IP
// (overlay-only); S3Port is never published by a container — it is the
// socket-proxy listen port of the LB'd S3 route.
MasterPort int `json:"masterPort"`
VolumePort int `json:"volumePort"`
FilerPort int `json:"filerPort"`
S3Port int `json:"s3Port"`
// FilerReplicas is the fixed size of the filer deployment (capped at the
// tagged-node count at provision time; the scheduler tolerates a shortfall).
FilerReplicas int `json:"filerReplicas" validate:"omitempty,min=1,max=16"`
// DefaultReplication is the master's -defaultReplication (e.g. "001": one
// extra copy on a different server). Per-node rack/DC flags are deliberately
// never set — with default topology, "001" already lands copies on
// different nodes.
DefaultReplication string `json:"defaultReplication" validate:"omitempty,len=3"`
// IndexMode is the volume servers' -index: leveldb (default) or memory.
// Memory costs ~20-24 bytes per stored file per volume server.
IndexMode string `json:"indexMode" validate:"omitempty,oneof=leveldb memory"`
// VolumeSizeLimitMB caps individual volume size (master flag).
VolumeSizeLimitMB int `json:"volumeSizeLimitMB" validate:"omitempty,min=64,max=1048576"`
// MinFreeSpace is the volume servers' -minFreeSpace (percent, as a string —
// SeaweedFS also accepts absolute sizes, so the string passes through).
MinFreeSpace string `json:"minFreeSpace"`
// MaxStorageGBPerNode bounds how much disk ONE volume server may consume,
// 0 meaning unlimited (the SeaweedFS default of "fill the disk, minus
// minFreeSpace"). Enforced through the volume server's -max, i.e. in whole
// volumes — see seaweedFSMaxVolumeCount for why that is the mechanism and
// how exact the bound is.
MaxStorageGBPerNode int `json:"maxStorageGBPerNode" validate:"omitempty,min=0,max=1048576"`
// RestrictToConstellation mirrors onto the S3 route. Default true.
RestrictToConstellation bool `json:"restrictToConstellation"`
// S3Route is the user-facing half of the S3 route; BuildSeaweedFSS3Route forces the rest.
S3Route utils.ProxyRouteConfig `json:"s3Route" validate:"-"`
// S3AccessKey / S3SecretKey are the admin credentials minted at creation
// and applied to the filer via `weed shell s3.configure`. Redacted from the
// list API like the managed-DB superuser password.
S3AccessKey string `json:"s3AccessKey"`
S3SecretKey string `json:"s3SecretKey"`
// S3Configured flips true once the reconciler has successfully applied the
// credentials. Until then the gateway accepts anonymous requests — which is
// why RestrictToConstellation defaults on.
S3Configured bool `json:"s3Configured"`
// FilerDB is the name of the auto-provisioned managed database holding the
// filer store ("swfs"+Name, logical database "filer").
FilerDB string `json:"filerDB"`
Jobs SwfsJobsConfig `json:"jobs"`
// Usage is the last space snapshot the monitor job wrote — see SwfsUsage.
// nil until the first monitor pass of an instance completes.
Usage *SwfsUsage `json:"usage,omitempty"`
// MetaBackup configures the store-independent second backup path (weed
// shell fs.meta.save → restic). Same shape and semantics as a managed
// database's backup block; nil until configured. The PRIMARY metadata
// backup is the filer database's own managed-DB backup.
MetaBackup *ManagedDBBackup `json:"metaBackup,omitempty"`
// Status: provisioning → ready; deleting during teardown; failed:<reason>
// when creation was rolled back but the record could not be removed.
Status string `json:"status"`
// PendingUpgradeImage is non-empty while a rolling upgrade one-time job is
// in flight.
PendingUpgradeImage string `json:"pendingUpgradeImage,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
SeaweedFSInstance is the persistent record of one managed SeaweedFS cluster. Written by the node that creates it; thereafter the single authority on the instance's shape and credentials. Heartbeats only flip derived liveness.
type SeaweedFSReplaceMasterRequest ¶ added in v0.24.0
type SeaweedFSReplaceMasterRequest struct {
OldDevice string `json:"oldDevice"`
// NewDevice is optional: the next live manager outside the master set is picked when absent.
NewDevice string `json:"newDevice,omitempty"`
}
SeaweedFSReplaceMasterRequest is the body of the replace-master endpoint.
type SeaweedFSRestrictRequest ¶ added in v0.24.0
type SeaweedFSRestrictRequest struct {
// *bool, deliberately: with a plain bool an EMPTY body would decode as
// false and silently publish the object store — the exact inversion of the
// restrict-by-default posture. Absent means invalid, never "unrestrict".
RestrictToConstellation *bool `json:"restrictToConstellation"`
}
SeaweedFSRestrictRequest is the body of the restrict endpoint.
type SeaweedFSRouteRequest ¶ added in v0.24.0
type SeaweedFSRouteRequest struct {
// Route is required: the user-facing settings of the S3 route.
Route *utils.ProxyRouteConfig `json:"route"`
}
SeaweedFSRouteRequest is the body of the S3 route endpoint.
type SeaweedFSStatus ¶ added in v0.24.0
type SeaweedFSStatus struct {
SeaweedFSInstance
// MastersLive lists pinned master devices whose heartbeat reports the master
// container running; MastersDown is the complement.
MastersLive []string `json:"mastersLive"`
MastersDown []string `json:"mastersDown"`
// QuorumOK is true while a majority of the pinned masters are live.
QuorumOK bool `json:"quorumOK"`
// VolumeNodes / FilerNodes list nodes whose heartbeat reports the
// respective deployment running; the IPs mirror them in the same order.
VolumeNodes []string `json:"volumeNodes"`
FilerNodes []string `json:"filerNodes"`
// FilerIPs[0] is the deterministic host ${s3.NAME.host} expands to.
FilerIPs []string `json:"filerIPs"`
VolumeIPs []string `json:"volumeIPs"`
// TagMatchedNodes are the LIVE nodes whose tags satisfy the instance's Tags.
TagMatchedNodes []string `json:"tagMatchedNodes"`
// VolumeDesired / FilerDesired are the target tier sizes given the current
// tag membership. Same "desired vs actual" idiom as DeploymentHealth.
VolumeDesired int `json:"volumeDesired"`
FilerDesired int `json:"filerDesired"`
// Health is the derived truth about the instance right now — see the
// SwfsHealth* constants. HealthReason is a script-readable summary; empty
// when Health is ready.
Health string `json:"health"`
HealthReason string `json:"healthReason,omitempty"`
}
SeaweedFSStatus decorates a record with heartbeat-derived liveness.
func ListSeaweedFSWithStatus ¶ added in v0.24.0
func ListSeaweedFSWithStatus(lock *sync.RWMutex, js nats.JetStreamContext) ([]SeaweedFSStatus, error)
ListSeaweedFSWithStatus returns records + heartbeat-derived status.
type SeaweedFSStorageRequest ¶ added in v0.24.0
type SeaweedFSStorageRequest struct {
// MaxStorageGBPerNode is required; 0 means unlimited.
MaxStorageGBPerNode *int `json:"maxStorageGBPerNode"`
}
SeaweedFSStorageRequest is the body of the storage endpoint.
type SeaweedFSUpgradeRequest ¶ added in v0.24.0
type SeaweedFSUpgradeRequest struct {
Image string `json:"image"`
}
SeaweedFSUpgradeRequest is the body of the upgrade endpoint.
type StateImportResult ¶ added in v0.24.0
type StateImportResult struct {
Created map[string]int `json:"created"`
Present map[string]int `json:"present"`
}
StateImportResult counts, per bucket, records written and records that already existed (left untouched).
type StateSummary ¶ added in v0.24.0
type StateSummary struct {
Counts map[string]int `json:"counts"`
MirroredAt time.Time `json:"mirroredAt"`
MirrorError string `json:"mirrorError,omitempty"`
ReseedPending bool `json:"reseedPending"`
Importing bool `json:"importing"`
}
StateSummary is the mirror's shape for the UI.
type SwfsJobsConfig ¶ added in v0.24.0
type SwfsJobsConfig struct {
// Without vacuum, deleted data never frees disk and full volumes flip read-only.
VacuumEnabled bool `json:"vacuumEnabled"`
VacuumCrontab string `json:"vacuumCrontab"`
GarbageThreshold float64 `json:"garbageThreshold"`
// EC is OFF by default: encoding transiently needs a lot of disk headroom,
// and ECMinFreeDiskPercent is a hard guard the job checks first.
ECEnabled bool `json:"ecEnabled"`
ECCrontab string `json:"ecCrontab"`
ECFullPercent float64 `json:"ecFullPercent"`
ECQuietForSec int `json:"ecQuietForSec"`
ECMinFreeDiskPercent float64 `json:"ecMinFreeDiskPercent"`
// Repack registers iff ECEnabled: EC shards never vacuum in place, so repack
// is the only way deleted space inside an EC volume is reclaimed.
RepackCrontab string `json:"repackCrontab"`
RepackDeleteRatio float64 `json:"repackDeleteRatio"`
MonitorCrontab string `json:"monitorCrontab"`
DiskAlertPercent float64 `json:"diskAlertPercent"`
// Scrub runs volume.check.disk to verify replica consistency (bitrot).
ScrubEnabled bool `json:"scrubEnabled"`
ScrubCrontab string `json:"scrubCrontab"`
}
SwfsJobsConfig is the per-instance maintenance-job configuration. Crontabs are 6-field seconds-first (the gocron parser).
type SwfsMaster ¶ added in v0.24.0
SwfsMaster is one pinned master: the device that runs it and its Nebula IP. The IP is persisted (not re-resolved) because it is baked into every -peers / -mserver flag — changing it means re-provisioning the tier.
type SwfsNodeUsage ¶ added in v0.24.0
type SwfsNodeUsage struct {
Device string `json:"device"`
// SeaweedFSBytes is the space this instance occupies on the node. EC shards
// are not counted, so on an EC'd cluster DiskUsedBytes (whole filesystem) is
// the figure that still tells the truth.
SeaweedFSBytes uint64 `json:"seaweedFSBytes"`
// VolumeCount is how many volume slots the node holds — the unit
// MaxStorageGBPerNode is enforced in.
VolumeCount int `json:"volumeCount"`
// Disk*Bytes describe the filesystem the data directory lives on,
// everything on it included, not just SeaweedFS.
DiskAllBytes uint64 `json:"diskAllBytes"`
DiskUsedBytes uint64 `json:"diskUsedBytes"`
DiskFreeBytes uint64 `json:"diskFreeBytes"`
}
SwfsNodeUsage is what one volume server reports about the space it uses and the disk it sits on. Bytes throughout.
type SwfsUsage ¶ added in v0.24.0
type SwfsUsage struct {
Nodes []SwfsNodeUsage `json:"nodes"`
// Totals are stored so every reader agrees on the arithmetic.
TotalSeaweedFSBytes uint64 `json:"totalSeaweedFSBytes"`
TotalDiskFreeBytes uint64 `json:"totalDiskFreeBytes"`
CollectedAt time.Time `json:"collectedAt"`
}
SwfsUsage is the per-instance space snapshot written by the monitor job. Persisted on the record because the monitor runs on the job-locus node while the API is served from anywhere.
type UpdateGroupRequest ¶ added in v0.22.3
type UpdateGroupRequest struct {
Name *string `json:"name,omitempty"`
Permissions []utils.Permission `json:"permissions,omitempty"`
}
Source Files
¶
- api_ci.go
- api_deployments.go
- api_functions.go
- api_manageddb.go
- api_manageddb_backup.go
- api_registry.go
- api_registry_generic.go
- api_registry_static.go
- api_seaweedfs.go
- api_seaweedfs_backup.go
- api_state.go
- ci.go
- constellation.go
- feature_metrics.go
- functions.go
- groups.go
- index.go
- manageddb.go
- manageddb_backup.go
- manageddb_docker.go
- manageddb_ops.go
- manageddb_restore.go
- registry.go
- registry_gc.go
- registry_meta.go
- registry_serving.go
- scheduler.go
- scheduler_metrics.go
- scheduler_node.go
- scheduler_placement.go
- scheduler_tags.go
- scheduler_templates.go
- seaweedfs.go
- seaweedfs_docker.go
- seaweedfs_jobs.go
- seaweedfs_ops.go
- seaweedfs_reconciler.go
- state.go