@@ -30,6 +30,7 @@ import (
30
30
"k8s.io/client-go/util/retry"
31
31
"sigs.k8s.io/controller-runtime/pkg/client"
32
32
33
+ helmv2 "github.com/fluxcd/helm-controller/api/v2beta1"
33
34
notificationv1 "github.com/fluxcd/notification-controller/api/v1"
34
35
notificationv1b2 "github.com/fluxcd/notification-controller/api/v1beta2"
35
36
"github.com/fluxcd/pkg/apis/meta"
@@ -163,14 +164,26 @@ func requestReconciliation(ctx context.Context, kubeClient client.Client,
163
164
return err
164
165
}
165
166
patch := client .MergeFrom (object .DeepCopy ())
166
- if ann := object .GetAnnotations (); ann == nil {
167
- object .SetAnnotations (map [string ]string {
168
- meta .ReconcileRequestAnnotation : time .Now ().Format (time .RFC3339Nano ),
169
- })
170
- } else {
171
- ann [meta .ReconcileRequestAnnotation ] = time .Now ().Format (time .RFC3339Nano )
172
- object .SetAnnotations (ann )
167
+
168
+ // Add a timestamp annotation to trigger a reconciliation.
169
+ ts := time .Now ().Format (time .RFC3339Nano )
170
+ annotations := object .GetAnnotations ()
171
+ if annotations == nil {
172
+ annotations = make (map [string ]string , 1 )
173
+ }
174
+ annotations [meta .ReconcileRequestAnnotation ] = ts
175
+
176
+ // HelmRelease specific annotations to force or reset a release.
177
+ if gvk .Kind == helmv2 .HelmReleaseKind {
178
+ if rhrArgs .syncForce {
179
+ annotations ["reconcile.fluxcd.io/forceAt" ] = ts
180
+ }
181
+ if rhrArgs .syncReset {
182
+ annotations ["reconcile.fluxcd.io/resetAt" ] = ts
183
+ }
173
184
}
185
+
186
+ object .SetAnnotations (annotations )
174
187
return kubeClient .Patch (ctx , object , patch )
175
188
})
176
189
}
0 commit comments