Installation Instructions
This guide will show you how to configure push notifications for your Argo2Go app with just a few simple steps.
Before you start: You need a reporting token, if you still haven't generated one you can do that by clicking on 'Add Token' here.
Prerequisites
Our notification reporting mechanism is based on existing functionality provided by Argo-CD Notifications Controller. This component comes bundled with Argo-CD since Argo-CD v2.3. Before continuing with this guide you need to make sure that you have Argo-CD Notification Controller installed.
Run
Run the following commands to configure Argo-CD Notifications. Copy-Paste should just work if you've configured the above variables correctly 😀
export B64_TOKEN=$(echo -n REPORTING_TOKEN | base64)
# Add the token to Argo-CD notifications secret
kubectl patch secret argocd-notifications-secret \
-n argocd \
-p="{\"data\": { \"argo2go-token\": \"$B64_TOKEN\"}}"
# Add templates and triggers to Argo-CD notifications configmap
echo "apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
namespace: argocd
data:
service.webhook.argo2go: |
url: \"https://handleappevent-zgpmgtxwha-uc.a.run.app\"
headers:
- name: Authorization
value: \$argo2go-token
- name: Content-Type
value: application/json
subscriptions: |
- recipients:
- argo2go
triggers:
- argo2go-on-deployed
- argo2go-on-health-degraded
- argo2go-on-sync-running
- argo2go-on-sync-failed
- argo2go-on-sync-status-unknown
- argo2go-on-sync-succeeded
template.argo2go: |
webhook:
argo2go:
method: POST
path: '/'
body: |
{
\"application\": {
\"name\": \"{{.app.metadata.name}}\",
\"namespace\": \"{{.app.metadata.namespace}}\",
\"appProject\": \"{{.app.spec.project}}\",
\"healthStatus\": \"{{.app.status.health.status}}\",
{{if and .app.status.operationState.operation.sync.revision .app.spec.source.path }}
{{\$commit := (call .repo.GetCommitMetadata .app.status.operationState.operation.sync.revision)}}
\"commitDetails\": {
\"sha\": \"{{.app.status.operationState.operation.sync.revision}}\",
\"author\": \"{{\$commit.Author}}\",
\"message\": \"{{\$commit.Message | b64enc}}\",
\"date\": \"{{\$commit.Date}}\"
}
{{else}}
\"commitDetails\": null
{{end}}
}
}
trigger.argo2go-on-created: |
- description: Application is created.
oncePer: app.metadata.name
send: [\"argo2go\"]
when: \"true\"
trigger.argo2go-on-deleted: |
- description: Application is deleted.
oncePer: app.metadata.name
send: [\"argo2go\"]
when: app.metadata.deletionTimestamp != nil
trigger.argo2go-on-deployed: |
- description: Application is synced and healthy. Triggered once per commit.
oncePer: app.status.operationState.syncResult.revision
send: [\"argo2go\"]
when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status
== 'Healthy'
trigger.argo2go-on-health-degraded: |
- description: Application has degraded
send: [\"argo2go\"]
when: app.status.health.status == 'Degraded'
trigger.argo2go-on-sync-failed: |
- description: Application syncing has failed
send: [\"argo2go\"]
when: app.status.operationState.phase in ['Error', 'Failed']
trigger.argo2go-on-sync-running: |
- description: Application is being synced
send: [\"argo2go\"]
when: app.status.operationState.phase in ['Running']
trigger.argo2go-on-sync-status-unknown: |
- description: Application status is 'Unknown'
send: [\"argo2go\"]
when: app.status.sync.status == 'Unknown'
trigger.argo2go-on-sync-succeeded: |
- description: Application syncing has succeeded
send: [\"argo2go\"]
when: app.status.operationState.phase in ['Succeeded']
" | kubectl apply -f -
What did I just run?
The above commands configured Argo-CD Notifications controller to send events to Argo2Go when one of your Argo-CD applications changes its state. For example when an application becomes degraded.
We then process that event and distribute a push notification to all subscribed Argo2Go Devices.
If you want to know what we are doing with the data you send us you should take a look at our Privacy Policy.