v1

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Overview

Package v1 contains API types for the image API group, version v1. These types are concerned with reflecting metadata from OCI image repositories into a cluster, so they can be consulted for e.g., automation.

+kubebuilder:object:generate=true +groupName=image.toolkit.fluxcd.io

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

Index

Constants

View Source
const (
	// ImageURLInvalidReason represents the fact that a given repository has an invalid image URL.
	ImageURLInvalidReason string = "ImageURLInvalid"

	// DependencyNotReadyReason represents the fact that
	// one of the dependencies is not ready.
	DependencyNotReadyReason string = "DependencyNotReady"

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

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

	// IntervalNotConfiguredReason signals that the interval is missing.
	IntervalNotConfiguredReason string = "IntervalNotConfigured"
)
View Source
const ImageFinalizer = "finalizers.fluxcd.io"
View Source
const ImagePolicyKind = "ImagePolicy"
View Source
const ImageRepositoryKind = "ImageRepository"

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "image.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

This section is empty.

Types

type AlphabeticalPolicy

type AlphabeticalPolicy struct {
	// Order specifies the sorting order of the tags. Given the letters of the
	// alphabet as tags, ascending order would select Z, and descending order
	// would select A.
	// +kubebuilder:default:="asc"
	// +kubebuilder:validation:Enum=asc;desc
	// +optional
	Order string `json:"order,omitempty"`
}

AlphabeticalPolicy specifies a alphabetical ordering policy.

func (*AlphabeticalPolicy) DeepCopy

func (in *AlphabeticalPolicy) DeepCopy() *AlphabeticalPolicy

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

func (*AlphabeticalPolicy) DeepCopyInto

func (in *AlphabeticalPolicy) DeepCopyInto(out *AlphabeticalPolicy)

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

type ImagePolicy

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

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

ImagePolicy is the Schema for the imagepolicies API

func (*ImagePolicy) DeepCopy

func (in *ImagePolicy) DeepCopy() *ImagePolicy

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

func (*ImagePolicy) DeepCopyInto

func (in *ImagePolicy) DeepCopyInto(out *ImagePolicy)

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

func (*ImagePolicy) DeepCopyObject

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

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

func (*ImagePolicy) GetConditions

func (in *ImagePolicy) GetConditions() []metav1.Condition

GetConditions returns the status conditions of the object.

func (*ImagePolicy) GetDigestReflectionPolicy

func (in *ImagePolicy) GetDigestReflectionPolicy() ReflectionPolicy

func (*ImagePolicy) GetInterval

func (in *ImagePolicy) GetInterval() time.Duration

func (*ImagePolicy) SetConditions

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

SetConditions sets the status conditions on the object.

type ImagePolicyChoice

type ImagePolicyChoice struct {
	// SemVer gives a semantic version range to check against the tags
	// available.
	// +optional
	SemVer *SemVerPolicy `json:"semver,omitempty"`
	// Alphabetical set of rules to use for alphabetical ordering of the tags.
	// +optional
	Alphabetical *AlphabeticalPolicy `json:"alphabetical,omitempty"`
	// Numerical set of rules to use for numerical ordering of the tags.
	// +optional
	Numerical *NumericalPolicy `json:"numerical,omitempty"`
}

ImagePolicyChoice is a union of all the types of policy that can be supplied.

func (*ImagePolicyChoice) DeepCopy

func (in *ImagePolicyChoice) DeepCopy() *ImagePolicyChoice

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

func (*ImagePolicyChoice) DeepCopyInto

func (in *ImagePolicyChoice) DeepCopyInto(out *ImagePolicyChoice)

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

type ImagePolicyList

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

ImagePolicyList contains a list of ImagePolicy

func (*ImagePolicyList) DeepCopy

func (in *ImagePolicyList) DeepCopy() *ImagePolicyList

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

func (*ImagePolicyList) DeepCopyInto

func (in *ImagePolicyList) DeepCopyInto(out *ImagePolicyList)

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

func (*ImagePolicyList) DeepCopyObject

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

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

type ImagePolicySpec

type ImagePolicySpec struct {
	// ImageRepositoryRef points at the object specifying the image
	// being scanned
	// +required
	ImageRepositoryRef meta.NamespacedObjectReference `json:"imageRepositoryRef"`
	// Policy gives the particulars of the policy to be followed in
	// selecting the most recent image
	// +required
	Policy ImagePolicyChoice `json:"policy"`
	// FilterTags enables filtering for only a subset of tags based on a set of
	// rules. If no rules are provided, all the tags from the repository will be
	// ordered and compared.
	// +optional
	FilterTags *TagFilter `json:"filterTags,omitempty"`
	// DigestReflectionPolicy governs the setting of the `.status.latestRef.digest` field.
	//
	// Never: The digest field will always be set to the empty string.
	//
	// IfNotPresent: The digest field will be set to the digest of the elected
	// latest image if the field is empty and the image did not change.
	//
	// Always: The digest field will always be set to the digest of the elected
	// latest image.
	//
	// Default: Never.
	// +kubebuilder:default:=Never
	DigestReflectionPolicy ReflectionPolicy `json:"digestReflectionPolicy,omitempty"`

	// Interval is the length of time to wait between
	// refreshing the digest of the latest tag when the
	// reflection policy is set to "Always".
	//
	// Defaults to 10m.
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
	// +optional
	Interval *metav1.Duration `json:"interval,omitempty"`

	// This flag tells the controller to suspend subsequent policy reconciliations.
	// It does not apply to already started reconciliations. Defaults to false.
	// +optional
	Suspend bool `json:"suspend,omitempty"`
}

ImagePolicySpec defines the parameters for calculating the ImagePolicy. +kubebuilder:validation:XValidation:rule="!has(self.interval) || (has(self.digestReflectionPolicy) && self.digestReflectionPolicy == 'Always')", message="spec.interval is only accepted when spec.digestReflectionPolicy is set to 'Always'" +kubebuilder:validation:XValidation:rule="has(self.interval) || !has(self.digestReflectionPolicy) || self.digestReflectionPolicy != 'Always'", message="spec.interval must be set when spec.digestReflectionPolicy is set to 'Always'"

func (*ImagePolicySpec) DeepCopy

func (in *ImagePolicySpec) DeepCopy() *ImagePolicySpec

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

func (*ImagePolicySpec) DeepCopyInto

func (in *ImagePolicySpec) DeepCopyInto(out *ImagePolicySpec)

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

type ImagePolicyStatus

type ImagePolicyStatus struct {
	// LatestRef gives the first in the list of images scanned by
	// the image repository, when filtered and ordered according
	// to the policy.
	LatestRef *ImageRef `json:"latestRef,omitempty"`
	// ObservedPreviousRef is the observed previous LatestRef. It is used
	// to keep track of the previous and current images.
	// +optional
	ObservedPreviousRef *ImageRef `json:"observedPreviousRef,omitempty"`
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

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

ImagePolicyStatus defines the observed state of ImagePolicy

func (*ImagePolicyStatus) DeepCopy

func (in *ImagePolicyStatus) DeepCopy() *ImagePolicyStatus

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

func (*ImagePolicyStatus) DeepCopyInto

func (in *ImagePolicyStatus) DeepCopyInto(out *ImagePolicyStatus)

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

type ImageRef

type ImageRef struct {
	// Name is the bare image's name.
	// +required
	Name string `json:"name"`
	// Tag is the image's tag.
	// +required
	Tag string `json:"tag"`
	// Digest is the image's digest.
	// +optional
	Digest string `json:"digest,omitempty"`
}

ImageRef represents an image reference.

func (*ImageRef) DeepCopy

func (in *ImageRef) DeepCopy() *ImageRef

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

func (*ImageRef) DeepCopyInto

func (in *ImageRef) DeepCopyInto(out *ImageRef)

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

func (*ImageRef) String

func (in *ImageRef) String() string

type ImageRepository

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

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

ImageRepository is the Schema for the imagerepositories API

func (*ImageRepository) DeepCopy

func (in *ImageRepository) DeepCopy() *ImageRepository

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

func (*ImageRepository) DeepCopyInto

func (in *ImageRepository) DeepCopyInto(out *ImageRepository)

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

func (*ImageRepository) DeepCopyObject

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

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

func (ImageRepository) GetConditions

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

GetConditions returns the status conditions of the object.

func (ImageRepository) GetExclusionList

func (in ImageRepository) GetExclusionList() []string

GetExclusionList returns the exclusion list with default.

func (ImageRepository) GetProvider

func (in ImageRepository) GetProvider() string

GetProvider returns the provider with default.

func (ImageRepository) GetRequeueAfter

func (in ImageRepository) GetRequeueAfter() time.Duration

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

func (ImageRepository) GetTimeout

func (in ImageRepository) GetTimeout() time.Duration

GetTimeout returns the timeout with default.

func (*ImageRepository) SetConditions

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

SetConditions sets the status conditions on the object.

type ImageRepositoryList

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

ImageRepositoryList contains a list of ImageRepository

func (*ImageRepositoryList) DeepCopy

func (in *ImageRepositoryList) DeepCopy() *ImageRepositoryList

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

func (*ImageRepositoryList) DeepCopyInto

func (in *ImageRepositoryList) DeepCopyInto(out *ImageRepositoryList)

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

func (*ImageRepositoryList) DeepCopyObject

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

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

type ImageRepositorySpec

type ImageRepositorySpec struct {
	// Image is the name of the image repository
	// +required
	Image string `json:"image,omitempty"`
	// Interval is the length of time to wait between
	// scans of the image repository.
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m|h))+$"
	// +required
	Interval metav1.Duration `json:"interval,omitempty"`

	// Timeout for image scanning.
	// Defaults to 'Interval' duration.
	// +kubebuilder:validation:Type=string
	// +kubebuilder:validation:Pattern="^([0-9]+(\\.[0-9]+)?(ms|s|m))+$"
	// +optional
	Timeout *metav1.Duration `json:"timeout,omitempty"`

	// SecretRef can be given the name of a secret containing
	// credentials to use for the image registry. The secret should be
	// created with `kubectl create secret docker-registry`, or the
	// equivalent.
	// +optional
	SecretRef *meta.LocalObjectReference `json:"secretRef,omitempty"`

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

	// ServiceAccountName is the name of the Kubernetes ServiceAccount used to authenticate
	// the image pull if the service account has attached pull secrets.
	// +kubebuilder:validation:MaxLength=253
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// CertSecretRef can be given the name of a Secret containing
	// either or both of
	//
	// - a PEM-encoded client certificate (`tls.crt`) and private
	// key (`tls.key`);
	// - a PEM-encoded CA certificate (`ca.crt`)
	//
	// and whichever are supplied, will be used for connecting to the
	// registry. The client cert and key are useful if you are
	// authenticating with a certificate; the CA cert is useful if
	// you are using a self-signed server certificate. The Secret must
	// be of type `Opaque` or `kubernetes.io/tls`.
	//
	// Note: Support for the `caFile`, `certFile` and `keyFile` keys has
	// been deprecated.
	// +optional
	CertSecretRef *meta.LocalObjectReference `json:"certSecretRef,omitempty"`

	// This flag tells the controller to suspend subsequent image scans.
	// It does not apply to already started scans. Defaults to false.
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// AccessFrom defines an ACL for allowing cross-namespace references
	// to the ImageRepository object based on the caller's namespace labels.
	// +optional
	AccessFrom *acl.AccessFrom `json:"accessFrom,omitempty"`

	// ExclusionList is a list of regex strings used to exclude certain tags
	// from being stored in the database.
	// +kubebuilder:default:={"^.*\\.sig$"}
	// +kubebuilder:validation:MaxItems:=25
	// +optional
	ExclusionList []string `json:"exclusionList,omitempty"`

	// The provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'.
	// When not specified, defaults to 'generic'.
	// +kubebuilder:validation:Enum=generic;aws;azure;gcp
	// +kubebuilder:default:=generic
	// +optional
	Provider string `json:"provider,omitempty"`

	// Insecure allows connecting to a non-TLS HTTP container registry.
	// +optional
	Insecure bool `json:"insecure,omitempty"`
}

ImageRepositorySpec defines the parameters for scanning an image repository, e.g., `fluxcd/flux`.

func (*ImageRepositorySpec) DeepCopy

func (in *ImageRepositorySpec) DeepCopy() *ImageRepositorySpec

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

func (*ImageRepositorySpec) DeepCopyInto

func (in *ImageRepositorySpec) DeepCopyInto(out *ImageRepositorySpec)

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

type ImageRepositoryStatus

type ImageRepositoryStatus struct {
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// ObservedGeneration is the last reconciled generation.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// CanonicalName is the name of the image repository with all the
	// implied bits made explicit; e.g., `docker.io/library/alpine`
	// rather than `alpine`.
	// +optional
	CanonicalImageName string `json:"canonicalImageName,omitempty"`

	// LastScanResult contains the number of fetched tags.
	// +optional
	LastScanResult *ScanResult `json:"lastScanResult,omitempty"`

	// ObservedExclusionList is a list of observed exclusion list. It reflects
	// the exclusion rules used for the observed scan result in
	// spec.lastScanResult.
	ObservedExclusionList []string `json:"observedExclusionList,omitempty"`

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

ImageRepositoryStatus defines the observed state of ImageRepository

func (*ImageRepositoryStatus) DeepCopy

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

func (*ImageRepositoryStatus) DeepCopyInto

func (in *ImageRepositoryStatus) DeepCopyInto(out *ImageRepositoryStatus)

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

type NumericalPolicy

type NumericalPolicy struct {
	// Order specifies the sorting order of the tags. Given the integer values
	// from 0 to 9 as tags, ascending order would select 9, and descending order
	// would select 0.
	// +kubebuilder:default:="asc"
	// +kubebuilder:validation:Enum=asc;desc
	// +optional
	Order string `json:"order,omitempty"`
}

NumericalPolicy specifies a numerical ordering policy.

func (*NumericalPolicy) DeepCopy

func (in *NumericalPolicy) DeepCopy() *NumericalPolicy

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

func (*NumericalPolicy) DeepCopyInto

func (in *NumericalPolicy) DeepCopyInto(out *NumericalPolicy)

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

type ReflectionPolicy

type ReflectionPolicy string

ReflectionPolicy describes a policy for if/when to reflect a value from the registry in a certain resource field. +kubebuilder:validation:Enum=Always;IfNotPresent;Never

const (
	// ReflectAlways means that a value is always reflected with the latest value from the registry even if this would
	// overwrite an existing value in the object.
	ReflectAlways ReflectionPolicy = "Always"
	// ReflectIfNotPresent means that the target value is only reflected from the registry if it is empty. It will
	// never be overwritten afterwards, even if it changes in the registry.
	ReflectIfNotPresent ReflectionPolicy = "IfNotPresent"
	// ReflectNever means that no reflection will happen at all.
	ReflectNever ReflectionPolicy = "Never"
)

type ScanResult

type ScanResult struct {
	// Revision is a stable hash of the scanned tags.
	// +optional
	Revision string `json:"revision"`

	// TagCount is the number of tags found in the last scan.
	// +required
	TagCount int `json:"tagCount"`

	// ScanTime is the time when the last scan was performed.
	// +optional
	ScanTime metav1.Time `json:"scanTime"`

	// LatestTags is a small sample of the tags found in the last scan.
	// It's the first 10 tags when sorting all the tags in descending
	// alphabetical order.
	// +optional
	LatestTags []string `json:"latestTags,omitempty"`
}

ScanResult contains information about the last scan of the image repository. TODO: Make all fields except for LatestTags required in v1.

func (*ScanResult) DeepCopy

func (in *ScanResult) DeepCopy() *ScanResult

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

func (*ScanResult) DeepCopyInto

func (in *ScanResult) DeepCopyInto(out *ScanResult)

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

type SemVerPolicy

type SemVerPolicy struct {
	// Range gives a semver range for the image tag; the highest
	// version within the range that's a tag yields the latest image.
	// +required
	Range string `json:"range"`
}

SemVerPolicy specifies a semantic version policy.

func (*SemVerPolicy) DeepCopy

func (in *SemVerPolicy) DeepCopy() *SemVerPolicy

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

func (*SemVerPolicy) DeepCopyInto

func (in *SemVerPolicy) DeepCopyInto(out *SemVerPolicy)

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

type TagFilter

type TagFilter struct {
	// Pattern specifies a regular expression pattern used to filter for image
	// tags.
	// +optional
	Pattern string `json:"pattern"`
	// Extract allows a capture group to be extracted from the specified regular
	// expression pattern, useful before tag evaluation.
	// +optional
	Extract string `json:"extract"`
}

TagFilter enables filtering tags based on a set of defined rules

func (*TagFilter) DeepCopy

func (in *TagFilter) DeepCopy() *TagFilter

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

func (*TagFilter) DeepCopyInto

func (in *TagFilter) DeepCopyInto(out *TagFilter)

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

Jump to

Keyboard shortcuts

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