Add source interface spec

This commit is contained in:
Hidde Beydals 2020-04-14 11:07:06 +02:00 committed by stefanprodan
parent e002278e35
commit e0eb330d42
1 changed files with 15 additions and 0 deletions

View File

@ -4,6 +4,21 @@ Common defines resources used across all source types.
## Specification ## Specification
### Source interface
Source objects should adhere to the `Source` interface. This interface exposes the [interval](#source-synchronization)
and [artifact](#source-status) of the source to clients without the prerequisite of knowing the source kind:
````go
type Source interface {
// GetInterval returns the interval at which the source is updated.
GetInterval() metav1.Duration
// GetArtifact returns the latest artifact from the source, or nil.
GetArtifact() *Artifact
}
````
### Source synchronization ### Source synchronization
Source objects should contain a `spec.interval` field that tells the controller at which interval to check for updates: Source objects should contain a `spec.interval` field that tells the controller at which interval to check for updates: