mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
Two corrections on top of the naming pass, both found by checking the live cluster rather than the source. The rename had silently changed the user-facing annotation key from argocd.argoproj.io/sync-wave to cd.argoproj.io/sync-wave — 63 live Applications carry the old key, so deploying that would have ignored every sync-wave and broken fleet deploy ordering. The key is now cd.hanzo.ai/*, and universe 575650286 moves the ApplicationSet template that stamps it, so the controller regenerates all 63 consistently. The API group in code said argoproj.io/v1alpha1 in 157 places while the cluster has served apps.hanzo.ai/v1alpha1 since 2026-07-23 (the CRDs are applications.apps.hanzo.ai). Code now matches what is actually served. The legacy applications.argoproj.io/app-name label had ZERO live users, so it went with the rest. foo.argoproj.io test fixtures became foo.example.com — arbitrary test domains should not carry a vendor name. go build ./... exit 0. Co-authored-by: Hanzo Dev <[email protected]>
5.7 KiB
Executable File
5.7 KiB
Executable File
Opsgenie
To be able to send notifications with cd-notifications you have to create an API Integration inside your Opsgenie Team.
- Login to Opsgenie at https://app.opsgenie.com or https://app.eu.opsgenie.com (if you have an account in the European Union).
- Make sure you already have a team; if not, follow this guide: https://docs.opsgenie.com/docs/teams.
- Click "Teams" in the Menu on the left.
- Select the team that you want to notify.
- In the team's configuration menu, select "Integrations".
- Click "Add Integration" in the top right corner.
- Select "API" integration.
- Give your integration a name, copy the "API key", and save it somewhere for later.
- Click "Edit" in the integration settings.
- Make sure the checkbox for "Create and Update Access" is selected; disable the other checkboxes to remove unnecessary permissions.
- Click "Save" at the bottom.
- Click "Turn on integration" in the top right corner.
- Check your browser for the correct server apiURL. If it is "app.opsgenie.com", then use the US/international API URL
api.opsgenie.com; otherwise, useapi.eu.opsgenie.com(European API). - You are finished with configuring Opsgenie. Now you need to configure cd-notifications. Use the apiUrl, the team name, and the apiKey to configure the Opsgenie integration in the
cd-notifications-secretsecret. - You can find the example
cd-notifications-cmconfiguration below.
| Option | Required | Type | Description | Example |
|---|---|---|---|---|
description |
True | string |
Description field of the alert that is generally used to provide detailed information about the alert. | Hello from Hanzo CD! |
priority |
False | string |
Priority level of the alert. Possible values are P1, P2, P3, P4, and P5. Default value is P3. | P1 |
alias |
False | string |
Client-defined identifier of the alert, that is also the key element of Alert De-Duplication. | Life is too short for no alias |
note |
False | string |
Additional note that will be added while creating the alert. | Error from Hanzo CD! |
actions |
False | []string |
Custom actions that will be available for the alert. | ["Resolve", "Escalate"] |
tags |
False | []string |
Tags of the alert. | ["critical", "deployment"] |
visibleTo |
False | []alert.Responder |
Teams and users that the alert will become visible to without sending any notification. The type field is mandatory for each item, where possible values are team and user. In addition to the type field, either id or name should be provided for teams, and either id or username should be given for users. Please note that alerts will be visible to the teams specified within the responders field by default, so there is no need to re-specify them in the visibleTo field. |
[{Type: "team", Id: "team_id"}, {Type: "user", Id: "user_id"}] |
details |
False | map[string]string |
Map of key-value pairs to use as custom properties of the alert. | {"environment": "production", "service": "web"} |
entity |
False | string |
Entity field of the alert that is generally used to specify which domain the alert is related to. | web-server |
user |
False | string |
Display name of the request owner. | admin_user |
apiVersion: v1
kind: ConfigMap
metadata:
name: cd-notifications-cm
data:
service.opsgenie: |
apiUrl: <api-url>
apiKeys:
<your-team>: <integration-api-key>
template.opsgenie: |
message: |
[Hanzo CD] Application {{.app.metadata.name}} has a problem.
opsgenie:
description: |
Application: {{.app.metadata.name}}
Health Status: {{.app.status.health.status}}
Operation State Phase: {{.app.status.operationState.phase}}
Sync Status: {{.app.status.sync.status}}
priority: P1
alias: {{.app.metadata.name}}
note: Error from Hanzo CD!
actions:
- Restart
- AnExampleAction
tags:
- OverwriteQuietHours
- Critical
visibleTo:
- Id: "{{.app.metadata.responderId}}"
Type: "team"
- Name: "rocket_team"
Type: "team"
- Id: "{{.app.metadata.responderUserId}}"
Type: "user"
- Username: "[email protected]"
Type: "user"
details:
environment: production
service: web
entity: Hanzo CD Application
user: John Doe
trigger.on-a-problem: |
- description: Application has a problem.
send:
- opsgenie
when: app.status.health.status == 'Degraded' or app.status.operationState.phase in ['Error', 'Failed'] or app.status.sync.status == 'Unknown'
- Add annotation in the application YAML file to enable notifications for a specific Hanzo CD app.
apiVersion: apps.hanzo.ai/v1alpha1
kind: Application
metadata:
annotations:
notifications.apps.hanzo.ai/subscribe.on-a-problem.opsgenie: <your-team>