Add source synchronization to common spec

This commit is contained in:
stefanprodan 2020-04-13 13:14:42 +03:00
parent 44a5f21f3b
commit 6baaa34b0a
1 changed files with 30 additions and 1 deletions

View File

@ -1,9 +1,38 @@
# Common
Common defines resources used across types.
Common defines resources used across all source types.
## Specification
### Source synchronization
Source objects should contain a `spec.interval` field that tells the controller at which interval to check for updates:
```go
type SourceSpec struct {
// The interval at which to check for source updates.
// +required
Interval metav1.Duration `json:"interval"`
}
```
Valid time units are `s`, `m` and `h` e.g. `interval: 5m`.
The controller can be told to check for updates right away by setting an annotation on source objects:
```go
const (
// ForceSyncAnnotation is the timestamp corresponding to an on-demand source sync.
ForceSyncAnnotation string = "source.fluxcd.io/syncAt"
)
```
Force sync example:
```bash
kubectl annotate --overwrite gitrepository/podinfo source.fluxcd.io/syncAt="$(date +%s)"
```
### Source status
Source objects should contain a status sub-resource that embeds an artifact object: