Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1beta1/bucket_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ type BucketSpec struct {
// consult the documentation for your version to find out what those are.
// +optional
Ignore *string `json:"ignore,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}

const (
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/gitrepository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ type GitRepositorySpec struct {
// consult the documentation for your version to find out what those are.
// +optional
Ignore *string `json:"ignore,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}

// GitRepositoryRef defines the Git ref used for pull and checkout operations.
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/helmchart_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type HelmChartSpec struct {
// relative path in the SourceRef. Ignored when omitted.
// +optional
ValuesFile string `json:"valuesFile,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}

// LocalHelmChartSourceReference contains enough information to let you locate
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/helmrepository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ type HelmRepositorySpec struct {
// +kubebuilder:default:="60s"
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}

// HelmRepositoryStatus defines the observed state of the HelmRepository.
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/source.toolkit.fluxcd.io_buckets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ spec:
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
suspend:
description: This flag tells the controller to suspend the reconciliation
of this source.
type: boolean
timeout:
default: 20s
description: The timeout for download operations, defaults to 20s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ spec:
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
suspend:
description: This flag tells the controller to suspend the reconciliation
of this source.
type: boolean
timeout:
default: 20s
description: The timeout for remote Git operations like cloning, defaults
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/source.toolkit.fluxcd.io_helmcharts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ spec:
- kind
- name
type: object
suspend:
description: This flag tells the controller to suspend the reconciliation
of this source.
type: boolean
valuesFile:
description: Alternative values file to use as the default chart values,
expected to be a relative path in the SourceRef. Ignored when omitted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ spec:
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
suspend:
description: This flag tells the controller to suspend the reconciliation
of this source.
type: boolean
timeout:
default: 60s
description: The timeout of index downloading, defaults to 60s.
Expand Down
6 changes: 6 additions & 0 deletions controllers/bucket_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func (r *BucketReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.reconcileDelete(ctx, bucket)
}

// Return early if the object is suspended.
if bucket.Spec.Suspend {
log.Info("Reconciliation is suspended for this object")
return ctrl.Result{}, nil
}

// record reconciliation duration
if r.MetricsRecorder != nil {
objRef, err := reference.GetReference(r.Scheme, &bucket)
Expand Down
6 changes: 6 additions & 0 deletions controllers/gitrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ func (r *GitRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
return r.reconcileDelete(ctx, repository)
}

// Return early if the object is suspended.
if repository.Spec.Suspend {
log.Info("Reconciliation is suspended for this object")
return ctrl.Result{}, nil
}

// record reconciliation duration
if r.MetricsRecorder != nil {
objRef, err := reference.GetReference(r.Scheme, &repository)
Expand Down
6 changes: 6 additions & 0 deletions controllers/helmchart_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ func (r *HelmChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
return r.reconcileDelete(ctx, chart)
}

// Return early if the object is suspended.
if chart.Spec.Suspend {
log.Info("Reconciliation is suspended for this object")
return ctrl.Result{}, nil
}

// Record reconciliation duration
if r.MetricsRecorder != nil {
objRef, err := reference.GetReference(r.Scheme, &chart)
Expand Down
6 changes: 6 additions & 0 deletions controllers/helmrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func (r *HelmRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, err
return r.reconcileDelete(ctx, repository)
}

// Return early if the object is suspended.
if repository.Spec.Suspend {
log.Info("Reconciliation is suspended for this object")
return ctrl.Result{}, nil
}

// record reconciliation duration
if r.MetricsRecorder != nil {
objRef, err := reference.GetReference(r.Scheme, &repository)
Expand Down
96 changes: 96 additions & 0 deletions docs/api/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ string
consult the documentation for your version to find out what those are.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</table>
</td>
</tr>
Expand Down Expand Up @@ -363,6 +375,18 @@ string
consult the documentation for your version to find out what those are.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</table>
</td>
</tr>
Expand Down Expand Up @@ -502,6 +526,18 @@ string
relative path in the SourceRef. Ignored when omitted.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</table>
</td>
</tr>
Expand Down Expand Up @@ -635,6 +671,18 @@ Kubernetes meta/v1.Duration
<p>The timeout of index downloading, defaults to 60s.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</table>
</td>
</tr>
Expand Down Expand Up @@ -871,6 +919,18 @@ string
consult the documentation for your version to find out what those are.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -1148,6 +1208,18 @@ string
consult the documentation for your version to find out what those are.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -1366,6 +1438,18 @@ string
relative path in the SourceRef. Ignored when omitted.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -1532,6 +1616,18 @@ Kubernetes meta/v1.Duration
<p>The timeout of index downloading, defaults to 60s.</p>
</td>
</tr>
<tr>
<td>
<code>suspend</code><br>
<em>
bool
</em>
</td>
<td>
<em>(Optional)</em>
<p>This flag tells the controller to suspend the reconciliation of this source.</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
4 changes: 4 additions & 0 deletions docs/spec/v1beta1/buckets.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type BucketSpec struct {
// consult the documentation for your version to find out what those are.
// +optional
Ignore *string `json:"ignore,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}
```

Expand Down
6 changes: 4 additions & 2 deletions docs/spec/v1beta1/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Common defines resources used across all source types.

### Source interface

Source objects should adhere to the `Source` interface. This interface exposes the [interval](#source-synchronization)
Source objects adhere to the `Source` interface. This interface exposes the [interval](#source-reconciliation)
and [artifact](#source-status) of the source to clients without the prerequisite of knowing the source kind:

````go
Expand All @@ -21,7 +21,7 @@ type Source interface {

### Source reconciliation

Source objects should contain a `spec.interval` field that tells the controller at which interval to check for updates:
Source objects contain a `spec.interval` field that tells the controller at which interval to check for updates:

```go
type SourceSpec struct {
Expand All @@ -39,6 +39,8 @@ The controller can be told to check for updates right away by setting an annotat
kubectl annotate --overwrite gitrepository/podinfo fluxcd.io/reconcileAt="$(date +%s)"
```

The source objects reconciliation can be suspended by setting `spec.suspend` to `true`.

### Source status

Source objects should contain a status sub-resource that embeds an artifact object:
Expand Down
4 changes: 4 additions & 0 deletions docs/spec/v1beta1/gitrepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ type GitRepositorySpec struct {
// consult the documentation for your version to find out what those are.
// +optional
Ignore *string `json:"ignore,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}
```

Expand Down
4 changes: 4 additions & 0 deletions docs/spec/v1beta1/helmcharts.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type HelmChartSpec struct {
// relative path in the SourceRef. Ignored when omitted.
// +optional
ValuesFile string `json:"valuesFile,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}
```

Expand Down
4 changes: 4 additions & 0 deletions docs/spec/v1beta1/helmrepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ type HelmRepositorySpec struct {
// The timeout of index downloading, defaults to 60s.
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`

// This flag tells the controller to suspend the reconciliation of this source.
// +optional
Suspend bool `json:"suspend,omitempty"`
}
```

Expand Down