target

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package target answers where a commit about a live object goes: the repository, branch and directory its file lives in (an edit), or where a new object in a namespace goes. A Resolver reads the GitOps objects on the cluster with the clients the caller passes in; it holds no credentials of its own, and the caller cannot name a repository.

The package holds what every GitOps tool shares: Target, Controller and the Resolver interface. Each tool's resolver lives in its own package, Flux's in target/flux, so another tool is another Resolver without a change in the callers.

Index

Constants

This section is empty.

Variables

View Source
var ErrControllerNotFound = fmt.Errorf("%w: the GitOps object is not found", ErrUnconfirmed)

ErrControllerNotFound is returned when an object's labels name a GitOps object that does not exist. It is an ErrUnconfirmed: whatever applied the object was deleted, so nothing applies it from a file any more, which a caller that refuses only what GitOps may still apply tells apart with errors.Is.

View Source
var ErrNotApplied = errors.New("not GitOps-applied")

ErrNotApplied is returned for an object, or a namespace, that no GitOps tool applies from a file: it has no target. The message says why.

View Source
var ErrNotPruned = fmt.Errorf("%w: kept on the cluster", ErrNotApplied)

ErrNotPruned is returned when an object's labels name a GitOps object that no longer applies it and does not prune it: its file left Git, and the object stays on the cluster. It is an ErrNotApplied.

View Source
var ErrRendered = fmt.Errorf("%w: rendered by a release", ErrNotApplied)

ErrRendered is returned for an object a release renders (a Flux HelmRelease): its manifest is a chart's output, not a file of its own. It is an ErrNotApplied.

View Source
var ErrTargetNamespace = errors.New("kustomization moves objects to another namespace")

ErrTargetNamespace is returned for a namespace whose applying Kustomization sets spec.targetNamespace to another namespace: a new object in its directory would land in that other namespace.

View Source
var ErrUnconfirmed = fmt.Errorf("%w: labels unconfirmed", ErrNotApplied)

ErrUnconfirmed is returned when an object's labels name a GitOps object that cannot confirm them: it is not found, it has recorded no inventory yet, or the object's inventory id is ambiguous. It is an ErrNotApplied: there is no target. A caller that refuses a live write on an object GitOps may still apply can tell it apart with errors.Is.

Functions

This section is empty.

Types

type Controller added in v0.14.0

type Controller struct {
	// Object is the controller object as the resolver read it from the
	// cluster.
	Object *unstructured.Unstructured
	// Prunes reports whether the controller deletes the objects whose files
	// leave the location. A change prunes nothing through a controller that
	// does not.
	Prunes bool
	// Transforms reports controller configuration that can change manifest
	// content or identity before apply. A direct-object dry run cannot
	// authorize the resulting objects without rendering them.
	Transforms bool
}

Controller is the GitOps object that applies a location once a change is merged: a Flux Kustomization, or another tool's equivalent.

type Resolver

type Resolver interface {
	// Successful targets must report controller-side transformations in
	// Controller.Transforms, separately from transformations in source files.
	// ForObject returns the target of obj, an object read from the cluster
	// the resolver reads objects on: where its file lives. ErrNotApplied
	// when no GitOps tool applies obj from a file.
	ForObject(ctx context.Context, obj *unstructured.Unstructured) (Target, error)
	// ForNamespace returns the target of a new object in namespace: the
	// directory that applies the namespace. ErrNotApplied when no GitOps
	// tool applies the namespace from a file.
	ForNamespace(ctx context.Context, namespace string) (Target, error)
}

Resolver returns the commit target of a live object or of a new object.

type Target

type Target struct {
	// Location is the repository, branch and directory the files live in.
	provenance.Location
	// Controller is the GitOps object that applies the location.
	Controller Controller
}

Target is where a commit goes and what lands it after the merge.

Directories

Path Synopsis
Package flux resolves the commit target of an object a Flux Kustomization applies from a GitRepository, and holds the Flux objects and names the resolution reads.
Package flux resolves the commit target of an object a Flux Kustomization applies from a GitRepository, and holds the Flux objects and names the resolution reads.

Jump to

Keyboard shortcuts

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