v1

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 107

Documentation

Overview

Package v1 contains API Schema definitions for the source v1 API group +kubebuilder:object:generate=true +groupName=source.toolkit.fluxcd.io

Index

Constants

View Source
const (
	// ArtifactInStorageCondition indicates the availability of the Artifact in
	// the storage.
	// If True, the Artifact is stored successfully.
	// This Condition is only present on the resource if the Artifact is
	// successfully stored.
	ArtifactInStorageCondition string = "ArtifactInStorage"

	// ArtifactOutdatedCondition indicates the current Artifact of the Source
	// is outdated.
	// This is a "negative polarity" or "abnormal-true" type, and is only
	// present on the resource if it is True.
	ArtifactOutdatedCondition string = "ArtifactOutdated"

	// SourceVerifiedCondition indicates the integrity verification of the
	// Source.
	// If True, the integrity check succeeded. If False, it failed.
	// This Condition is only present on the resource if the integrity check
	// is enabled.
	SourceVerifiedCondition string = "SourceVerified"

	// FetchFailedCondition indicates a transient or persistent fetch failure
	// of an upstream Source.
	// If True, observations on the upstream Source revision may be impossible,
	// and the Artifact available for the Source may be outdated.
	// This is a "negative polarity" or "abnormal-true" type, and is only
	// present on the resource if it is True.
	FetchFailedCondition string = "FetchFailed"

	// BuildFailedCondition indicates a transient or persistent build failure
	// of a Source's Artifact.
	// If True, the Source can be in an ArtifactOutdatedCondition.
	// This is a "negative polarity" or "abnormal-true" type, and is only
	// present on the resource if it is True.
	BuildFailedCondition string = "BuildFailed"

	// StorageOperationFailedCondition indicates a transient or persistent
	// failure related to storage. If True, the reconciliation failed while
	// performing some filesystem operation.
	// This is a "negative polarity" or "abnormal-true" type, and is only
	// present on the resource if it is True.
	StorageOperationFailedCondition string = "StorageOperationFailed"
)
View Source
const (
	// URLInvalidReason signals that a given Source has an invalid URL.
	URLInvalidReason string = "URLInvalid"

	// AuthenticationFailedReason signals that a Secret does not have the
	// required fields, or the provided credentials do not match.
	AuthenticationFailedReason string = "AuthenticationFailed"

	// VerificationError signals that the Source's verification
	// check failed.
	VerificationError string = "VerificationError"

	// DirCreationFailedReason signals a failure caused by a directory creation
	// operation.
	DirCreationFailedReason string = "DirectoryCreationFailed"

	// StatOperationFailedReason signals a failure caused by a stat operation on
	// a path.
	StatOperationFailedReason string = "StatOperationFailed"

	// ReadOperationFailedReason signals a failure caused by a read operation.
	ReadOperationFailedReason string = "ReadOperationFailed"

	// AcquireLockFailedReason signals a failure in acquiring lock.
	AcquireLockFailedReason string = "AcquireLockFailed"

	// InvalidPathReason signals a failure caused by an invalid path.
	InvalidPathReason string = "InvalidPath"

	// ArchiveOperationFailedReason signals a failure in archive operation.
	ArchiveOperationFailedReason string = "ArchiveOperationFailed"

	// SymlinkUpdateFailedReason signals a failure in updating a symlink.
	SymlinkUpdateFailedReason string = "SymlinkUpdateFailed"

	// ArtifactUpToDateReason signals that an existing Artifact is up-to-date
	// with the Source.
	ArtifactUpToDateReason string = "ArtifactUpToDate"

	// CacheOperationFailedReason signals a failure in cache operation.
	CacheOperationFailedReason string = "CacheOperationFailed"

	// PatchOperationFailedReason signals a failure in patching a kubernetes API
	// object.
	PatchOperationFailedReason string = "PatchOperationFailed"
)

Reasons are provided as utility, and not part of the declarative API.

View Source
const (
	// GitOperationSucceedReason signals that a Git operation (e.g. clone,
	// checkout, etc.) succeeded.
	GitOperationSucceedReason string = "GitOperationSucceeded"

	// GitOperationFailedReason signals that a Git operation (e.g. clone,
	// checkout, etc.) failed.
	GitOperationFailedReason string = "GitOperationFailed"
)
View Source
const (
	// GitRepositoryKind is the string representation of a GitRepository.
	GitRepositoryKind = "GitRepository"
)
View Source
const (
	// IncludeUnavailableCondition indicates one of the includes is not
	// available. For example, because it does not exist, or does not have an
	// Artifact.
	// This is a "negative polarity" or "abnormal-true" type, and is only
	// present on the resource if it is True.
	IncludeUnavailableCondition string = "IncludeUnavailable"
)
View Source
const SourceFinalizer = "finalizers.fluxcd.io"
View Source
const (
	// SourceIndexKey is the key used for indexing objects based on their
	// referenced Source.
	SourceIndexKey string = ".metadata.source"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: "source.toolkit.fluxcd.io", Version: "v1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func ArtifactDir

func ArtifactDir(kind, namespace, name string) string

ArtifactDir returns the artifact dir path in the form of '<kind>/<namespace>/<name>'.

func ArtifactPath

func ArtifactPath(kind, namespace, name, filename string) string

ArtifactPath returns the artifact path in the form of '<kind>/<namespace>/name>/<filename>'.

Types

type Artifact

type Artifact struct {
	// Path is the relative file path of the Artifact. It can be used to locate
	// the file in the root of the Artifact storage on the local file system of
	// the controller managing the Source.
	// +required
	Path string `json:"path"`

	// URL is the HTTP address of the Artifact as exposed by the controller
	// managing the Source. It can be used to retrieve the Artifact for
	// consumption, e.g. by another controller applying the Artifact contents.
	// +required
	URL string `json:"url"`

	// Revision is a human-readable identifier traceable in the origin source
	// system. It can be a Git commit SHA, Git tag, a Helm chart version, etc.
	// +required
	Revision string `json:"revision"`

	// Digest is the digest of the file in the form of '<algorithm>:<checksum>'.
	// +optional
	// +kubebuilder:validation:Pattern="^[a-z0-9]+(?:[.+_-][a-z0-9]+)*:[a-zA-Z0-9=_-]+$"
	Digest string `json:"digest,omitempty"`

	// LastUpdateTime is the timestamp corresponding to the last update of the
	// Artifact.
	// +required
	LastUpdateTime metav1.Time `json:"lastUpdateTime"`

	// Size is the number of bytes in the file.
	// +optional
	Size *int64 `json:"size,omitempty"`

	// Metadata holds upstream information such as OCI annotations.
	// +optional
	Metadata map[string]string `json:"metadata,omitempty"`
}

Artifact represents the output of a Source reconciliation.

func (*Artifact) DeepCopy

func (in *Artifact) DeepCopy() *Artifact

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Artifact.

func (*Artifact) DeepCopyInto

func (in *Artifact) DeepCopyInto(out *Artifact)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Artifact) HasDigest

func (in *Artifact) HasDigest(digest string) bool

HasDigest returns if the given digest matches the current Digest of the Artifact.

func (*Artifact) HasRevision

func (in *Artifact) HasRevision(revision string) bool

HasRevision returns if the given revision matches the current Revision of the Artifact.

type GitRepository

type GitRepository struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec GitRepositorySpec `json:"spec,omitempty"`
	// +kubebuilder:default={"observedGeneration":-1}
	Status GitRepositoryStatus `json:"status,omitempty"`
}

GitRepository is the Schema for the gitrepositories API.

func (*GitRepository) DeepCopy

func (in *GitRepository) DeepCopy() *GitRepository

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepository.

func (*GitRepository) DeepCopyInto

func (in *GitRepository) DeepCopyInto(out *GitRepository)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GitRepository) DeepCopyObject

func (in *GitRepository) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*GitRepository) GetArtifact

func (in *GitRepository) GetArtifact() *Artifact

GetArtifact returns the latest Artifact from the GitRepository if present in the status sub-resource.

func (GitRepository) GetConditions

func (in GitRepository) GetConditions() []metav1.Condition

GetConditions returns the status conditions of the object.

func (GitRepository) GetRequeueAfter

func (in GitRepository) GetRequeueAfter() time.Duration

GetRequeueAfter returns the duration after which the GitRepository must be reconciled again.

func (*GitRepository) SetConditions

func (in *GitRepository) SetConditions(conditions []metav1.Condition)

SetConditions sets the status conditions on the object.

type GitRepositoryInclude

type GitRepositoryInclude struct {
	// GitRepositoryRef specifies the GitRepository which Artifact contents
	// must be included.
	// +required
	GitRepositoryRef meta.LocalObjectReference `json:"repository"`

	// FromPath specifies the path to copy contents from, defaults to the root
	// of the Artifact.
	// +optional
	FromPath string `json:"fromPath,omitempty"`

	// ToPath specifies the path to copy contents to, defaults to the name of
	// the GitRepositoryRef.
	// +optional
	ToPath string `json:"toPath,omitempty"`
}

GitRepositoryInclude specifies a local reference to a GitRepository which Artifact (sub-)contents must be included, and where they should be placed.

func (*GitRepositoryInclude) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositoryInclude.

func (*GitRepositoryInclude) DeepCopyInto

func (in *GitRepositoryInclude) DeepCopyInto(out *GitRepositoryInclude)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GitRepositoryInclude) GetFromPath

func (in *GitRepositoryInclude) GetFromPath() string

GetFromPath returns the specified FromPath.

func (*GitRepositoryInclude) GetToPath

func (in *GitRepositoryInclude) GetToPath() string

GetToPath returns the specified ToPath, falling back to the name of the GitRepositoryRef.

type GitRepositoryList

type GitRepositoryList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []GitRepository `json:"items"`
}

GitRepositoryList contains a list of GitRepository objects. +kubebuilder:object:root=true

func (*GitRepositoryList) DeepCopy

func (in *GitRepositoryList) DeepCopy() *GitRepositoryList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositoryList.

func (*GitRepositoryList) DeepCopyInto

func (in *GitRepositoryList) DeepCopyInto(out *GitRepositoryList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GitRepositoryList) DeepCopyObject

func (in *GitRepositoryList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type GitRepositoryRef

type GitRepositoryRef struct {
	// Branch to check out, defaults to 'master' if no other field is defined.
	// +optional
	Branch string `json:"branch,omitempty"`

	// Tag to check out, takes precedence over Branch.
	// +optional
	Tag string `json:"tag,omitempty"`

	// SemVer tag expression to check out, takes precedence over Tag.
	// +optional
	SemVer string `json:"semver,omitempty"`

	// Name of the reference to check out; takes precedence over Branch, Tag and SemVer.
	//
	// It must be a valid Git reference: https://git-scm.com/docs/git-check-ref-format#_description
	// Examples: "refs/heads/main", "refs/tags/v0.1.0", "refs/pull/420/head", "refs/merge-requests/1/head"
	// +optional
	Name string `json:"name,omitempty"`

	// Commit SHA to check out, takes precedence over all reference fields.
	//
	// This can be combined with Branch to shallow clone the branch, in which
	// the commit is expected to exist.
	// +optional
	Commit string `json:"commit,omitempty"`
}

GitRepositoryRef specifies the Git reference to resolve and checkout.

func (*GitRepositoryRef) DeepCopy

func (in *GitRepositoryRef) DeepCopy() *GitRepositoryRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositoryRef.

func (*GitRepositoryRef) DeepCopyInto

func (in *GitRepositoryRef) DeepCopyInto(out *GitRepositoryRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GitRepositorySpec

type GitRepositorySpec struct {
	// URL specifies the Git repository URL, it can be an HTTP/S or SSH address.
	// +kubebuilder:validation:Pattern="^(http|https|ssh)://.*$"
	// +required
	URL string `json:"url"`

	// SecretRef specifies the Secret containing authentication credentials for
	// the GitRepository.
	// For HTTPS repositories the Secret must contain 'username' and 'password'
	// fields for basic auth or 'bearerToken' field for token auth.
	// For SSH repositories the Secret must contain 'identity'
	// and 'known_hosts' fields.
	// +optional
	SecretRef *meta.LocalObjectReference `json:"secretRef,omitempty"`

	// Interval at which the GitRepository URL is checked for updates.
	// This interval is approximate and may be subject to jitter to ensure
	// efficient use of resources.
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
	// +required
	Interval metav1.Duration `json:"interval"`

	// Timeout for Git operations like cloning, defaults to 60s.
	// +kubebuilder:default="60s"
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m))+$"
	// +optional
	Timeout *metav1.Duration `json:"timeout,omitempty"`

	// Reference specifies the Git reference to resolve and monitor for
	// changes, defaults to the 'master' branch.
	// +optional
	Reference *GitRepositoryRef `json:"ref,omitempty"`

	// Verification specifies the configuration to verify the Git commit
	// signature(s).
	// +optional
	Verification *GitRepositoryVerification `json:"verify,omitempty"`

	// ProxySecretRef specifies the Secret containing the proxy configuration
	// to use while communicating with the Git server.
	// +optional
	ProxySecretRef *meta.LocalObjectReference `json:"proxySecretRef,omitempty"`

	// Ignore overrides the set of excluded patterns in the .sourceignore format
	// (which is the same as .gitignore). If not provided, a default will be used,
	// consult the documentation for your version to find out what those are.
	// +optional
	Ignore *string `json:"ignore,omitempty"`

	// Suspend tells the controller to suspend the reconciliation of this
	// GitRepository.
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// RecurseSubmodules enables the initialization of all submodules within
	// the GitRepository as cloned from the URL, using their default settings.
	// +optional
	RecurseSubmodules bool `json:"recurseSubmodules,omitempty"`

	// Include specifies a list of GitRepository resources which Artifacts
	// should be included in the Artifact produced for this GitRepository.
	// +optional
	Include []GitRepositoryInclude `json:"include,omitempty"`
}

GitRepositorySpec specifies the required configuration to produce an Artifact for a Git repository.

func (*GitRepositorySpec) DeepCopy

func (in *GitRepositorySpec) DeepCopy() *GitRepositorySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositorySpec.

func (*GitRepositorySpec) DeepCopyInto

func (in *GitRepositorySpec) DeepCopyInto(out *GitRepositorySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GitRepositoryStatus

type GitRepositoryStatus struct {
	// ObservedGeneration is the last observed generation of the GitRepository
	// object.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Conditions holds the conditions for the GitRepository.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// Artifact represents the last successful GitRepository reconciliation.
	// +optional
	Artifact *Artifact `json:"artifact,omitempty"`

	// IncludedArtifacts contains a list of the last successfully included
	// Artifacts as instructed by GitRepositorySpec.Include.
	// +optional
	IncludedArtifacts []*Artifact `json:"includedArtifacts,omitempty"`

	// ObservedIgnore is the observed exclusion patterns used for constructing
	// the source artifact.
	// +optional
	ObservedIgnore *string `json:"observedIgnore,omitempty"`

	// ObservedRecurseSubmodules is the observed resource submodules
	// configuration used to produce the current Artifact.
	// +optional
	ObservedRecurseSubmodules bool `json:"observedRecurseSubmodules,omitempty"`

	// ObservedInclude is the observed list of GitRepository resources used to
	// produce the current Artifact.
	// +optional
	ObservedInclude []GitRepositoryInclude `json:"observedInclude,omitempty"`

	// SourceVerificationMode is the last used verification mode indicating
	// which Git object(s) have been verified.
	// +optional
	SourceVerificationMode *GitVerificationMode `json:"sourceVerificationMode,omitempty"`

	meta.ReconcileRequestStatus `json:",inline"`
}

GitRepositoryStatus records the observed state of a Git repository.

func (*GitRepositoryStatus) DeepCopy

func (in *GitRepositoryStatus) DeepCopy() *GitRepositoryStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositoryStatus.

func (*GitRepositoryStatus) DeepCopyInto

func (in *GitRepositoryStatus) DeepCopyInto(out *GitRepositoryStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GitRepositoryVerification

type GitRepositoryVerification struct {
	// Mode specifies which Git object(s) should be verified.
	//
	// The variants "head" and "HEAD" both imply the same thing, i.e. verify
	// the commit that the HEAD of the Git repository points to. The variant
	// "head" solely exists to ensure backwards compatibility.
	// +kubebuilder:validation:Enum=head;HEAD;Tag;TagAndHEAD
	// +optional
	// +kubebuilder:default:=HEAD
	Mode GitVerificationMode `json:"mode,omitempty"`

	// SecretRef specifies the Secret containing the public keys of trusted Git
	// authors.
	// +required
	SecretRef meta.LocalObjectReference `json:"secretRef"`
}

GitRepositoryVerification specifies the Git commit signature verification strategy.

func (*GitRepositoryVerification) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GitRepositoryVerification.

func (*GitRepositoryVerification) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GitRepositoryVerification) GetMode added in v1.1.0

GetMode returns the declared GitVerificationMode, or a ModeGitHEAD default.

func (*GitRepositoryVerification) VerifyHEAD added in v1.1.0

func (v *GitRepositoryVerification) VerifyHEAD() bool

VerifyHEAD returns if the configured mode instructs verification of the Git HEAD.

func (*GitRepositoryVerification) VerifyTag added in v1.1.0

func (v *GitRepositoryVerification) VerifyTag() bool

VerifyTag returns if the configured mode instructs verification of the Git tag.

type GitVerificationMode added in v1.1.0

type GitVerificationMode string

GitVerificationMode specifies the verification mode for a Git repository.

const (
	// ModeGitHEAD implies that the HEAD of the Git repository (after it has been
	// checked out to the required commit) should be verified.
	ModeGitHEAD GitVerificationMode = "HEAD"
	// ModeGitTag implies that the tag object specified in the checkout configuration
	// should be verified.
	ModeGitTag GitVerificationMode = "Tag"
	// ModeGitTagAndHEAD implies that both the tag object and the commit it points
	// to should be verified.
	ModeGitTagAndHEAD GitVerificationMode = "TagAndHEAD"
)

func (GitVerificationMode) Valid added in v1.1.0

func (m GitVerificationMode) Valid() bool

Valid checks the validity of the Git verification mode.

type Source

type Source interface {
	runtime.Object
	// GetRequeueAfter returns the duration after which the source must be
	// reconciled again.
	GetRequeueAfter() time.Duration
	// GetArtifact returns the latest artifact from the source if present in
	// the status sub-resource.
	GetArtifact() *Artifact
}

Source interface must be supported by all API types. Source is the interface that provides generic access to the Artifact and interval. It must be supported by all kinds of the source.toolkit.fluxcd.io API group.

+k8s:deepcopy-gen=false

Jump to

Keyboard shortcuts

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