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 ¶
const KindGitRepository = "GitRepository"
KindGitRepository is the only Flux source kind a commit can target.
Variables ¶
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") )
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 ¶
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 ¶
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.