Documentation
¶
Overview ¶
Package deploymentlease is the shared fail-closed client for the Fleet Deployment Authority's mTLS authorization and target-lease API.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Acquire(ctx context.Context, intent deploymentintent.V1, attemptID, targetID string) (Lease, error)
- func (c *Client) Close() error
- func (c *Client) Finish(ctx context.Context, lease Lease, outcome string) error
- func (c *Client) IssueRegistryCredential(ctx context.Context, lease Lease) (RegistryCredential, error)
- func (c *Client) Renew(ctx context.Context, lease Lease, lifetime time.Duration) (Lease, error)
- func (c *Client) RevokeRegistryCredential(ctx context.Context, lease Lease, credentialID string) error
- func (c *Client) Validate(ctx context.Context, lease Lease) (Lease, error)
- type Config
- type Lease
- type RegistryCredential
Constants ¶
const ( MinLifetime = 30 * time.Second MaxLifetime = 10 * time.Minute )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
New creates a redirect-disabled mTLS client from the local SPIFFE Workload API. Proxy environment variables are ignored by go-common/spiffe.
func (*Client) Acquire ¶
func (c *Client) Acquire(ctx context.Context, intent deploymentintent.V1, attemptID, targetID string) (Lease, error)
Acquire first asks the authority to evaluate the immutable intent, verifies the returned DSSE allow with protected keys, then reserves an exact logical target. Retries are safe only when callers reuse the same attemptID.
func (*Client) Finish ¶
Finish releases the lease after a completed deployment or a verified rollback/failure outcome. Expiry remains the bounded recovery path if the runner is terminated before it can report completion.
func (*Client) IssueRegistryCredential ¶
func (c *Client) IssueRegistryCredential(ctx context.Context, lease Lease) (RegistryCredential, error)
IssueRegistryCredential asks the authority for a short-lived, repository- scoped read-only image-pull token. The authority refuses issuance without a currently active lease owned by this mTLS principal.
type Config ¶
type Config struct {
Endpoint string
WorkloadAPISocket string
ServerSPIFFEIDs []string
Principal string
SigningKeys map[string]ed25519.PublicKey
RequestTimeout time.Duration
}
Config uses only private runtime configuration. Keys must be loaded from a protected file by the caller; public intent/evidence never supplies trust roots. ServerSPIFFEIDs is an exact peer allowlist.
type Lease ¶
type Lease struct {
LeaseID string `json:"lease_id"`
DecisionID string `json:"decision_id"`
AttemptID string `json:"attempt_id"`
IntentID string `json:"intent_id"`
IntentDigest string `json:"intent_digest"`
ArtifactDigest string `json:"artifact_digest"`
SourceCommit string `json:"source_commit"`
RollbackDigest string `json:"rollback_digest"`
Principal string `json:"principal"`
ServiceID string `json:"service_id"`
Environment string `json:"environment"`
TargetPool string `json:"target_pool"`
TargetID string `json:"target_id"`
PolicyVersion string `json:"policy_version"`
Fence int64 `json:"fence"`
State string `json:"state"`
IssuedAt time.Time `json:"issued_at"`
ExpiresAt time.Time `json:"expires_at"`
IntentExpiresAt time.Time `json:"intent_expires_at"`
}
Lease is the durable authority's active reservation. Fence is monotonically increasing for a service/target pair and must be checked before each runtime mutation by the execution layer.
type RegistryCredential ¶
type RegistryCredential struct {
CredentialID string `json:"credential_id"`
Token []byte `json:"-"`
ExpiresAt time.Time `json:"expires_at"`
}
RegistryCredential is a single-repository, read-only pull token issued only for an active deployment lease. Token is held as bytes so callers can clear it as soon as the image pull finishes. String formatting always redacts it.
func (*RegistryCredential) Clear ¶
func (c *RegistryCredential) Clear()
Clear zeroes the in-memory bearer token after use.
func (RegistryCredential) GoString ¶
func (c RegistryCredential) GoString() string
func (RegistryCredential) String ¶
func (c RegistryCredential) String() string
func (*RegistryCredential) UnmarshalJSON ¶
func (c *RegistryCredential) UnmarshalJSON(data []byte) error