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