Documentation
¶
Overview ¶
Package servicecontrol owns the local, owner-approved desired state and bounded execution contract for StackKits-managed services.
Index ¶
- Constants
- func ProjectPlanControls(raw []byte) (map[string][]Control, error)
- type Check
- type Control
- type Controller
- func (c *Controller) Logs(ctx context.Context, serviceKey string, tail int, cursor string) (LogsResult, error)
- func (c *Controller) ManagerPlanBinding(state platformdeploy.HostDeployment, applyResultHash string) (platformdeploy.HostManagerPlanBinding, error)
- func (c *Controller) Mutate(ctx context.Context, action, serviceKey string, ownerApproved bool) (Result, error)
- func (c *Controller) ReconcileAfterApply(ctx context.Context) error
- type DesiredService
- type DesiredServiceBinding
- type DesiredState
- type Error
- type LogEntry
- type LogsResult
- type ManagerTransitionResult
- func CancelNativeKomodoCoreTransfer(ctx context.Context, workspace, workload, resume string, approved bool) (ManagerTransitionResult, error)
- func InspectOwnedWorkloadManager(workspace, workload string) (ManagerTransitionResult, error)
- func TransitionAppliedWorkloadManager(ctx context.Context, workspace, workload, to, resume string, approved bool, ...) (ManagerTransitionResult, error)
- func TransitionNativeKomodoCore(ctx context.Context, workspace, workload, resume string, approved bool, ...) (ManagerTransitionResult, error)
- func TransitionOwnedWorkloadManager(ctx context.Context, workspace, workload, to, resume string, approved bool) (ManagerTransitionResult, error)
- type Result
Constants ¶
const ( StateAPIVersion = "stackkit.service-desired-state/v1" ResultAPIVersion = "stackkit.service-action-result/v1" LogsAPIVersion = "stackkit.service-logs/v1" ActionStart = "start" ActionStop = "stop" ActionRestart = "restart" ActionLogs = "logs" DesiredRunning = "running" DesiredStopped = "stopped" ReasonCriticalControlPlane = "critical_control_plane" ReasonPlanChanged = "desired_state_plan_changed" ReasonContractChanged = "desired_state_contract_changed" ReasonUnknownService = "unknown_service" ReasonOwnerApproval = "owner_approval_required" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Control ¶ added in v0.50.6
type Control = serviceDefinition
Control is the existing canonical service control, including its module provenance.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewOSController ¶
func NewOSController(workspace, planPath string, plan generationartifact.VerifiedPlan) (*Controller, error)
func (*Controller) Logs ¶
func (c *Controller) Logs(ctx context.Context, serviceKey string, tail int, cursor string) (LogsResult, error)
func (*Controller) ManagerPlanBinding ¶ added in v0.53.4
func (c *Controller) ManagerPlanBinding(state platformdeploy.HostDeployment, applyResultHash string) (platformdeploy.HostManagerPlanBinding, error)
ManagerPlanBinding narrows an independently verified current Apply to the controller's exact canonical service contract. It does not admit Apply.
func (*Controller) ReconcileAfterApply ¶
func (c *Controller) ReconcileAfterApply(ctx context.Context) error
ReconcileAfterApply reapplies durable stopped intent through the declared adapter. Changes to selected services invalidate their stopped intent fail-closed. A narrower Apply leaves signed intent for unselected services untouched. Apply already holds the lifecycle mutation lock; reconciliation must not call public Mutate or recursively acquire that same cross-process lock.
type DesiredService ¶
type DesiredService struct {
State string `json:"state"`
ChangedAt time.Time `json:"changedAt"`
Binding *DesiredServiceBinding `json:"binding,omitempty"`
}
type DesiredServiceBinding ¶ added in v0.53.1
type DesiredServiceBinding struct {
PlanHash string `json:"planHash"`
ServiceContractHash string `json:"serviceContractHash"`
}
DesiredServiceBinding retains a stopped service's original signed authority when an unrelated service is controlled under a later plan.
type DesiredState ¶
type DesiredState struct {
APIVersion string `json:"apiVersion"`
OwnerRef string `json:"ownerRef"`
PlanHash string `json:"planHash"`
ServiceContractHash string `json:"serviceContractHash"`
Revision uint64 `json:"revision"`
Services map[string]DesiredService `json:"services"`
UpdatedAt time.Time `json:"updatedAt"`
Signature localevidence.OwnerPolicyStateSignature `json:"signature"`
}
type LogsResult ¶
type ManagerTransitionResult ¶ added in v0.53.4
type ManagerTransitionResult struct {
APIVersion string `json:"apiVersion"`
OperationID string `json:"operationId"`
Project string `json:"project"`
From string `json:"from"`
To string `json:"to"`
Status string `json:"status"`
ExternalID string `json:"externalId"`
RecipeDigest string `json:"recipeDigest"`
RuntimeDigest string `json:"runtimeDigest"`
EvidenceRef string `json:"evidenceRef,omitempty"`
}
func CancelNativeKomodoCoreTransfer ¶ added in v0.53.9
func CancelNativeKomodoCoreTransfer(ctx context.Context, workspace, workload, resume string, approved bool) (ManagerTransitionResult, error)
CancelNativeKomodoCoreTransfer restores the signed source claim only while this protocol has never sent an attachment request to the target Core.
func InspectOwnedWorkloadManager ¶ added in v0.53.4
func InspectOwnedWorkloadManager(workspace, workload string) (ManagerTransitionResult, error)
InspectOwnedWorkloadManager reads the durable transfer outcome after an uncertain client response. It never repeats an API mutation.
func TransitionAppliedWorkloadManager ¶ added in v0.53.4
func TransitionAppliedWorkloadManager(ctx context.Context, workspace, workload, to, resume string, approved bool, bind func(platformdeploy.HostDeployment) (platformdeploy.HostManagerPlanBinding, error)) (ManagerTransitionResult, error)
TransitionAppliedWorkloadManager obtains fresh signed-Apply admission inside the same lifecycle lock that covers the attachment and custody mutation.
func TransitionNativeKomodoCore ¶ added in v0.53.9
func TransitionNativeKomodoCore(ctx context.Context, workspace, workload, resume string, approved bool, selectPlan func(platformdeploy.HostDeployment) (string, error)) (ManagerTransitionResult, error)
TransitionNativeKomodoCore transfers only an already custodied host recipe. Fresh generated-plan selection is verified inside the existing lifecycle lock; the subsequent normal Apply still owns all recipe and runtime effects.
func TransitionOwnedWorkloadManager ¶ added in v0.53.4
func TransitionOwnedWorkloadManager(ctx context.Context, workspace, workload, to, resume string, approved bool) (ManagerTransitionResult, error)
TransitionOwnedWorkloadManager uses the existing owner-bound node custody. It transfers API attachment, never application data or generated recipes. A retained application remains addressable even after an unrelated scoped plan became current; an unclaimed project is never implicitly adopted.
type Result ¶
type Result struct {
APIVersion string `json:"apiVersion"`
Action string `json:"action"`
ServiceKey string `json:"serviceKey"`
DesiredState string `json:"desiredState"`
ObservedState string `json:"observedState"`
Revision uint64 `json:"revision"`
Checks []Check `json:"checks"`
ReasonCode string `json:"reasonCode,omitempty"`
Retryable bool `json:"retryable"`
OperationRef string `json:"operationRef,omitempty"`
EvidenceRef string `json:"evidenceRef,omitempty"`
}