Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Added example ConfigMap configuration.

Signed-off-by: Marek Cermak <macermak@redhat.com>

modified:   README.md
  • Loading branch information
Marek Cermak committed Oct 29, 2019
1 parent 562c780 commit 01ebc21
Showing 1 changed file with 63 additions and 9 deletions.
72 changes: 63 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ To make our lives easier

This gateway implements a versatile manager which routes to the controllers. Each controller has a separate functionality and reconciliation strategy.

#### Controllers
### Controllers

**[Trello Controller](/src/controllers/trello/main.ts)**
- **[Trello Controller](/src/controllers/trello/main.ts)**

**Functionality**: Trello webhook receiver and board reconciler, extensible with plugins
**Functionality**: Trello webhook receiver and board reconciler, extensible with plugins.

Plugins are scripts executed in a `vm` sandbox in restricted environment, being provided the Trello client, the request for reconciliation and some additional context.
Plugins are scripts executed in a `vm` sandbox in restricted environment, being provided the Trello client, the request for reconciliation and some additional context.

**Active plugins**:
**Active plugins**:

- [Story Point reconciler](/plugins/story_point_reconciler.js)
- [Story Point reconciler](/plugins/story_point_reconciler.js)

Watches for changes in story points and update the board accordingly.
Watches for changes in story points and update the board accordingly.

<br>

## Deployment

Expand All @@ -32,6 +34,59 @@ Next, follow the Trello documentation to get your [API key](https://trello.com/a

#### Procedure

1] Create a configmap with a **config** key which defines the configuration for controllers.

Example:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: controller-gateway-configmap
labels:
app: controller-gateway
data:
config: |
controllers:
- name: trello
# Custom controller config
config:
plugins:
- name: Story Point Reconciler
url: /plugins/story_point_reconciler.js
config:
rules:
- model:
name: 'Thoth Station'
columns: ['^Completed.*', '^Next.*', '^In Progress.*']
- model:
name: 'Personal Objectives'
columns: ['^Completed.*', '^Next.*']
- name: Label Reconciler
url: /plugins/label_reconciler.js
# Custom plugin config
config:
rules:
- model:
name: 'Thoth Station'
labels:
- id: '<LABEL_ID>' # a unique hash (obtained from Trello)
name: 'In Progress' # optional metadata
selector: '\(\?\)'
columns: ['^Backlog.*', '^Next.*', '^New.*']
- model:
name: 'Personal Objectives'
labels:
- id: '<LABEL_ID>' # a unique hash (obtained from Trello)
name: 'Completed' # optional metadata
selector: '\(\?\)'
columns: ['^Next.*', '^New.*']
```

2] Deploy the gateway

```bash
# create .makerc file with your environment configuration
# for example:
Expand All @@ -43,7 +98,7 @@ export ULTRAHOOK_API_KEY=... # or have your api key in ~/.ultrahook
EOF

# provide the trello secrets
oc create secret generic trello-secret \
oc create secret generic trello-secret \
--from-literal=api_key=${TRELLO_API_KEY} \
--from-literal=token=${TRELLO_TOKEN}

Expand All @@ -52,7 +107,6 @@ make deploy
# triggers builds
make build-openshift
```

---

Author: Marek Cermak &lt;macermak@redhat.com&gt; @AICoE

0 comments on commit 01ebc21

Please sign in to comment.