From 48806528b77f291c732de85ce12254d04f345d27 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Thu, 4 Sep 2025 22:05:04 +0300 Subject: [PATCH] api: Make ExternalArtifact conform to the Source interface Signed-off-by: Stefan Prodan --- api/v1/externalartifact_types.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/api/v1/externalartifact_types.go b/api/v1/externalartifact_types.go index 4ae45308..a26d4df3 100644 --- a/api/v1/externalartifact_types.go +++ b/api/v1/externalartifact_types.go @@ -17,11 +17,16 @@ limitations under the License. package v1 import ( + "time" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/fluxcd/pkg/apis/meta" ) +// ExternalArtifactKind is the string representation of the ExternalArtifact. +const ExternalArtifactKind = "ExternalArtifact" + // ExternalArtifactSpec defines the desired state of ExternalArtifact type ExternalArtifactSpec struct { // SourceRef points to the Kubernetes custom resource for @@ -41,6 +46,18 @@ type ExternalArtifactStatus struct { Conditions []metav1.Condition `json:"conditions,omitempty"` } +// GetRequeueAfter returns the duration after which the ExternalArtifact +// must be reconciled again. +func (in ExternalArtifact) GetRequeueAfter() time.Duration { + return time.Minute +} + +// GetArtifact returns the latest Artifact from the ExternalArtifact if +// present in the status sub-resource. +func (in *ExternalArtifact) GetArtifact() *meta.Artifact { + return in.Status.Artifact +} + // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description=""