diff --git a/charts/argocd-notifications/Chart.yaml b/charts/argocd-notifications/Chart.yaml index cfbdfc6e..54ef9a84 100644 --- a/charts/argocd-notifications/Chart.yaml +++ b/charts/argocd-notifications/Chart.yaml @@ -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: diff --git a/charts/argocd-notifications/templates/_helpers.tpl b/charts/argocd-notifications/templates/_helpers.tpl index bbe07b54..7540cf20 100644 --- a/charts/argocd-notifications/templates/_helpers.tpl +++ b/charts/argocd-notifications/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/argocd-notifications/templates/bots/slack/deployment.yaml b/charts/argocd-notifications/templates/bots/slack/deployment.yaml new file mode 100644 index 00000000..c53efb74 --- /dev/null +++ b/charts/argocd-notifications/templates/bots/slack/deployment.yaml @@ -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 }} diff --git a/charts/argocd-notifications/templates/bots/slack/role.yaml b/charts/argocd-notifications/templates/bots/slack/role.yaml new file mode 100644 index 00000000..5127fcac --- /dev/null +++ b/charts/argocd-notifications/templates/bots/slack/role.yaml @@ -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 }} diff --git a/charts/argocd-notifications/templates/bots/slack/rolebinding.yaml b/charts/argocd-notifications/templates/bots/slack/rolebinding.yaml new file mode 100644 index 00000000..6a87bb49 --- /dev/null +++ b/charts/argocd-notifications/templates/bots/slack/rolebinding.yaml @@ -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 }} diff --git a/charts/argocd-notifications/templates/bots/slack/service.yaml b/charts/argocd-notifications/templates/bots/slack/service.yaml new file mode 100644 index 00000000..1878fe9d --- /dev/null +++ b/charts/argocd-notifications/templates/bots/slack/service.yaml @@ -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 }} diff --git a/charts/argocd-notifications/templates/bots/slack/serviceaccount.yaml b/charts/argocd-notifications/templates/bots/slack/serviceaccount.yaml new file mode 100644 index 00000000..ce28ad58 --- /dev/null +++ b/charts/argocd-notifications/templates/bots/slack/serviceaccount.yaml @@ -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 }} diff --git a/charts/argocd-notifications/templates/deployment.yaml b/charts/argocd-notifications/templates/deployment.yaml index 14fd9f48..cbe71ca7 100644 --- a/charts/argocd-notifications/templates/deployment.yaml +++ b/charts/argocd-notifications/templates/deployment.yaml @@ -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 }} diff --git a/charts/argocd-notifications/templates/secret.yaml b/charts/argocd-notifications/templates/secret.yaml index b631c78f..a5fc5527 100644 --- a/charts/argocd-notifications/templates/secret.yaml +++ b/charts/argocd-notifications/templates/secret.yaml @@ -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: diff --git a/charts/argocd-notifications/values.yaml b/charts/argocd-notifications/values.yaml index a05ee4c0..d7769bf7 100644 --- a/charts/argocd-notifications/values.yaml +++ b/charts/argocd-notifications/values.yaml @@ -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: {}