feat(argocd-notifications): update to support argocd-notification v1.0.1 (#567)

Signed-off-by: George Kaz <egeorgekaz@gmail.com>
This commit is contained in:
georgekaz 2021-02-03 20:48:19 +00:00 committed by GitHub
parent dee9f7de62
commit ba467c8a4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 286 additions and 172 deletions

View file

@ -1,9 +1,9 @@
apiVersion: v2 apiVersion: v2
appVersion: 0.7.0 appVersion: 1.0.1
description: A Helm chart for ArgoCD notifications, an add-on to ArgoCD. description: A Helm chart for ArgoCD notifications, an add-on to ArgoCD.
name: argocd-notifications name: argocd-notifications
type: application type: application
version: 1.0.11 version: 1.0.12
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png
keywords: keywords:

View file

@ -28,8 +28,9 @@ spec:
resources: resources:
{{- toYaml .Values.bots.slack.resources | nindent 12 }} {{- toYaml .Values.bots.slack.resources | nindent 12 }}
command: command:
- /app/argocd-notifications - /app/argocd-notifications-backend
- bot - bot
workingDir: /app
ports: ports:
- containerPort: 8080 - containerPort: 8080
name: http name: http

View file

@ -5,12 +5,18 @@ metadata:
labels: labels:
{{- include "argocd-notifications.labels" . | nindent 4 }} {{- include "argocd-notifications.labels" . | nindent 4 }}
data: data:
config.yaml: | context: |
context: argocdUrl: {{ .Values.argocdUrl | quote }}
argocdUrl: {{ .Values.argocdUrl | quote }} {{- with .Values.notifiers }}
subscriptions: {{- toYaml . | nindent 2 }}
{{- toYaml .Values.subscriptions | nindent 6 }} {{- end }}
templates: {{- with .Values.subscriptions }}
{{- toYaml .Values.templates | nindent 6 }} subscriptions: |
triggers: {{- toYaml . | nindent 4 }}
{{- toYaml .Values.triggers | nindent 6 }} {{- end }}
{{- with .Values.templates }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- with .Values.triggers }}
{{- toYaml . | nindent 2 }}
{{- end }}

View file

@ -26,6 +26,8 @@ spec:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
serviceAccountName: {{ include "argocd-notifications.serviceAccountName" . }} serviceAccountName: {{ include "argocd-notifications.serviceAccountName" . }}
securityContext:
runAsNonRoot: true
containers: containers:
- name: {{ include "argocd-notifications.name" . }}-controller - name: {{ include "argocd-notifications.name" . }}-controller
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
@ -33,7 +35,7 @@ spec:
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
command: command:
- /app/argocd-notifications - /app/argocd-notifications-backend
- controller - controller
- --loglevel={{ .Values.logLevel }} - --loglevel={{ .Values.logLevel }}
{{- if .Values.metrics.enabled }} {{- if .Values.metrics.enabled }}
@ -42,6 +44,7 @@ spec:
{{- range .Values.extraArgs }} {{- range .Values.extraArgs }}
- {{ . | squote }} - {{ . | squote }}
{{- end }} {{- end }}
workingDir: /app
ports: ports:
{{- if .Values.metrics.enabled }} {{- if .Values.metrics.enabled }}
- containerPort: {{ .Values.metrics.port }} - containerPort: {{ .Values.metrics.port }}

View file

@ -7,33 +7,7 @@ metadata:
{{- include "argocd-notifications.labels" . | nindent 4 }} {{- include "argocd-notifications.labels" . | nindent 4 }}
type: Opaque type: Opaque
stringData: stringData:
notifiers.yaml: | {{- with .Values.secret.items }}
{{- if .Values.secret.notifiers.slack.enabled }} {{ toYaml . | indent 2 }}
slack: {{- end }}
token: {{ .Values.secret.notifiers.slack.token }}
username: {{ .Values.secret.notifiers.slack.username }}
icon: {{ .Values.secret.notifiers.slack.icon | quote }}
signingSecret: {{ .Values.secret.notifiers.slack.signingSecret }}
{{- end }} {{- end }}
{{- if .Values.secret.notifiers.grafana.enabled }}
grafana:
apiUrl: {{ .Values.secret.notifiers.grafana.apiUrl }}
apiKey: {{ .Values.secret.notifiers.grafana.apiKey }}
{{- end }}
{{- if .Values.secret.notifiers.webhooks }}
webhook:
{{- range $k, $v := .Values.secret.notifiers.webhooks }}
- name: {{ $k }}
{{- $v | toYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.secret.notifiers.email.enabled }}
email:
host: {{ .Values.secret.notifiers.email.host | quote }}
port: {{ .Values.secret.notifiers.email.port }}
insecure_skip_verify: {{ .Values.secret.notifiers.email.insecure_skip_verify }}
username: {{ .Values.secret.notifiers.email.username | quote }}
password: {{ .Values.secret.notifiers.email.password | quote }}
from: {{ .Values.secret.notifiers.email.from | quote }}
{{- end }}
{{ end }}

View file

@ -7,7 +7,7 @@ fullnameOverride: ""
image: image:
repository: argoprojlabs/argocd-notifications repository: argoprojlabs/argocd-notifications
tag: v0.7.0 tag: v1.0.1
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
imagePullSecrets: [] imagePullSecrets: []
@ -23,69 +23,22 @@ secret:
# Whether helm chart creates controller secret # Whether helm chart creates controller secret
create: true create: true
notifiers: items:
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/overview/ # Generic key:value pairs to be inserted into the secret
# Can be used for templates, notification services etc. Some examples given below.
# For more information: https://argocd-notifications.readthedocs.io/en/stable/services/overview/
slack: # slack-token:
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/slack/ # # For more information: https://argocd-notifications.readthedocs.io/en/stable/services/slack/
# Specifies whether Slack notifier should be configured # grafana-apiKey:
enabled: false # # For more information: https://argocd-notifications.readthedocs.io/en/stable/services/grafana/
# OAuth Access Token
token:
# Optional override username
username:
# Optional override icon
icon:
# Optional override signingSecret: https://argoproj-labs.github.io/argocd-notifications/recipients/slack-bot/
signingSecret:
grafana: # webhooks-github-token:
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/grafana/
# Specifies whether Grafana notifier should be configured # email-username:
enabled: false # email-password:
# Grafana api endpoint; for example: https://grafana.example.com/api # For more information: https://argocd-notifications.readthedocs.io/en/stable/services/email/
apiUrl:
# Grafana api key
apiKey:
webhooks: {}
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/webhook/
# mywebhook:
# url: http://example.com
# headers:
# - name: headerName
# value: headerValue
# basicAuth:
# username: username
# password: mypassword
# mywebhook2:
# url: http://example.com
# headers:
# - name: headerName
# value: headerValue
# basicAuth:
# username: username
# password: mypassword
email:
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/overview/
# Specifies whether email notifier should be configured
enabled: false
# SMTP endpoint
host:
# SMTP port
port:
# enable/disable check on TLS certificate
insecure_skip_verify:
# SMTP username
username:
# SMTP password
password:
# email address in from field
from:
logLevel: info logLevel: info
@ -101,6 +54,12 @@ metrics:
# interval: 30s # interval: 30s
# scrapeTimeout: 10s # scrapeTimeout: 10s
notifiers:
# For more information: https://argocd-notifications.readthedocs.io/en/stable/services/overview/
service.slack: |
token: $slack-token
podAnnotations: {} podAnnotations: {}
resources: {} resources: {}
@ -119,82 +78,253 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template # If not set and create is true, a name is generated using the fullname template
name: argocd-notifications-controller name: argocd-notifications-controller
subscriptions: [] subscriptions:
# Assignment of recipients by notification channel to triggers in several forms: # For more information: https://argocd-notifications.readthedocs.io/en/stable/subscriptions/
#
# global subscription for all type of notifications
# - recipients:
# - slack:test1
# - webhook:github
#
# subscription for on-sync-status-unknown trigger notifications
# - recipients:
# - slack:test2
# - email:test@gmail.com
# trigger: on-sync-status-unknown
#
# global subscription restricted to applications with matching labels only
# - recipients:
# - slack:test3
# selector: test=true
#
# For more information: https://argoproj-labs.github.io/argocd-notifications/triggers_and_templates/
templates: [] # # subscription for on-sync-status-unknown trigger notifications
# The notification template is used to generate the notification content. The template is leveraging html/template # - recipients:
# golang package and allow to define notification title and body. The template is meant to be reusable and can be # - slack:test2
# referenced by multiple triggers. # - email:test@gmail.com
# # triggers:
# Add your custom template # - on-sync-status-unknown
# - name: my-custom-template # # subscription restricted to applications with matching labels only
# title: Hello {{.app.metadata.name}} # - recipients:
# body: | # - slack:test3
# selector: test=true
# triggers:
# - on-sync-status-unknown
templates:
# For more information: https://argocd-notifications.readthedocs.io/en/stable/templates/
# template.app-deployed: |
# email:
# subject: New version of an application {{.app.metadata.name}} is up and running.
# message: |
# {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests.
# slack:
# attachments: |
# [{
# "title": "{{ .app.metadata.name}}",
# "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
# "color": "#18be52",
# "fields": [
# {
# "title": "Sync Status",
# "value": "{{.app.status.sync.status}}",
# "short": true
# },
# {
# "title": "Repository",
# "value": "{{.app.spec.source.repoURL}}",
# "short": true
# },
# {
# "title": "Revision",
# "value": "{{.app.status.sync.revision}}",
# "short": true
# }
# {{range $index, $c := .app.status.conditions}}
# {{if not $index}},{{end}}
# {{if $index}},{{end}}
# {
# "title": "{{$c.type}}",
# "value": "{{$c.message}}",
# "short": true
# }
# {{end}}
# ]
# }]
# template.app-health-degraded: |
# 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}}. # Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
# # slack:
# Override one field in built-in template # attachments: |-
# - name: on-sync-succeeded # [{
# title: Application {{.app.metadata.name}} sync status is {{.app.status.sync.status}} # "title": "{{ .app.metadata.name}}",
# # "title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
# For more information: https://argoproj-labs.github.io/argocd-notifications/triggers_and_templates/ # "color": "#f4c030",
# "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}}
# ]
# }]
# 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}}
# ]
# }]
# 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 .
# slack:
# attachments: |-
# [{
# "title": "{{ .app.metadata.name}}",
# "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
# "color": "#0DADEA",
# "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}}
# ]
# }]
# 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}}
# 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}}
# ]
# }]
# 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 .
# slack:
# attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n \"color\": \"#18be52\",\n \"fields\": [\n {\n \"title\": \"Sync Status\",\n \"value\": \"{{.app.status.sync.status}}\",\n \"short\": true\n },\n {\n \"title\": \"Repository\",\n \"value\": \"{{.app.spec.source.repoURL}}\",\n \"short\": true\n }\n {{range $index, $c := .app.status.conditions}}\n {{if not $index}},{{end}}\n {{if $index}},{{end}}\n {\n \"title\": \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": true\n }\n {{end}}\n ]\n}] "
tolerations: [] tolerations: []
triggers: triggers:
# The condition when the notification should be sent. The definition includes name, condition and notification template reference. # For more information: https://argocd-notifications.readthedocs.io/en/stable/triggers/
#
# Enable built-in triggers: # trigger.on-deployed: |
# # - description: Application is synced and healthy. Triggered once per commit.
# Application has degraded # oncePer: app.status.sync.revision
# - name: on-health-degraded # send:
# enabled: true # - app-deployed
# # when: app.status.operationState.phase in ['Succeeded'] and app.status.health.status == 'Healthy'
# Application syncing has failed # trigger.on-health-degraded: |
# - name: on-sync-failed # - description: Application has degraded
# enabled: true # send:
# # - app-health-degraded
# Application is being synced # when: app.status.health.status == 'Degraded'
# - name: on-sync-running # trigger.on-sync-failed: |
# enabled: true # - description: Application syncing has failed
# # send:
# Application status is 'Unknown' # - app-sync-failed
# - name: on-sync-status-unknown # when: app.status.operationState.phase in ['Error', 'Failed']
# enabled: true # trigger.on-sync-running: |
# # - description: Application is being synced
# Application syncing has succeeded # send:
# - name: on-sync-succeeded # - app-sync-running
# enabled: true # when: app.status.operationState.phase in ['Running']
# # trigger.on-sync-status-unknown: |
# # - description: Application status is 'Unknown'
# Or define your custom triggers: # send:
# # - app-sync-status-unknown
# - name: my-custom-trigger # when: app.status.sync.status == 'Unknown'
# condition: app.status.sync.status == 'Unknown' # trigger.on-sync-succeeded: |
# template: my-custom-template # - description: Application syncing has succeeded
# # send:
# For more information: https://argoproj-labs.github.io/argocd-notifications/triggers_and_templates/ # - app-sync-succeeded
# when: app.status.operationState.phase in ['Succeeded']
bots: bots:
# For more information: https://argoproj-labs.github.io/argocd-notifications/recipients/bot/ # For more information: https://argocd-notifications.readthedocs.io/en/stable/bots/overview/
slack: slack:
# You have to set secret.notifiers.slack.signingSecret # You have to set secret.notifiers.slack.signingSecret
enabled: false enabled: false
@ -204,7 +334,7 @@ bots:
image: image:
repository: argoprojlabs/argocd-notifications repository: argoprojlabs/argocd-notifications
tag: v0.7.0 tag: v1.0.1
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
imagePullSecrets: [] imagePullSecrets: []