workloadremoval

package
v0.39.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package workloadremoval defines the provider-neutral, owner-approved removal contract for one exact workload from a previously applied Architecture v2 runtime request.

Index

Constants

View Source
const (
	// APIVersion is the current owner-signed removal request. v1 remains the
	// published absence-only wire; this v2 admits an explicit data disposition
	// and must not be parsed as compatible with v1 canonical bytes.
	APIVersion          = "stackkit.workload-removal/v2"
	ResultAPIVersion    = "stackkit.workload-removal-result/v2"
	EvidenceAPIVersion  = "stackkit.workload-removal-evidence/v2"
	StatusRemoved       = "removed"
	ObservedStateAbsent = "absent"
	// DataDispositionRetain keeps declared application data volumes after the
	// workload containers are absent. It is the native default.
	DataDispositionRetain = "retain"
	// DataDispositionDelete removes only named volumes owned by this exact
	// applied workload after its containers are absent.
	DataDispositionDelete = "delete"
)

Variables

This section is empty.

Functions

func AuthorizationBytes

func AuthorizationBytes(applied runtimeexecutor.ExecutionRequest, workloadRef, dataDisposition string, requestedAt, validUntil time.Time) ([]byte, error)

func AuthorizationBytesForPlacement

func AuthorizationBytesForPlacement(applied runtimeexecutor.ExecutionRequest, placement AppliedPlacement, dataDisposition string, requestedAt, validUntil time.Time) ([]byte, error)

AuthorizationBytesForPlacement binds Owner approval to the original shared Apply receipt while authorizing only one exact verified placement below it.

func SelectAppliedWorkload

func SelectAppliedWorkload(applied runtimeexecutor.ExecutionRequest, workloadRef string) (runtimeexecutor.ExecutionRequest, error)

SelectAppliedWorkload reduces a sealed Product Apply request to the exact workload child and its referenced immutable artifacts.

func SelectAppliedWorkloadPlacement

func SelectAppliedWorkloadPlacement(applied runtimeexecutor.ExecutionRequest, placement AppliedPlacement) (runtimeexecutor.ExecutionRequest, error)

SelectAppliedWorkloadPlacement closes a multi-node Apply target onto one exact placement from the verified Apply result. The placement carries the shared request digest and target identity so a caller cannot use the helper as an unbound host or channel selector.

Types

type AppliedPlacement

type AppliedPlacement struct {
	AppliedRequestDigest string `json:"appliedRequestDigest"`
	WorkloadRef          string `json:"workloadRef"`
	RequirementID        string `json:"requirementId"`
	InstanceRef          string `json:"instanceRef"`
	SiteRef              string `json:"siteRef"`
	NodeRef              string `json:"nodeRef"`
	ExecutionChannelRef  string `json:"executionChannelRef"`
}

AppliedPlacement is one exact workload placement recovered from a verified Product Apply result. It may narrow the sealed shared request but can never introduce a workload, requirement, instance, Site, or node outside it.

type AuthorizationPayload

type AuthorizationPayload struct {
	APIVersion           string `json:"apiVersion"`
	AppliedRequestDigest string `json:"appliedRequestDigest"`
	PlanHash             string `json:"planHash"`
	WorkloadRef          string `json:"workloadRef"`
	RequirementID        string `json:"requirementId"`
	InstanceRef          string `json:"instanceRef"`
	DataDisposition      string `json:"dataDisposition"`
	RequestedAt          string `json:"requestedAt"`
	ValidUntil           string `json:"validUntil"`
}

AuthorizationPayload is the exact canonical value signed by the Owner.

type Evidence

type Evidence struct {
	APIVersion     string            `json:"apiVersion"`
	Authority      EvidenceAuthority `json:"authority"`
	Result         Result            `json:"result"`
	EvidenceDigest string            `json:"evidenceDigest"`
}

Evidence is the transport-safe projection produced by the pinned StackKits process. Request remains the local Owner authority; this value preserves its exact successful outcome without reconstructing or exporting that authority.

func NewEvidence

func NewEvidence(request Request, result Result) (Evidence, error)

NewEvidence projects a fully validated local Request and Result into the bounded terminal proof that may cross the execution channel.

func ParseEvidence

func ParseEvidence(data []byte) (Evidence, error)

ParseEvidence accepts only canonical, complete terminal evidence.

func (Evidence) AuthorizationBytes

func (evidence Evidence) AuthorizationBytes() ([]byte, error)

AuthorizationBytes returns the original Owner-signed authorization payload. A consumer with a separately pinned Owner public key can authenticate it without receiving or reconstructing the complete local Request.

func (Evidence) Canonical

func (evidence Evidence) Canonical() ([]byte, error)

func (Evidence) Validate

func (evidence Evidence) Validate() error

Validate verifies canonical integrity and internal consistency. Authenticity still comes from the pinned producer channel and previously established Owner custody; EvidenceDigest is not a signature or a new trust root.

type EvidenceAuthority

type EvidenceAuthority struct {
	AppliedRequestDigest string             `json:"appliedRequestDigest"`
	PlanHash             string             `json:"planHash"`
	WorkloadRef          string             `json:"workloadRef"`
	RequirementID        string             `json:"requirementId"`
	InstanceRef          string             `json:"instanceRef"`
	RuntimeOwnerRef      string             `json:"runtimeOwnerRef"`
	ArtifactDigest       string             `json:"artifactDigest"`
	DataDisposition      string             `json:"dataDisposition"`
	SiteRef              string             `json:"siteRef"`
	NodeRef              string             `json:"nodeRef"`
	ExecutionChannelRef  string             `json:"executionChannelRef"`
	RequestedAt          string             `json:"requestedAt"`
	ValidUntil           string             `json:"validUntil"`
	Authorization        OwnerAuthorization `json:"authorization"`
	RequestDigest        string             `json:"requestDigest"`
}

EvidenceAuthority is the minimal non-secret projection required to verify terminal absence without exporting the applied request's artifact content. It is derived only after the complete Request and Result have passed the StackKits-owned validators.

type Outcome

type Outcome struct {
	RequirementID     string `json:"requirementId"`
	WorkloadRef       string `json:"workloadRef"`
	InstanceRef       string `json:"instanceRef"`
	RuntimeOwnerRef   string `json:"runtimeOwnerRef"`
	ArtifactDigest    string `json:"artifactDigest"`
	DataDisposition   string `json:"dataDisposition"`
	Status            string `json:"status"`
	ObservedState     string `json:"observedState"`
	ObservationRef    string `json:"observationRef"`
	ObservationDigest string `json:"observationDigest"`
}

type OwnerAuthorization

type OwnerAuthorization struct {
	OwnerRef string `json:"ownerRef"`
	KeyID    string `json:"keyId"`
	Value    string `json:"value"`
}

OwnerAuthorization binds the destructive request to established local Owner custody. Signature is produced with localevidence's lifecycle mutation domain; the execution channel transports but never mints it.

type Request

type Request struct {
	APIVersion           string                           `json:"apiVersion"`
	AppliedRequestDigest string                           `json:"appliedRequestDigest"`
	Applied              runtimeexecutor.ExecutionRequest `json:"applied"`
	WorkloadRef          string                           `json:"workloadRef"`
	DataDisposition      string                           `json:"dataDisposition"`
	RequestedAt          string                           `json:"requestedAt"`
	ValidUntil           string                           `json:"validUntil"`
	Authorization        OwnerAuthorization               `json:"authorization"`
	RequestDigest        string                           `json:"requestDigest"`
}

Request carries one closed child request recovered from successful Product Apply. It cannot select a provider, host, artifact, or execution channel that was absent from that applied authority.

func SealRequest

func SealRequest(applied runtimeexecutor.ExecutionRequest, workloadRef, dataDisposition string, requestedAt, validUntil time.Time, authorization OwnerAuthorization) (Request, error)

func SealRequestForPlacement

func SealRequestForPlacement(applied runtimeexecutor.ExecutionRequest, placement AppliedPlacement, dataDisposition string, requestedAt, validUntil time.Time, authorization OwnerAuthorization) (Request, error)

SealRequestForPlacement preserves the original shared Apply digest as lineage while sealing the exact narrowed child request used for removal.

func (Request) AuthorizationBytes

func (request Request) AuthorizationBytes() ([]byte, error)

AuthorizationBytes returns the Owner-signed payload for this request so a local executor can authenticate the data disposition before side effects.

func (Request) Canonical

func (request Request) Canonical() ([]byte, error)

func (Request) ValidateAt

func (request Request) ValidateAt(now time.Time) error

type Result

type Result struct {
	APIVersion    string  `json:"apiVersion"`
	RequestDigest string  `json:"requestDigest"`
	RemovedAt     string  `json:"removedAt"`
	Outcome       Outcome `json:"outcome"`
	ResultDigest  string  `json:"resultDigest"`
}

func NewResult

func NewResult(request Request, removedAt time.Time, outcome Outcome) (Result, error)

func ParseResult

func ParseResult(data []byte, request Request) (Result, error)

func (Result) Canonical

func (result Result) Canonical() ([]byte, error)

func (Result) Validate

func (result Result) Validate(request Request) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL