Skip to content

Commit 5f4f360

Browse files
authored
Merge pull request #1886 from fluxcd/ea-conform-source
api: Make ExternalArtifact conform to the Source interface
2 parents cf72221 + 4880652 commit 5f4f360

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

api/v1/externalartifact_types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
"time"
21+
2022
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2123

2224
"github.com/fluxcd/pkg/apis/meta"
2325
)
2426

27+
// ExternalArtifactKind is the string representation of the ExternalArtifact.
28+
const ExternalArtifactKind = "ExternalArtifact"
29+
2530
// ExternalArtifactSpec defines the desired state of ExternalArtifact
2631
type ExternalArtifactSpec struct {
2732
// SourceRef points to the Kubernetes custom resource for
@@ -41,6 +46,18 @@ type ExternalArtifactStatus struct {
4146
Conditions []metav1.Condition `json:"conditions,omitempty"`
4247
}
4348

49+
// GetRequeueAfter returns the duration after which the ExternalArtifact
50+
// must be reconciled again.
51+
func (in ExternalArtifact) GetRequeueAfter() time.Duration {
52+
return time.Minute
53+
}
54+
55+
// GetArtifact returns the latest Artifact from the ExternalArtifact if
56+
// present in the status sub-resource.
57+
func (in *ExternalArtifact) GetArtifact() *meta.Artifact {
58+
return in.Status.Artifact
59+
}
60+
4461
// +kubebuilder:object:root=true
4562
// +kubebuilder:subresource:status
4663
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description=""

0 commit comments

Comments
 (0)