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
41 changes: 41 additions & 0 deletions content/master/composition/composite-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,47 @@ spec:
# Removed for brevity
```

### Per-resource poll interval

The {{<hover label="xr-poll-interval" line="7">}}crossplane.io/poll-interval{{</hover>}}
annotation overrides the default `--poll-interval` for a specific
composite resource. The annotation accepts any valid Go duration string.

```yaml {label="xr-poll-interval",copy-lines="none"}
apiVersion: example.org/v1alpha1
kind: MyDatabase
metadata:
namespace: default
name: my-composite-resource
annotations:
crossplane.io/poll-interval: "24h"
spec:
# Removed for brevity
```

Read the [managed resource poll interval annotation]({{<ref "../managed-resources/managed-resources#poll-interval">}}) for more details on behavior and validation.

### Triggering immediate reconciliation

The {{<hover label="xr-reconcile-request" line="7">}}crossplane.io/reconcile-requested-at{{</hover>}}
annotation triggers an immediate reconciliation when its value changes. Set the
annotation to any value, such as a timestamp, to trigger a reconciliation.

```yaml {label="xr-reconcile-request",copy-lines="none"}
apiVersion: example.org/v1alpha1
kind: MyDatabase
metadata:
namespace: default
name: my-composite-resource
annotations:
crossplane.io/reconcile-requested-at: "2024-01-15T10:30:00Z"
spec:
# Removed for brevity
```

The reconciler records the handled token in `status.lastHandledReconcileAt`.
Read the [managed resource reconcile request annotation]({{<ref "../managed-resources/managed-resources#reconcile-request">}}) for more details.

## Verify composite resources
Use
{{<hover label="getcomposite" line="1">}}kubectl get composite{{</hover>}}
Expand Down
9 changes: 9 additions & 0 deletions content/master/guides/pods.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ their `spec`. Managed resources rely on polling to detect changes in the
external system.
{{< /hint >}}

{{< hint "tip" >}}
To override the poll interval for a specific resource instead of changing the
global setting, use the `crossplane.io/poll-interval` annotation. To trigger an
immediate reconciliation, use the `crossplane.io/reconcile-requested-at`
annotation. Read the
[managed resource annotations]({{<ref "../managed-resources/managed-resources#poll-interval">}})
documentation for details.
{{< /hint >}}

Crossplane double-checks all resources to
confirm they're in the desired state. Crossplane does this every one hour by
default. Use the `--sync-interval` Crossplane pod argument to change this
Expand Down
77 changes: 77 additions & 0 deletions content/master/managed-resources/managed-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ resources.
| `crossplane.io/external-create-succeeded` | The timestamp of when the Provider successfully created the managed resource. |
| `crossplane.io/external-create-failed` | The timestamp of when the Provider failed to create the managed resource. |
| `crossplane.io/paused` | Indicates Crossplane isn't reconciling this resource. Read the [Pause Annotation](#paused) for more details. |
| `crossplane.io/poll-interval` | Overrides the default poll interval for this resource. Read the [Poll Interval Annotation](#poll-interval) for more details. |
| `crossplane.io/reconcile-requested-at` | Triggers an immediate reconciliation when its value changes. Read the [Reconcile Request Annotation](#reconcile-request) for more details. |
{{</table >}}

### Naming external resources
Expand Down Expand Up @@ -746,6 +748,81 @@ Read
for more details.
{{< /hint >}}

### Poll interval

The {{<hover label="poll-interval" line="7">}}crossplane.io/poll-interval{{</hover>}}
annotation overrides the default `--poll-interval` for a specific
managed resource. Use the annotation when some resources need frequent drift
detection while others are stable and don't need frequent API calls.

The annotation accepts any valid Go duration string, for example `30m`, `1h`,
or `24h`.

```yaml {label="poll-interval",copy-lines="none"}
apiVersion: rds.aws.m.upbound.io/v1beta1
kind: Instance
metadata:
namespace: default
name: my-rds-instance
annotations:
crossplane.io/poll-interval: "24h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiousity, for this to work on MRs, is it correct that the provider will need to have updated their crossplane-runtime dependency to v2.3.0? anything else that is required on the provider side after that, or will it work automatically after bumping crossplane-runtime?

is it worth adding a note in this section on this so users can understand this requirement?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll second this question. It's called out in the rc.1 release notes, but if someone upgrades without catching this, or starts using crossplane before the providers update and release new versions (which could be a long tail, hopefully not), it could cause some confusion. I think this will be a popular feature.

I don't recall seeing callouts in the crossplane docs on which release introduced a specific feature, as some other project docs do. If this was added, it could provide the opportunity to note this additional requirement. Bonus points for figuring out how to clearly and concisely communicate how to tell when a provider supports it.

spec:
forProvider:
region: us-west-1
instanceType: t2.micro
```

{{< hint "note" >}}
Crossplane ignores values that aren't valid Go durations and falls back to
the controller default. The controller raises any value below the
`--min-poll-interval` flag (defaults to `1s`) to the configured minimum.
{{< /hint >}}

Remove the annotation to return to the default `--poll-interval`.

### Reconcile request

The {{<hover label="reconcile-request" line="7">}}crossplane.io/reconcile-requested-at{{</hover>}}
annotation triggers an immediate reconciliation when its value changes. This
follows the pattern established by
[Flux CD's `reconcile.fluxcd.io/requestedAt`](https://fluxcd.io/flux/components/source/api/v1/#source.toolkit.fluxcd.io/v1.GitRepository).

Set the annotation to any value, such as a timestamp or unique identifier, to
trigger a reconciliation.

```yaml {label="reconcile-request",copy-lines="none"}
apiVersion: rds.aws.m.upbound.io/v1beta1
kind: Instance
metadata:
namespace: default
name: my-rds-instance
annotations:
crossplane.io/reconcile-requested-at: "2024-01-15T10:30:00Z"
spec:
forProvider:
region: us-west-1
instanceType: t2.micro
```

The reconciler records the handled token in `status.lastHandledReconcileAt` so
operators can confirm the controller handled the request.

```shell
# Request reconciliation
kubectl annotate instance my-rds-instance \
crossplane.io/reconcile-requested-at="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--overwrite

# Verify it was handled
kubectl get instance my-rds-instance \
-o jsonpath='{.status.lastHandledReconcileAt}'
```

{{< hint "note" >}}
If the annotation value matches the last handled value, reconciliation isn't
triggered again.
{{< /hint >}}

## Finalizers
Crossplane applies a
[Finalizer](https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/)
Expand Down
Loading