This commit is contained in:
allard
2025-12-06 11:09:46 +01:00
parent 54c2a9b84f
commit 8405ddfd78
13 changed files with 69 additions and 267 deletions

View File

@@ -1,41 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-notifications-cm
namespace: argocd
labels:
app.kubernetes.io/component: notifications-controller
app.kubernetes.io/instance: argocd
app.kubernetes.io/managed-by: manual
app.kubernetes.io/name: argocd-notifications-controller
app.kubernetes.io/part-of: argocd
data:
context: |
argocdUrl: https://argocd-dev.allarddcs.nl
service.email: |
host: mail.allarddcs.nl
port: 587
from: argocd@allarddcs.nl
username: argocd@allarddcs.nl
password: Argocd01@
starttls: true
template.app-sync-failed: |
email:
subject: Failed to sync application {{.app.metadata.name}}.
message: |
The sync of {{.app.metadata.name}} failed at {{.app.status.operationState.finishedAt}}.
Error: {{.app.status.operationState.message}}
More details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
trigger.on-sync-failed: |
- description: Application syncing has failed
send: [app-sync-failed]
when: app.status.operationState != nil and app.status.operationState.phase in ['Error','Failed']
subscriptions: |
- recipients:
- email:admin@allarddcs.nl
triggers:
- on-sync-failed

View File

@@ -1,123 +0,0 @@
ingress:
server:
enabled: true
ingressClassName: traefik
hosts:
- host: argocd-dev.allarddcs.nl
paths:
- "/"
tls:
- hosts:
- argocd-dev.allarddcs.nl
secretName: argocd-tls-cert
configs:
secret:
extra:
argocdServerAdminPassword: "$2a$10$CYBSxU6gqSBKP4knIdKDm.pF4TQXmJwUh860yXQEsHFy43Z2fuenK"
params:
# disable insecure (HTTP)
server.insecure: "false"
resource.customizations: |
rbac.authorization.k8s.io/ClusterRole:
ignoreDifferences: |
jsonPointers:
- /metadata/annotations/argocd.argoproj.io~1tracking-id
rbac.authorization.k8s.io/ClusterRoleBinding:
ignoreDifferences: |
jsonPointers:
- /metadata/annotations/argocd.argoproj.io~1tracking-id
server:
tls:
enabled: true
# name of the TLS secret (created via cert-manager)
secretName: argocd-tls-cert
repoServer:
extraArgs:
- --parallelismlimit=1
readinessProbe:
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 10
livenessProbe:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 10
notifications:
enabled: true
name: notifications-controller
context:
argocdUrl: https://argocd-dev.allarddcs.nl
secret:
create: true
name: argocd-notifications-secret
items:
email-username: "argocd@allarddcs.nl"
email-password: 'Argocd01@'
cm:
create: true
extra:
service.email: |
host: mail.allarddcs.nl
port: 587
from: $email-username
username: $email-username
password: $email-password
starttls: true
templates:
template.app-sync-failed: |
email:
subject: Failed to sync application {{.app.metadata.name}}.
message: |
{{if eq .serviceType "slack"}}:exclamation:{{end}} The sync operation of application {{.app.metadata.name}} has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}}
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
slack:
attachments: |-
[{
"title": "{{ .app.metadata.name}}",
"title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
"color": "#E96D76",
"fields": [
{
"title": "Sync Status",
"value": "{{.app.status.sync.status}}",
"short": true
},
{
"title": "Repository",
"value": "{{.app.spec.source.repoURL}}",
"short": true
}
{{range $index, $c := .app.status.conditions}}
{{if not $index}},{{end}}
{{if $index}},{{end}}
{
"title": "{{$c.type}}",
"value": "{{$c.message}}",
"short": true
}
{{end}}
]
}]
triggers:
trigger.on-sync-failed: |
- description: Application syncing has failed
send: [app-sync-failed]
when: app.status.operationState != nil and app.status.operationState.phase in ['Error','Failed']
subscriptions:
- recipients:
- admin@allarddcs.nl
triggers:
- on-sync-failed

View File

@@ -1,95 +0,0 @@
ingress:
server:
enabled: true
ingressClassName: traefik
hosts:
- host: argocd-dev.allarddcs.nl
paths:
- "/"
tls:
- hosts:
- argocd-dev.allarddcs.nl
secretName: argocd-tls-cert
configs:
secret:
extra:
argocdServerAdminPassword: "$2a$10$CYBSxU6gqSBKP4knIdKDm.pF4TQXmJwUh860yXQEsHFy43Z2fuenK"
params:
# disable insecure (HTTP)
server.insecure: "false"
resource.customizations: |
rbac.authorization.k8s.io/ClusterRole:
ignoreDifferences: |
jsonPointers:
- /metadata/annotations/argocd.argoproj.io~1tracking-id
rbac.authorization.k8s.io/ClusterRoleBinding:
ignoreDifferences: |
jsonPointers:
- /metadata/annotations/argocd.argoproj.io~1tracking-id
server:
tls:
enabled: true
# name of the TLS secret (created via cert-manager)
secretName: argocd-tls-cert
repoServer:
extraArgs:
- --parallelismlimit=1
readinessProbe:
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 10
livenessProbe:
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 10
notifications:
enabled: true
context:
argocdUrl: https://argocd-dev.allarddcs.nl
cm:
create: true
extra:
service.email: |
host: mail.allarddcs.nl
port: 587
from: $email-username
username: $email-username
password: $email-password
starttls: true
secret:
create: true
name: argocd-notifications-secret
items:
email-username: "argocd@allarddcs.nl"
email-password: "Argocd01@"
templates:
app-sync-failed: |
email:
subject: Failed to sync application {{.app.metadata.name}}.
message: |
The sync operation of application {{.app.metadata.name}} has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}}
More details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
triggers:
on-sync-failed: |
- description: Application syncing has failed
send: [app-sync-failed]
when: app.status.operationState != nil and app.status.operationState.phase in ['Error','Failed']
subscriptions:
- recipients:
- admin@allarddcs.nl
triggers:
- on-sync-failed

View File

@@ -72,13 +72,45 @@ notifications:
starttls: true starttls: true
templates: templates:
app-sync-failed: | template.app-deployed: |
email: email:
subject: Failed to sync application {{.app.metadata.name}}. subject: New version of an application {{.app.metadata.name}} is up and running.
message: | message: |
The sync of {{.app.metadata.name}} failed at {{.app.status.operationState.finishedAt}}. {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests.
Error: {{.app.status.operationState.message}} template.app-health-degraded: |
More details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true email:
subject: Application {{.app.metadata.name}} has degraded.
message: |
{{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} has degraded.
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
template.app-sync-failed: |
email:
subject: Failed to sync application {{.app.metadata.name}}.
message: |
The sync operation of application {{.app.metadata.name}} has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}}
template.app-sync-running: |
email:
subject: Start syncing application {{.app.metadata.name}}.
message: |
The sync operation of application {{.app.metadata.name}} has started at {{.app.status.operationState.startedAt}}.
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
template.app-sync-status-unknown: |
email:
subject: Application {{.app.metadata.name}} sync status is 'Unknown'
message: |
{{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} sync is 'Unknown'.
Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
{{if ne .serviceType "slack"}}
{{range $c := .app.status.conditions}}
* {{$c.message}}
{{end}}
{{end}}
template.app-sync-succeeded: |
email:
subject: Application {{.app.metadata.name}} has been successfully synced.
message: |
{{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}.
Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true .
triggers: triggers:
trigger.on-sync-failed: | trigger.on-sync-failed: |
@@ -86,12 +118,41 @@ notifications:
send: send:
- app-sync-failed - app-sync-failed
when: app.status.operationState != nil and app.status.operationState.phase in ['Error','Failed'] when: app.status.operationState != nil and app.status.operationState.phase in ['Error','Failed']
trigger.on-deployed: |
- description: Application is synced and healthy. Triggered once per commit.
oncePer: app.status.sync.revision
send:
- app-deployed
when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
trigger.on-health-degraded: |
- description: Application has degraded
send:
- app-health-degraded
when: app.status.health.status == 'Degraded'
trigger.on-sync-running: |
- description: Application is being synced
send:
- app-sync-running
when: app.status.operationState.phase in ['Running']
trigger.on-sync-status-unknown: |
- description: Application status is 'Unknown'
send:
- app-sync-status-unknown
when: app.status.sync.status == 'Unknown'
trigger.on-sync-succeeded: |
- description: Application syncing has succeeded
send:
- app-sync-succeeded
when: app.status.operationState.phase in ['Succeeded']
subscriptions: subscriptions:
- recipients: - recipients:
- email:admin@allarddcs.nl - email:admin@allarddcs.nl
triggers: triggers:
- on-sync-failed - on-sync-failed
- on-sync-status-unknown
- on-sync-succeeded
- app-health-degraded
context: context:
argocdUrl: https://argocd-dev.allarddcs.nl argocdUrl: https://argocd-dev.allarddcs.nl