feat(argocd-notifications): Add slack icon and signingSecret support and Grafana support ()

* Add icon and signingSecret support

* Fix typo

* Add grafana support

* Fix trailing spaces

* Fix trailing spaces 2

* Fix grafana comments

* Add bot manifests

* Bump version

* No new line character

* Values.yaml new line character

* Add comments

* Add slack.enabled flag

* Move slack bot to bots/slack folder

Co-authored-by: sergeyshaykhullin <sergeyshaykhullin@gmail.com>
Co-authored-by: Sergey Shaykhullin <46970457+sergeyshaykhullin@users.noreply.github.com>
pull/371/head^2
appanycd 2020-06-23 23:40:18 +03:00 committed by GitHub
parent 209d69558e
commit 422752023d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 194 additions and 2 deletions

View File

@ -3,7 +3,7 @@ appVersion: 0.7.0
description: A Helm chart for ArgoCD notifications, an add-on to ArgoCD.
name: argocd-notifications
type: application
version: 1.0.3
version: 1.0.4
home: https://github.com/argoproj/argo-helm
icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png
keywords:

View File

@ -43,6 +43,18 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Common slack bot labels
*/}}
{{- define "argocd-notifications.bots.slack.labels" -}}
helm.sh/chart: {{ include "argocd-notifications.chart" . }}
{{ include "argocd-notifications.bots.slack.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
@ -51,6 +63,14 @@ app.kubernetes.io/name: {{ include "argocd-notifications.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Selector slack bot labels
*/}}
{{- define "argocd-notifications.bots.slack.selectorLabels" -}}
app.kubernetes.io/name: {{ include "argocd-notifications.name" . }}-bot
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
@ -61,3 +81,14 @@ Create the name of the service account to use
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the bot service account to use
*/}}
{{- define "argocd-notifications.bots.slack.serviceAccountName" -}}
{{- if .Values.bots.slack.serviceAccount.create -}}
{{ default (include "argocd-notifications.fullname" .) .Values.bots.slack.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.bots.slack.serviceAccount.name }}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,45 @@
{{ if .Values.bots.slack.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "argocd-notifications.name" . }}-bot
labels:
{{- include "argocd-notifications.bots.slack.labels" . | nindent 4 }}
spec:
strategy:
{{- .Values.bots.slack.updateStrategy | toYaml | nindent 4 }}
selector:
matchLabels:
{{- include "argocd-notifications.bots.slack.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "argocd-notifications.bots.slack.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.bots.slack.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "argocd-notifications.serviceAccountName" . }}-bot
containers:
- name: {{ include "argocd-notifications.name" . }}-bot
image: "{{ .Values.bots.slack.image.repository }}:{{ .Values.bots.slack.image.tag }}"
imagePullPolicy: {{ .Values.bots.slack.image.pullPolicy }}
resources:
{{- toYaml .Values.bots.slack.resources | nindent 12 }}
command:
- /app/argocd-notifications
- bot
{{- with .Values.bots.slack.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.bots.slack.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.bots.slack.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{ end }}

View File

@ -0,0 +1,18 @@
{{ if .Values.bots.slack.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "argocd-notifications.name" . }}-bot
rules:
- apiGroups:
- argoproj.io
resources:
- applications
- appprojects
verbs:
- get
- list
- watch
- update
- patch
{{ end }}

View File

@ -0,0 +1,13 @@
{{ if .Values.bots.slack.enabled }}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "argocd-notifications.name" . }}-bot
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "argocd-notifications.name" . }}-bot
subjects:
- kind: ServiceAccount
name: {{ include "argocd-notifications.bots.slack.serviceAccountName" . }}
{{ end }}

View File

@ -0,0 +1,15 @@
{{ if .Values.bots.slack.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argocd-notifications.name" . }}-bot
spec:
ports:
- name: server
port: 80
protocol: TCP
targetPort: 8080
selector:
{{- include "argocd-notifications.bots.slack.selectorLabels" . | nindent 4 }}
type: {{ .Values.bots.slack.service.type }}
{{ end }}

View File

@ -0,0 +1,8 @@
{{ if and .Values.bots.slack.enabled .Values.secret.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "argocd-notifications.bots.slack.serviceAccountName" . }}
labels:
{{- include "argocd-notifications.bots.slack.labels" . | nindent 4 }}
{{ end }}

View File

@ -22,7 +22,7 @@ spec:
serviceAccountName: {{ include "argocd-notifications.serviceAccountName" . }}
containers:
- name: {{ include "argocd-notifications.name" . }}-controller
image: "{{ .Values.image.repository }}:{{ .Values.image.tag}}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}

View File

@ -12,6 +12,13 @@ stringData:
slack:
token: {{ .Values.secret.notifiers.slack.token }}
username: {{ .Values.secret.notifiers.slack.username }}
icon: {{ .Values.secret.notifiers.slack.icon }}
signingSecret: {{ .Values.secret.notifiers.slack.signingSecret }}
{{- 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:

View File

@ -35,6 +35,20 @@ secret:
token:
# Optional override username
username:
# Optional override icon
icon:
# Optional override signingSecret: https://argoproj-labs.github.io/argocd-notifications/recipients/slack-bot/
signingSecret:
grafana:
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/grafana/
# Specifies whether Grafana notifier should be configured
enabled: false
# Grafana api endpoint; for example: https://grafana.example.com/api
apiUrl:
# Grafana api key
apiKey:
webhooks: {}
# For more information: https://argoproj-labs.github.io/argocd-notifications/services/webhook/
@ -144,3 +158,44 @@ triggers:
# template: my-custom-template
#
# For more information: https://argoproj-labs.github.io/argocd-notifications/triggers_and_templates/
bots:
# For more information: https://argoproj-labs.github.io/argocd-notifications/recipients/bot/
slack:
# You have to set secret.notifiers.slack.signingSecret
enabled: false
updateStrategy:
type: Recreate
image:
repository: argoprojlabs/argocd-notifications
tag: v0.7.0
pullPolicy: IfNotPresent
imagePullSecrets: []
service:
type: LoadBalancer
serviceAccount:
# Specifies whether a service account should be created
create: true
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: argocd-notifications-bot
resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
affinity: {}
tolerations: []
nodeSelector: {}