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 ¶
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.
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.
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 gone, 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 ¶
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
}
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 {
// 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. |