Skip to content

Commit 5579dc8

Browse files
committed
Implement source suspension
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 07d09e2 commit 5579dc8

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed

controllers/bucket_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ func (r *BucketReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
9090
return r.reconcileDelete(ctx, bucket)
9191
}
9292

93+
// Return early if the object is suspended.
94+
if bucket.Spec.Suspend {
95+
log.Info("Reconciliation is suspended for this object")
96+
return ctrl.Result{}, nil
97+
}
98+
9399
// record reconciliation duration
94100
if r.MetricsRecorder != nil {
95101
objRef, err := reference.GetReference(r.Scheme, &bucket)

controllers/gitrepository_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ func (r *GitRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
8989
return r.reconcileDelete(ctx, repository)
9090
}
9191

92+
// Return early if the object is suspended.
93+
if repository.Spec.Suspend {
94+
log.Info("Reconciliation is suspended for this object")
95+
return ctrl.Result{}, nil
96+
}
97+
9298
// record reconciliation duration
9399
if r.MetricsRecorder != nil {
94100
objRef, err := reference.GetReference(r.Scheme, &repository)

controllers/helmchart_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ func (r *HelmChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
9595
return r.reconcileDelete(ctx, chart)
9696
}
9797

98+
// Return early if the object is suspended.
99+
if chart.Spec.Suspend {
100+
log.Info("Reconciliation is suspended for this object")
101+
return ctrl.Result{}, nil
102+
}
103+
98104
// Record reconciliation duration
99105
if r.MetricsRecorder != nil {
100106
objRef, err := reference.GetReference(r.Scheme, &chart)

controllers/helmrepository_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ func (r *HelmRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
9090
return r.reconcileDelete(ctx, repository)
9191
}
9292

93+
// Return early if the object is suspended.
94+
if repository.Spec.Suspend {
95+
log.Info("Reconciliation is suspended for this object")
96+
return ctrl.Result{}, nil
97+
}
98+
9399
// record reconciliation duration
94100
if r.MetricsRecorder != nil {
95101
objRef, err := reference.GetReference(r.Scheme, &repository)

docs/api/source.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,18 @@ string
188188
consult the documentation for your version to find out what those are.</p>
189189
</td>
190190
</tr>
191+
<tr>
192+
<td>
193+
<code>suspend</code><br>
194+
<em>
195+
bool
196+
</em>
197+
</td>
198+
<td>
199+
<em>(Optional)</em>
200+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
201+
</td>
202+
</tr>
191203
</table>
192204
</td>
193205
</tr>
@@ -363,6 +375,18 @@ string
363375
consult the documentation for your version to find out what those are.</p>
364376
</td>
365377
</tr>
378+
<tr>
379+
<td>
380+
<code>suspend</code><br>
381+
<em>
382+
bool
383+
</em>
384+
</td>
385+
<td>
386+
<em>(Optional)</em>
387+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
388+
</td>
389+
</tr>
366390
</table>
367391
</td>
368392
</tr>
@@ -502,6 +526,18 @@ string
502526
relative path in the SourceRef. Ignored when omitted.</p>
503527
</td>
504528
</tr>
529+
<tr>
530+
<td>
531+
<code>suspend</code><br>
532+
<em>
533+
bool
534+
</em>
535+
</td>
536+
<td>
537+
<em>(Optional)</em>
538+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
539+
</td>
540+
</tr>
505541
</table>
506542
</td>
507543
</tr>
@@ -635,6 +671,18 @@ Kubernetes meta/v1.Duration
635671
<p>The timeout of index downloading, defaults to 60s.</p>
636672
</td>
637673
</tr>
674+
<tr>
675+
<td>
676+
<code>suspend</code><br>
677+
<em>
678+
bool
679+
</em>
680+
</td>
681+
<td>
682+
<em>(Optional)</em>
683+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
684+
</td>
685+
</tr>
638686
</table>
639687
</td>
640688
</tr>
@@ -871,6 +919,18 @@ string
871919
consult the documentation for your version to find out what those are.</p>
872920
</td>
873921
</tr>
922+
<tr>
923+
<td>
924+
<code>suspend</code><br>
925+
<em>
926+
bool
927+
</em>
928+
</td>
929+
<td>
930+
<em>(Optional)</em>
931+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
932+
</td>
933+
</tr>
874934
</tbody>
875935
</table>
876936
</div>
@@ -1148,6 +1208,18 @@ string
11481208
consult the documentation for your version to find out what those are.</p>
11491209
</td>
11501210
</tr>
1211+
<tr>
1212+
<td>
1213+
<code>suspend</code><br>
1214+
<em>
1215+
bool
1216+
</em>
1217+
</td>
1218+
<td>
1219+
<em>(Optional)</em>
1220+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
1221+
</td>
1222+
</tr>
11511223
</tbody>
11521224
</table>
11531225
</div>
@@ -1366,6 +1438,18 @@ string
13661438
relative path in the SourceRef. Ignored when omitted.</p>
13671439
</td>
13681440
</tr>
1441+
<tr>
1442+
<td>
1443+
<code>suspend</code><br>
1444+
<em>
1445+
bool
1446+
</em>
1447+
</td>
1448+
<td>
1449+
<em>(Optional)</em>
1450+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
1451+
</td>
1452+
</tr>
13691453
</tbody>
13701454
</table>
13711455
</div>
@@ -1532,6 +1616,18 @@ Kubernetes meta/v1.Duration
15321616
<p>The timeout of index downloading, defaults to 60s.</p>
15331617
</td>
15341618
</tr>
1619+
<tr>
1620+
<td>
1621+
<code>suspend</code><br>
1622+
<em>
1623+
bool
1624+
</em>
1625+
</td>
1626+
<td>
1627+
<em>(Optional)</em>
1628+
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
1629+
</td>
1630+
</tr>
15351631
</tbody>
15361632
</table>
15371633
</div>

0 commit comments

Comments
 (0)