targetmodel

package
v0.14.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 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 targetmodel 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 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 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 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
	// Deprecated: use Controller.
	Kustomization fluxobjects.Kustomization
}

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

Jump to

Keyboard shortcuts

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