yoke

package
v0.20.21 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalFlight

func EvalFlight(ctx context.Context, params EvalParams) ([]byte, error)

func ExportToFS

func ExportToFS(dir, release string, resources []*unstructured.Unstructured) error

func ExportToStdout

func ExportToStdout(ctx context.Context, resources []*unstructured.Unstructured) error

func GetSchematic added in v0.17.2

func GetSchematic(ctx context.Context, params GetSchematicParams) ([]byte, error)

func ListSchematics added in v0.17.2

func ListSchematics(ctx context.Context, params ListSchematicsParams) ([]string, error)

func LoadWasm

func LoadWasm(ctx context.Context, params *FlightParams) (err error)

LoadWasm serves to pull the flight params path and resolve its wasm on the flight params. It has no effect if the flight params: - Module is non-nil (used in pre-cached module calls) - path is empty (when stdin is used as desired output) - Wasm is non-empty

func LoadWasmFromURL added in v0.20.5

func LoadWasmFromURL(ctx context.Context, path string, insecure bool) ([]byte, error)

func SetSchematic added in v0.17.2

func SetSchematic(ctx context.Context, params SetSchematicParams) error

func Sign added in v0.20.8

func Sign(params SignParams) error

func Stow added in v0.10.4

func Stow(ctx context.Context, params StowParams) error

func Verify added in v0.20.8

func Verify(params VerifyParams) error

Types

type ClusterAccessParams added in v0.16.1

type ClusterAccessParams = host.ClusterAccessParams

type Commander

type Commander struct {
	// contains filtered or unexported fields
}

func FromK8Client

func FromK8Client(client *k8s.Client) *Commander

func FromKubeConfig

func FromKubeConfig(path string) (*Commander, error)

func FromKubeConfigFlags added in v0.10.10

func FromKubeConfigFlags(flags *genericclioptions.ConfigFlags) (*Commander, error)

func (Commander) Descent

func (commander Commander) Descent(ctx context.Context, params DescentParams) (err error)

func (Commander) Mayday

func (commander Commander) Mayday(ctx context.Context, params MaydayParams) error

func (Commander) Takeoff

func (commander Commander) Takeoff(ctx context.Context, params TakeoffParams) (err error)

func (Commander) Turbulence

func (commander Commander) Turbulence(ctx context.Context, params TurbulenceParams) error

func (Commander) UnlockRelease added in v0.14.3

func (commander Commander) UnlockRelease(ctx context.Context, params UnlockParams) error

type DescentParams

type DescentParams struct {
	Release    string
	RevisionID int
	Namespace  string
	Wait       time.Duration
	Poll       time.Duration
	Lock       bool

	PruneOpts
}

type EvalParams added in v0.14.3

type EvalParams struct {
	Client        *k8s.Client
	Release       string
	Namespace     string
	ClusterAccess ClusterAccessParams
	Flight        FlightParams
}

type FlightParams

type FlightParams struct {
	Path                string
	Module              Module
	Wasm                []byte
	Insecure            bool
	Args                []string
	CompilationCacheDir string

	// MaxMemoryMib is the maximum amount of memory a flight can allocate. If this is not set, the flight can use the maximum amount of memory available.
	// The maximum memory abailable is 4gb or 4096mb
	MaxMemoryMib uint64

	// Timeout sets a custom timeout flight run time. If exceeded, execution will fail with a Deadline Exceeded error.
	// By default flights have a max runtime of 10 seconds. Setting this to a negative duration removes all timeouts.
	// Running without timeouts is not recommended but you do you.
	Timeout time.Duration

	// Env specifies user-defined envvars to be added to the flight execution.
	// Standard yoke envvars will take precendence.
	Env map[string]string

	// Stderr is the writer that will be exposed to the wasm module as os.Stderr.
	// If not provided all stderr writes in the wasm module will be buffered instead
	// and surfaced to the user only on error exit codes.
	Stderr io.Writer
	Input  io.Reader
}

type GetSchematicParams added in v0.17.2

type GetSchematicParams struct {
	WasmURL string
	Name    string
}

type ListSchematicsParams added in v0.17.2

type ListSchematicsParams struct {
	WasmURL string
}

type MaydayParams added in v0.14.0

type MaydayParams struct {
	Release   string
	Namespace string
	PruneOpts
}

type Module added in v0.12.2

type Module struct {
	Instance       *wasi.Module
	SourceMetadata ModuleSourcetadata
}

type ModuleSourcetadata added in v0.12.2

type ModuleSourcetadata = internal.Source

type PruneOpts added in v0.14.0

type PruneOpts = k8s.PruneOpts

type SetSchematicParams added in v0.17.2

type SetSchematicParams struct {
	WasmPath string
	Name     string
	Input    io.Reader
	CMD      bool
}

type SignParams added in v0.20.8

type SignParams struct {
	WasmFile string
	Out      string
	KeyPath  string
	Force    bool
}

type StowParams added in v0.10.4

type StowParams struct {
	WasmFile string
	URL      string
	Tags     []string
	Insecure bool
}

type TakeoffParams

type TakeoffParams struct {
	// Directly send the result of evaluating the flight to stdout instead of applying it.
	SendToStdout bool

	// Skips running apply in dry-run before applying resources. Not recommended unless you know what you are doing and have specific reason to do so.
	// May be removed in a future release.
	SkipDryRun bool

	// DryRun will send the patch apply requests to the k8s api server in dry-run mode only.
	// Will not apply any state changes, nor create a revision to the release history.
	DryRun bool

	// ForceConflicts applies the path request with force. It will take ownership of fields owned by other fieldManagers.
	ForceConflicts bool

	// ForceOwnership allows yoke releases to take over ownership of previously existing resources.
	ForceOwnership bool

	// CrossNamespace allows for a release to create resources in a namespace other than the release's own namespace.
	CrossNamespace bool

	// Name of release
	Release string

	// ReleasePrefix prefixes the release name. The full name of the release will be releasePrefix+release.
	// However the YOKE_RELEASE envvar will only be release. This allows us users to set release names that can be used in the Flight
	// but dedup them with a prefix like in the case of the ATC Flight and ClusterFlight CRs.
	ReleasePrefix string

	// Release Namespace
	Namespace string

	// Out is a folder to which to write all the resources hierarchically. This does not create a release or apply any state to the cluster.
	// This is useful for debugging/inspecting output or for working CDK8s style using kubectl apply --recursive.
	Out string

	// Parameters for the flight.
	Flight FlightParams

	// Do not apply the release but diff it against the current active version.
	DiffOnly bool

	// How many lines of context in the diff. Has no effect if DiffOnly is false.
	Context int

	// Output diffs with ansi colors.
	Color bool

	// Create namespace of target release if not exists.
	CreateNamespace bool

	// Wait interval for resources to become ready after being applied. The same wait interval is used as a timeout for each stage in a release.
	// Therefore if a stage contains a long-running job or workload it is important to set the wait time to a sufficiently long duration.
	Wait time.Duration

	// Poll interval to check for resource readiness.
	Poll time.Duration

	// OwnerReferences to be added to each resource found in release.
	OwnerReferences []metav1.OwnerReference

	// ClusterAccess grants the flight access to the kubernetes cluster. Users will be able to use the host k8s_lookup function.
	// This includes enabling/disabling cluster-access and granting any external resource matchers.
	ClusterAccess ClusterAccessParams

	// HistoryCapSize limits the number of revisions kept in the release's history by the size. If Cap is less than 1 history is uncapped.
	HistoryCapSize int

	// IdentityFunc is provided in contexts such as the AirTrafficController where the flight may return resources that reference itself.
	// If the IdentityFunc is passed any resources that match the predicate should be removed from the stages.
	IdentityFunc func(*unstructured.Unstructured) bool

	// ExtraLabels adds extra labels to resources deployed by yoke.
	// Example: used by the ATC to add Instance metadata
	ExtraLabels map[string]string

	// ExtraAnnotations adds extra annotations to resources deployed by yoke.
	// Example: used by the ATC to add Instance metadata
	ExtraAnnotations map[string]string

	// ManagedBy is the value used in the yoke managed-by label. If left empty will default to `yoke`.
	ManagedBy string

	// PruneOpts controls if namespaces and crds are removed when creating new releases.
	// If a prior release had a namespace or crd resource and the next revision of the release would not have it
	// setting prune options would allow you to remove the resources. By default CRDs and Namespaces are not pruned.
	PruneOpts

	// Lock defines whether the lock should not be taken during takeoff. By default the lock is not taken and conflicts can arise.
	// Processes that opt-in to using the locking mechanism cannot run at the same time.
	// This feature is opt-in since locking can cause conflicts with release namespaces that would be created by the namespace.
	// This is an unfortunate reality of supporting kubectl apply yaml dumps.
	Lock bool

	// Checksum is the sha256 checksum of your referenced module. If provided this checksum is compared to the sha256 of the wasm module.
	// If they do not match it results in an error.
	// If not provided it will infer the sha256 from the oci tag or basepath of the url:
	//
	// for example:
	// - not inferred: oci://registry/repo/module:v1.2.3
	// - inferred: oci://registry/repo/module:sha256_5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03
	// - inferred: https://domain.com/my/module_sha256_5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03.wasm.gz
	//
	// If checksum is not provided and cannot be inferred, this check is skipped.
	Checksum string

	// VerifyKeyPath is the path to the public key used to verify the module's signature if signed.
	// If the path is to a folder, all PEM files are loaded. If the key is a private key, it will infer the public key from it.
	// Only one key is loaded per PEM file.
	VerifyKeyPath string
}

type TurbulenceParams

type TurbulenceParams struct {
	Namespace     string
	Release       string
	Context       int
	ConflictsOnly bool
	Fix           bool
	Color         bool
	Silent        bool
}

type UnlockParams added in v0.14.3

type UnlockParams struct {
	Release   string
	Namespace string
}

type VerifyParams added in v0.20.8

type VerifyParams struct {
	WasmFile string
	KeyPath  string
}

Jump to

Keyboard shortcuts

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