api: Make ExternalArtifact conform to the Source interface

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan 2025-09-04 22:05:04 +03:00
parent cf7222108c
commit 48806528b7
No known key found for this signature in database
GPG Key ID: 3299AEB0E4085BAF
1 changed files with 17 additions and 0 deletions

View File

@ -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=""