Add bot manifests

This commit is contained in:
sergeyshaykhullin 2020-06-21 18:16:33 +03:00
parent b57acedbd6
commit 59c7668b20
8 changed files with 157 additions and 1 deletions

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,43 @@
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 }}

View file

@ -0,0 +1,16 @@
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

View file

@ -0,0 +1,11 @@
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" . }}

View file

@ -0,0 +1,13 @@
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 }}

View file

@ -0,0 +1,8 @@
{{ if .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

@ -158,3 +158,37 @@ triggers:
# template: my-custom-template
#
# For more information: https://argoproj-labs.github.io/argocd-notifications/triggers_and_templates/
bots:
slack:
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: {}