ephemeral

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxEphemeral = 10
View Source
const DefaultTTL = "7d"

DefaultTTL is how long a preview lives when the deploy doesn't say. A week outlasts a PR that sits over a weekend before anyone reviews it.

Variables

View Source
var ErrDisksUnsupported = errors.New("ephemeral deployments do not support disks")

Functions

func DeleteExpired

func DeleteExpired(ctx context.Context, eac *entityserver_v1alpha.EntityAccessClient, appID entity.Id, log *slog.Logger) (int, error)

DeleteExpired finds and deletes all ephemeral versions that have passed their expiration time for the given app.

func EnforceLimit

func EnforceLimit(ctx context.Context, eac *entityserver_v1alpha.EntityAccessClient, appID entity.Id, maxEphemeral int, log *slog.Logger) error

EnforceLimit ensures the number of ephemeral versions for an app does not exceed the given maximum. If at the limit, the version nearest to expiry is evicted to make room.

func LookupByLabel

LookupByLabel finds an ephemeral AppVersion for the given app and label. Returns nil if no matching version exists or the version has expired.

func NormalizeLabel

func NormalizeLabel(input string) (string, error)

NormalizeLabel converts an input string (typically a Git branch name) into a DNS-compliant label suitable for use as a subdomain. The rules follow RFC 1123: lowercase alphanumeric and hyphens, starting and ending with alphanumeric, max 63 characters.

func ParseTTL added in v0.18.0

func ParseTTL(s string) (time.Duration, error)

ParseTTL parses a preview TTL. It accepts Go durations ("48h", "90m") plus day and week units ("7d", "2w"), and rejects anything that isn't positive.

func ReplaceExisting

func ReplaceExisting(ctx context.Context, eac *entityserver_v1alpha.EntityAccessClient, appID entity.Id, label string, log *slog.Logger) error

ReplaceExisting finds and deletes an existing ephemeral version with the same label for the given app. This ensures deploying with an existing label replaces the old version. Associated sandbox pools are cleaned up via their referenced_by_versions index.

func ValidateConfig added in v0.17.0

func ValidateConfig(spec *core_v1alpha.ConfigSpec) error

ValidateConfig keeps previews from attaching storage shared with production.

func ValidateLabel

func ValidateLabel(label string) error

ValidateLabel checks that a label conforms to DNS label rules (RFC 1123).

func WireTTL added in v0.18.0

func WireTTL(d time.Duration) string

WireTTL renders d as a plain Go duration ("168h" rather than "7d"). Servers that predate day units parse the TTL with time.ParseDuration, and so do consumers of the deploy summary, so this is the spelling that travels.

Types

This section is empty.

Jump to

Keyboard shortcuts

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