Skip to content

Commit

Permalink
Merge pull request #12 from Arslanbekov/helm
Browse files Browse the repository at this point in the history
Helm deploy (chart)
  • Loading branch information
insidieux authored Nov 16, 2018
2 parents 3fb756b + 4630b78 commit 9ec7a5e
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

*.test
*.out
slack-duty-bot
config.yaml
slack-duty-bot
!/slack-duty-bot
.kubernetes/deploy.yaml
21 changes: 21 additions & 0 deletions .helm/slack-duty-bot/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
5 changes: 5 additions & 0 deletions .helm/slack-duty-bot/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: slack-duty-bot
version: 0.1.0
32 changes: 32 additions & 0 deletions .helm/slack-duty-bot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "slack-duty-bot.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "slack-duty-bot.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "slack-duty-bot.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
19 changes: 19 additions & 0 deletions .helm/slack-duty-bot/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: "{{ include "slack-duty-bot.name" . }}-config-map"
data:
config.yaml: |-
slack:
keyword:
{{- range $keyword := .Values.configuration.keywords }}
- {{ $keyword | quote}}
{{- end }}
duties:
- [ {{ .Values.dutyUsers.sunday | quote }} ]
- [ {{ .Values.dutyUsers.monday | quote }} ]
- [ {{ .Values.dutyUsers.tuesday | quote }} ]
- [ {{ .Values.dutyUsers.wednesday | quote }} ]
- [ {{ .Values.dutyUsers.thursday | quote }} ]
- [ {{ .Values.dutyUsers.friday | quote }} ]
- [ {{ .Values.dutyUsers.saturday | quote }} ]
43 changes: 43 additions & 0 deletions .helm/slack-duty-bot/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ include "slack-duty-bot.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "slack-duty-bot.name" . }}
helm.sh/chart: {{ include "slack-duty-bot.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "slack-duty-bot.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "slack-duty-bot.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: ["--config.path=/etc/slack-duty-bot"]
env:
- name: SDB_SLACK_TOKEN
valueFrom:
secretKeyRef:
name: "{{ include "slack-duty-bot.name" . }}-secret"
key: token
volumeMounts:
- name: "{{ include "slack-duty-bot.name" . }}-config-volume"
mountPath: /etc/slack-duty-bot
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: "{{ include "slack-duty-bot.name" . }}-config-volume"
configMap:
name: "{{ include "slack-duty-bot.name" . }}-config-map"
restartPolicy: Always
terminationGracePeriodSeconds: 30
8 changes: 8 additions & 0 deletions .helm/slack-duty-bot/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Secret
metadata:
name: "{{ include "slack-duty-bot.name" . }}-secret"
type: Opaque
data:
token: {{ .Values.configuration.slackToken | b64enc }}
35 changes: 35 additions & 0 deletions .helm/slack-duty-bot/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Default values for slack-duty-bot.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

nameOverride: "slack-duty-bot"
fullnameOverride: "slack-duty-bot"

replicaCount: 1

image:
repository: iqoption/slack-duty-bot
tag: 1.1.0
pullPolicy: IfNotPresent

configuration:
slackToken: ""
keywords:
- duty

dutyUsers:
sunday: user.one, user.two
monday: user.one
tuesday: user.two
wednesday: user.one
thursday: user.two
friday: user.one
saturday: user.one, user.two

resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGELOG
* Update Makefile
* Fix bug with setting "Debug" logger level
* Add utils: bash script for preparing release artifacts
* Add helm support [#9 - Use helm for install in kubernetes](//github.com/iqoption/slack-duty-bot/issues/9)

1.1.0
-----
Expand Down
Loading

0 comments on commit 9ec7a5e

Please sign in to comment.