Skip to content

Commit 44607b6

Browse files
authored
Merge pull request #1578 from fluxcd/wait-job-ttl
Handle Jobs with TTL in health checks
2 parents 51d1b0a + 299e88a commit 44607b6

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/fluxcd/pkg/http/fetch v0.22.0
3030
github.com/fluxcd/pkg/kustomize v1.25.0
3131
github.com/fluxcd/pkg/runtime v0.97.0
32-
github.com/fluxcd/pkg/ssa v0.65.0
32+
github.com/fluxcd/pkg/ssa v0.66.0
3333
github.com/fluxcd/pkg/tar v0.17.0
3434
github.com/fluxcd/pkg/testserver v0.13.0
3535
github.com/fluxcd/source-controller/api v1.7.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ github.com/fluxcd/pkg/runtime v0.97.0 h1:NZ9ZL2RE6J4yNDHI7ZNmL/OnCsDWurzVIvws73F
214214
github.com/fluxcd/pkg/runtime v0.97.0/go.mod h1:FyjNMFNAERkCsF/muTWJYU9MZOsq/m4Sc4aQk/EgQ9E=
215215
github.com/fluxcd/pkg/sourceignore v0.16.0 h1:28+IBmNM1rGNQysiAZXyilFMgS0kno/aJM4zSPgqu2A=
216216
github.com/fluxcd/pkg/sourceignore v0.16.0/go.mod h1:Enjrk4gdk8t9VEp0dU3OHvMiS5ZHafZiL4H/FGNluh0=
217-
github.com/fluxcd/pkg/ssa v0.65.0 h1:pvPYmBmfqS0sRNoi4/IUoocBbglYuD/OJLgOuxMJ9+o=
218-
github.com/fluxcd/pkg/ssa v0.65.0/go.mod h1:RjvVjJIoRo1ecsv91yMuiqzO6cpNag80M6MOB/vrJdc=
217+
github.com/fluxcd/pkg/ssa v0.66.0 h1:CYbCTuws8Sn1xAaOFNz92yS2iS5YBqJgd+DrzmRxfaQ=
218+
github.com/fluxcd/pkg/ssa v0.66.0/go.mod h1:RjvVjJIoRo1ecsv91yMuiqzO6cpNag80M6MOB/vrJdc=
219219
github.com/fluxcd/pkg/tar v0.17.0 h1:uNxbFXy8ly8C7fJ8D7w3rjTNJFrb4Hp1aY/30XkfvxY=
220220
github.com/fluxcd/pkg/tar v0.17.0/go.mod h1:b1xyIRYDD0ket4SV5u0UXYv+ZdN/O/HmIO5jZQdHQls=
221221
github.com/fluxcd/pkg/testserver v0.13.0 h1:xEpBcEYtD7bwvZ+i0ZmChxKkDo/wfQEV3xmnzVybSSg=

internal/controller/kustomization_controller.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ func (r *KustomizationReconciler) reconcile(
517517
originRevision,
518518
isNewRevision,
519519
drifted,
520-
changeSet.ToObjMetadataSet()); err != nil {
520+
changeSet.ToObjMetadataSet(),
521+
ssautil.ExtractJobsWithTTL(objects)); err != nil {
521522

522523
if errors.Is(err, &runtimeCtrl.QueueEventSource{}) {
523524
return err
@@ -967,7 +968,8 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
967968
originRevision string,
968969
isNewRevision bool,
969970
drifted bool,
970-
objects object.ObjMetadataSet) error {
971+
objects object.ObjMetadataSet,
972+
jobsWithTTL object.ObjMetadataSet) error {
971973
if len(obj.Spec.HealthChecks) == 0 && !obj.Spec.Wait {
972974
conditions.Delete(obj, meta.HealthyCondition)
973975
return nil
@@ -1012,9 +1014,10 @@ func (r *KustomizationReconciler) checkHealth(ctx context.Context,
10121014
// Check the health with a default timeout of 30sec shorter than the reconciliation interval.
10131015
healthCtx := runtimeCtrl.GetInterruptContext(ctx)
10141016
if err := manager.WaitForSetWithContext(healthCtx, toCheck, ssa.WaitOptions{
1015-
Interval: 5 * time.Second,
1016-
Timeout: obj.GetTimeout(),
1017-
FailFast: r.FailFast,
1017+
Interval: 5 * time.Second,
1018+
Timeout: obj.GetTimeout(),
1019+
FailFast: r.FailFast,
1020+
JobsWithTTL: jobsWithTTL,
10181021
}); err != nil {
10191022
if is, err := runtimeCtrl.IsObjectEnqueued(ctx); is {
10201023
return err

0 commit comments

Comments
 (0)