Skip to content

Commit 9c6c1a8

Browse files
authored
Merge pull request #210 from fluxcd/reconcile-request-status
Add LastHandledReconcileAt to source statuses
2 parents 5533469 + 0b45862 commit 9c6c1a8

19 files changed

+147
-7
lines changed

api/v1beta1/bucket_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ type BucketStatus struct {
9595
// Artifact represents the output of the last successful Bucket sync.
9696
// +optional
9797
Artifact *Artifact `json:"artifact,omitempty"`
98+
99+
meta.ReconcileRequestStatus `json:",inline"`
98100
}
99101

100102
const (

api/v1beta1/gitrepository_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ type GitRepositoryStatus struct {
116116
// Artifact represents the output of the last successful repository sync.
117117
// +optional
118118
Artifact *Artifact `json:"artifact,omitempty"`
119+
120+
meta.ReconcileRequestStatus `json:",inline"`
119121
}
120122

121123
const (

api/v1beta1/helmchart_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ type HelmChartStatus struct {
8686
// Artifact represents the output of the last successful chart sync.
8787
// +optional
8888
Artifact *Artifact `json:"artifact,omitempty"`
89+
90+
meta.ReconcileRequestStatus `json:",inline"`
8991
}
9092

9193
const (

api/v1beta1/helmrepository_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ type HelmRepositoryStatus struct {
7373
// Artifact represents the output of the last successful repository sync.
7474
// +optional
7575
Artifact *Artifact `json:"artifact,omitempty"`
76+
77+
meta.ReconcileRequestStatus `json:",inline"`
7678
}
7779

7880
const (

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/source.toolkit.fluxcd.io_buckets.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ spec:
196196
- type
197197
type: object
198198
type: array
199+
lastHandledReconcileAt:
200+
description: LastHandledReconcileAt holds the value of the most recent
201+
reconcile request value, so a change can be detected.
202+
type: string
199203
observedGeneration:
200204
description: ObservedGeneration is the last observed generation.
201205
format: int64

config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ spec:
224224
- type
225225
type: object
226226
type: array
227+
lastHandledReconcileAt:
228+
description: LastHandledReconcileAt holds the value of the most recent
229+
reconcile request value, so a change can be detected.
230+
type: string
227231
observedGeneration:
228232
description: ObservedGeneration is the last observed generation.
229233
format: int64

config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ spec:
200200
- type
201201
type: object
202202
type: array
203+
lastHandledReconcileAt:
204+
description: LastHandledReconcileAt holds the value of the most recent
205+
reconcile request value, so a change can be detected.
206+
type: string
203207
observedGeneration:
204208
description: ObservedGeneration is the last observed generation.
205209
format: int64

config/crd/bases/source.toolkit.fluxcd.io_helmrepositories.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ spec:
175175
- type
176176
type: object
177177
type: array
178+
lastHandledReconcileAt:
179+
description: LastHandledReconcileAt holds the value of the most recent
180+
reconcile request value, so a change can be detected.
181+
type: string
178182
observedGeneration:
179183
description: ObservedGeneration is the last observed generation.
180184
format: int64

controllers/bucket_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ func (r *BucketReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
109109
r.recordReadiness(bucket)
110110
}
111111

112+
// record the value of the reconciliation request, if any
113+
// TODO(hidde): would be better to defer this in combination with
114+
// always patching the status sub-resource after a reconciliation.
115+
if v, ok := meta.ReconcileAnnotationValue(bucket.GetAnnotations()); ok {
116+
bucket.Status.SetLastHandledReconcileRequest(v)
117+
}
118+
112119
// purge old artifacts from storage
113120
if err := r.gc(bucket); err != nil {
114121
log.Error(err, "unable to purge old artifacts")

0 commit comments

Comments
 (0)