fluxobjects

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: 4 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 fluxobjects resolves the commit target of an object a Flux Kustomization applies from a GitRepository, and holds the Flux objects and names the resolution reads. Resolver implements target.Resolver: NewResolver for objects on the cluster Flux runs on, NewRemoteResolver for objects on a cluster Flux applies to through a Kustomization's spec.kubeConfig.

Index

Constants

View Source
const KindGitRepository = "GitRepository"

KindGitRepository is the only Flux source kind a commit can target.

Variables

View Source
var (
	// ErrNotFound is returned when the named Kustomization or the
	// GitRepository it references is not among the Flux objects.
	ErrNotFound = errors.New("flux object not found")
	// ErrNotGit is returned when a Kustomization builds from a source that is
	// not a GitRepository; there is no repository to commit to.
	ErrNotGit = errors.New("kustomization source is not a GitRepository")
)
View Source
var ErrUnknownObject = errors.New("not a flux kustomization or git repository")

ErrUnknownObject is returned by Add for an object that is neither a Flux Kustomization nor a Flux GitRepository, and by KustomizationOf for a controller that is not a Flux Kustomization.

Functions

This section is empty.

Types

type GitRepository

type GitRepository struct {
	Name      string
	Namespace string
	URL       string
	// Branch is spec.ref.branch; empty when the source follows something else.
	Branch string
}

GitRepository is the part of a Flux GitRepository the resolution reads.

type Keys

type Keys struct {
	Provider  string
	SecretRef string
}

Keys is a Kustomization's spec.decryption: the provider ("sops") and the Secret next to the Kustomization that holds the keys.

type Kustomization

type Kustomization struct {
	Name      string
	Namespace string
	SourceRef SourceRef
	// Path is spec.path as Flux carries it ("./management-clusters/x").
	Path string
	// ServiceAccountName, Interval and Timeout are spec.serviceAccountName,
	// spec.interval and spec.timeout as Flux carries them ("1m"); empty when
	// unset.
	ServiceAccountName string
	Interval           string
	Timeout            string
	// Prune is spec.prune: whether Flux removes what leaves the directory.
	Prune bool
	// Keys is spec.decryption, nil when the Kustomization applies no
	// encrypted files.
	Keys *Keys
}

Kustomization is the part of a Flux Kustomization the resolution reads.

type Objects

type Objects struct {
	Kustomizations  []Kustomization
	GitRepositories []GitRepository
}

Objects is a cluster's Flux objects as the caller read them.

func (*Objects) Add

func (f *Objects) Add(obj map[string]any) error

Add records one decoded Kubernetes object (the shape of `kubectl get -o json`, or an unstructured object's content) as a Kustomization or GitRepository. Any other apiVersion/kind is an error: the caller hands over the Flux objects it read, nothing else.

func (Objects) FindKustomization

func (f Objects) FindKustomization(namespace, name string) (Kustomization, bool)

FindKustomization returns the Kustomization namespace/name, and whether the Flux objects hold it.

func (Objects) Resolve

func (f Objects) Resolve(namespace, name string) (provenance.Location, error)

Resolve returns the location the Kustomization namespace/name builds from: the GitHub repository and branch of its GitRepository and its spec.path as the directory.

type SourceRef

type SourceRef struct {
	Kind string
	Name string
	// Namespace is empty when the source lives next to the Kustomization.
	Namespace string
}

SourceRef names the Flux source a Kustomization builds from.

Jump to

Keyboard shortcuts

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