Skip to content

Commit

Permalink
docs: Add missing RBAC requirements for calendar catch-up (#1108)
Browse files Browse the repository at this point in the history
* docs: Add missing RBAC requirements for calendar catch-up

Signed-off-by: Derek Wang <[email protected]>
  • Loading branch information
whynowy authored Mar 12, 2021
1 parent d2ee2b8 commit 2e04546
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 14 deletions.
63 changes: 49 additions & 14 deletions docs/eventsources/calendar-catch-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,67 @@
Catch-up feature allow Calender eventsources to execute the missed schedules
from last run.

## Enable Catch-up forEventSource Definition
## Enable Catch-up for Calendar EventSource

User can configure catchup on each events in eventsource.
User can configure catch up on each events in eventsource.

```yaml
example-with-catch-up:
# Catchup the missed events from last Event timestamp. last event will be persisted in configmap.
schedule: "* * * * *"
persistence:
catchup:
enabled: true # Check missed schedules from last persisted event time on every start
maxDuration: 5m # maximum amount of duration go back for the catch-up
configMap: # Configmap for persist the last successful event timestamp
createIfNotExist: true
name: test-configmap
apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
name: calendar
spec:
template:
serviceAccountName: configmap-sa # assign a service account with read, write permissions on configmaps
calendar:
example-with-catch-up:
# Catchup the missed events from last Event timestamp. last event will be persisted in configmap.
schedule: "* * * * *"
persistence:
catchup:
enabled: true # Check missed schedules from last persisted event time on every start
maxDuration: 5m # maximum amount of duration go back for the catch-up
configMap: # Configmap for persist the last successful event timestamp
createIfNotExist: true
name: test-configmap
```
Last calender event persisted in configured configmap. Multiple event can use
the same configmap to persist the events.
Last calender event persisted in configured configmap. Same configmap can be
used by multiple events configuration.
```yaml
data:
calendar.example-with-catch-up:
'{"eventTime":"2020-10-19 22:50:00.0003192 +0000 UTC m=+683.567066901"}'
```
### Service Account
To make Calendar EventSource catch-up work, a Service Account with proper RBAC
settings needs to be provided.
If the configMap is not existing, and `createIfNotExist: true` is set, a Service
Account bound with following `Role` is required.

```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: example-configmap-access-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- create
- update
```

If the configmap is already existing, `create` can be removed from the `verbs`
list.

## Disable the catchup

Set `false` to catchup-->enabled element
Expand Down
1 change: 1 addition & 0 deletions examples/event-sources/calendar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ spec:

# example-with-catchup:
# # Catchup the missed events from last Event timestamp. last event will be persisted in configmap.
# # A service account with configmap get/create/update privileges needs to be configured
# schedule: "* * * * *"
# persistence:
# catchup:
Expand Down

0 comments on commit 2e04546

Please sign in to comment.