Skip to content

Commit

Permalink
Merge pull request fluxcd#86 from fluxcd/reconcile-annotation
Browse files Browse the repository at this point in the history
Rename syncAt annotation to reconcileAt
  • Loading branch information
stefanprodan committed Jul 13, 2020
2 parents dd9563b + b3e58b4 commit 315c2d7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
5 changes: 3 additions & 2 deletions api/v1alpha1/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Source interface {
}

const (
// SyncAtAnnotation is the timestamp corresponding to an on-demand source sync.
SyncAtAnnotation string = "source.fluxcd.io/syncAt"
// ReconcileAtAnnotation is the annotation used for triggering a
// reconciliation outside of the defined schedule.
ReconcileAtAnnotation string = "fluxcd.io/reconcileAt"
)
2 changes: 0 additions & 2 deletions config/samples/source_v1alpha1_gitrepository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: GitRepository
metadata:
name: gitrepository-sample
annotations:
source.fluxcd.io/syncAt: "2020-04-06T15:39:52+03:00"
spec:
interval: 1m
url: https://github.com/stefanprodan/podinfo
Expand Down
4 changes: 2 additions & 2 deletions controllers/predicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func (SourceChangePredicate) Update(e event.UpdateEvent) bool {
}

// handle force sync
if val, ok := e.MetaNew.GetAnnotations()[sourcev1.SyncAtAnnotation]; ok {
if valOld, okOld := e.MetaOld.GetAnnotations()[sourcev1.SyncAtAnnotation]; okOld {
if val, ok := e.MetaNew.GetAnnotations()[sourcev1.ReconcileAtAnnotation]; ok {
if valOld, okOld := e.MetaOld.GetAnnotations()[sourcev1.ReconcileAtAnnotation]; okOld {
if val != valOld {
return true
}
Expand Down
11 changes: 6 additions & 5 deletions docs/spec/v1alpha1/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Source interface {
}
````

### Source synchronization
### Source reconciliation

Source objects should contain a `spec.interval` field that tells the controller at which interval to check for updates:

Expand All @@ -37,15 +37,16 @@ The controller can be told to check for updates right away by setting an annotat

```go
const (
// SyncAtAnnotation is the timestamp corresponding to an on-demand source sync.
SyncAtAnnotation string = "source.fluxcd.io/syncAt"
// ReconcileAtAnnotation is the annotation used for triggering a
// reconciliation outside of the defined schedule.
ReconcileAtAnnotation string = "fluxcd.io/reconcileAt"
)
```

Trigger source sync example:
Trigger source reconciliation example:

```bash
kubectl annotate --overwrite gitrepository/podinfo source.fluxcd.io/syncAt="$(date +%s)"
kubectl annotate --overwrite gitrepository/podinfo fluxcd.io/reconcileAt="$(date +%s)"
```

### Source status
Expand Down
5 changes: 0 additions & 5 deletions docs/spec/v1alpha1/helmcharts.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: HelmChart
metadata:
name: redis
namespace: default
annotations:
# force sync trigger
source.fluxcd.io/syncAt: "2020-04-06T15:39:52+03:00"
spec:
name: redis
version: 10.5.7
Expand All @@ -92,7 +88,6 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: HelmChart
metadata:
name: redis
namespace: default
spec:
name: redis
version: ^10.0.0
Expand Down
2 changes: 0 additions & 2 deletions docs/spec/v1alpha1/helmrepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: HelmRepository
metadata:
name: stable
namespace: default
spec:
url: https://kubernetes-charts.storage.googleapis.com/
interval: 10m
Expand All @@ -84,7 +83,6 @@ apiVersion: source.fluxcd.io/v1alpha1
kind: HelmRepository
metadata:
name: private
namespace: default
spec:
url: https://charts.example.com
secretRef:
Expand Down

0 comments on commit 315c2d7

Please sign in to comment.