diff --git a/charts/marge-bot/Chart.yaml b/charts/marge-bot/Chart.yaml new file mode 100644 index 0000000..62ed385 --- /dev/null +++ b/charts/marge-bot/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v2 +name: marge-bot +description: |- + Helm chart to deploy [marge-bot](https://github.com/hiboxsystems/marge-bot). +type: application +version: 0.0.1 +appVersion: "0.11.0" +home: https://github.com/slamdev/helm-charts/tree/master/charts/marge-bot +icon: https://docs.gitlab.com/assets/images/gitlab-logo.svg +maintainers: + - name: slamdev + email: valentin.fedoskin@gmail.com diff --git a/charts/marge-bot/README.md b/charts/marge-bot/README.md new file mode 100644 index 0000000..f1acb42 --- /dev/null +++ b/charts/marge-bot/README.md @@ -0,0 +1,36 @@ +# marge-bot + +![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.11.0](https://img.shields.io/badge/AppVersion-0.11.0-informational?style=flat-square) + +Helm chart to deploy [marge-bot](https://github.com/hiboxsystems/marge-bot). + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| slamdev | | | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| additionalResources | list | `[]` | list of additional resources to create (are processed via `tpl` function) | +| affinity | object | `{}` | affinity for scheduler pod assignment | +| args | list | `[]` | args to pass to the container | +| env | list | `[]` | additional environment variables for the deployment | +| fullnameOverride | string | `""` | full name of the chart. | +| image.pullPolicy | string | `"IfNotPresent"` | image pull policy | +| image.repository | string | `"hiboxsystems/marge-bot"` | image repository | +| image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) | +| imagePullSecrets | list | `[]` | image pull secret for private images | +| nameOverride | string | `""` | override name of the chart | +| nodeSelector | object | `{}` | node for scheduler pod assignment | +| podSecurityContext | object | `{}` | specifies security settings for a pod | +| resources | object | `{}` | custom resource configuration | +| securityContext | object | `{}` | specifies security settings for a container | +| serviceAccount.annotations | object | `{}` | annotations to add to the service account | +| serviceAccount.create | bool | `false` | specifies whether a service account should be created | +| serviceAccount.name | string | `nil` | the name of the service account to use; if not set and create is true, a name is generated using the fullname template | +| tolerations | list | `[]` | tolerations for scheduler pod assignment | diff --git a/charts/marge-bot/templates/_helpers.tpl b/charts/marge-bot/templates/_helpers.tpl new file mode 100644 index 0000000..30c87c4 --- /dev/null +++ b/charts/marge-bot/templates/_helpers.tpl @@ -0,0 +1,81 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "marge-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 "marge-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 "marge-bot.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "marge-bot.labels" -}} +helm.sh/chart: {{ include "marge-bot.chart" . }} +{{ include "marge-bot.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "marge-bot.selectorLabels" -}} +app.kubernetes.io/name: {{ include "marge-bot.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "marge-bot.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "marge-bot.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Create the tag for the docker image to use +*/}} +{{- define "marge-bot.tag" -}} +{{- .Values.image.tag | default .Chart.AppVersion -}} +{{- end -}} + + +{{/* +marge-bot.rawResource will create a resource template that can be +merged with each item in `.Values.additionalResources`. +*/}} +{{- define "marge-bot.rawResource" -}} +metadata: + labels: + {{- include "marge-bot.labels" . | nindent 4 }} +{{- end }} diff --git a/charts/marge-bot/templates/additional-resources.yaml b/charts/marge-bot/templates/additional-resources.yaml new file mode 100644 index 0000000..8a0c003 --- /dev/null +++ b/charts/marge-bot/templates/additional-resources.yaml @@ -0,0 +1,5 @@ +{{- $template := fromYaml (include "marge-bot.rawResource" .) -}} +{{- range $i, $t := .Values.additionalResources }} +--- +{{ toYaml (merge (tpl $t $ | fromYaml) $template) -}} +{{- end }} diff --git a/charts/marge-bot/templates/deployment.yaml b/charts/marge-bot/templates/deployment.yaml new file mode 100644 index 0000000..bf7e2aa --- /dev/null +++ b/charts/marge-bot/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "marge-bot.fullname" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "marge-bot.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "marge-bot.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "marge-bot.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "marge-bot.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ include "marge-bot.tag" . }}" + args: {{ .Values.args | toYaml | nindent 12 }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/marge-bot/templates/serviceaccount.yaml b/charts/marge-bot/templates/serviceaccount.yaml new file mode 100644 index 0000000..4c4da22 --- /dev/null +++ b/charts/marge-bot/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "marge-bot.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "marge-bot.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end -}} diff --git a/charts/marge-bot/values.yaml b/charts/marge-bot/values.yaml new file mode 100644 index 0000000..6edc199 --- /dev/null +++ b/charts/marge-bot/values.yaml @@ -0,0 +1,80 @@ +image: + # image.repository -- image repository + repository: hiboxsystems/marge-bot + # image.tag -- image tag (chart's appVersion value will be used if not set) + tag: "" + # image.pullPolicy -- image pull policy + pullPolicy: IfNotPresent + +# imagePullSecrets -- image pull secret for private images +imagePullSecrets: [ ] +# nameOverride -- override name of the chart +nameOverride: "" +# fullnameOverride -- full name of the chart. +fullnameOverride: "" + +# args -- args to pass to the container +args: [ ] + +serviceAccount: + # serviceAccount.create -- specifies whether a service account should be created + create: false + # serviceAccount.annotations -- annotations to add to the service account + annotations: { } + # serviceAccount.name -- the name of the service account to use; if not set and create is true, a name is generated using the fullname template + name: + +# podSecurityContext -- specifies security settings for a pod +podSecurityContext: { } +# fsGroup: 2000 + +# securityContext -- specifies security settings for a container +securityContext: { } +# capabilities: +# drop: +# - ALL +# readOnlyRootFilesystem: true +# runAsNonRoot: true +# runAsUser: 1000 + + +# resources -- custom resource configuration +resources: { } +# limits: +# cpu: 100m +# memory: 128Mi +# requests: +# cpu: 100m +# memory: 128Mi + +# nodeSelector -- node for scheduler pod assignment +nodeSelector: { } + +# tolerations -- tolerations for scheduler pod assignment +tolerations: [ ] + +# affinity -- affinity for scheduler pod assignment +affinity: { } + +# env -- additional environment variables for the deployment +env: [ ] +# - name: SAMPLE +# value: text + +# additionalResources -- list of additional resources to create (are processed via `tpl` function) +additionalResources: [ ] +# - | +# apiVersion: v1 +# kind: ConfigMap +# metadata: +# name: {{ include "marge-bot.fullname" . }}-cm +# namespace: {{ .Release.Namespace }} +# +# - | +# apiVersion: v1 +# kind: Secret +# metadata: +# name: {{ include "marge-bot.fullname" . }}-s +# namespace: {{ .Release.Namespace }} +# stringData: +# mykey: my-value