From f0dadd71a3e5c1eaca2a7d814d2705eed3f98386 Mon Sep 17 00:00:00 2001 From: Glenn de Haan Date: Mon, 20 Mar 2023 20:01:58 +0100 Subject: [PATCH] Added the telegram-pepperbot chart --- charts/telegram-pepperbot/.helmignore | 23 ++++++ charts/telegram-pepperbot/Chart.yaml | 36 +++++++++ charts/telegram-pepperbot/README.md | 45 +++++++++++ charts/telegram-pepperbot/templates/NOTES.txt | 1 + .../telegram-pepperbot/templates/_helpers.tpl | 62 +++++++++++++++ .../templates/deployment.yaml | 59 ++++++++++++++ .../templates/serviceaccount.yaml | 12 +++ charts/telegram-pepperbot/values.yaml | 76 +++++++++++++++++++ 8 files changed, 314 insertions(+) create mode 100644 charts/telegram-pepperbot/.helmignore create mode 100644 charts/telegram-pepperbot/Chart.yaml create mode 100644 charts/telegram-pepperbot/README.md create mode 100644 charts/telegram-pepperbot/templates/NOTES.txt create mode 100644 charts/telegram-pepperbot/templates/_helpers.tpl create mode 100644 charts/telegram-pepperbot/templates/deployment.yaml create mode 100644 charts/telegram-pepperbot/templates/serviceaccount.yaml create mode 100644 charts/telegram-pepperbot/values.yaml diff --git a/charts/telegram-pepperbot/.helmignore b/charts/telegram-pepperbot/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/telegram-pepperbot/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/telegram-pepperbot/Chart.yaml b/charts/telegram-pepperbot/Chart.yaml new file mode 100644 index 0000000..201a372 --- /dev/null +++ b/charts/telegram-pepperbot/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v2 +name: telegram-pepperbot +description: A Helm chart for deploying the telegram-pepperbot application +home: https://github.com/glenndehaan/charts +keywords: + - telegram + - pepper + - app + - redis +maintainers: + - email: glenn@dehaan.cloud + name: glenndehaan + url: https://glenndehaan.com +sources: + - https://github.com/glenndehaan/charts + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 1.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "latest" diff --git a/charts/telegram-pepperbot/README.md b/charts/telegram-pepperbot/README.md new file mode 100644 index 0000000..db8cbe3 --- /dev/null +++ b/charts/telegram-pepperbot/README.md @@ -0,0 +1,45 @@ +# telegram-pepperbot + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) + +A Helm chart for deploying the telegram-pepperbot application + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| glenndehaan | | | + +## Source Code + +* + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | Affinity for pod assignment | +| fullnameOverride | string | `""` | String to fully override names.fullname | +| image.pullPolicy | string | `"Always"` | Telegram-Pepperbot image pull policy | +| image.repository | string | `"marnixjanssen/telgram-pepperbot"` | Telegram-Pepperbot image repository | +| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | +| imagePullSecrets | list | `[]` | Specify docker-registry secret names as an array | +| nameOverride | string | `""` | String to partially override names.fullname | +| nodeSelector | object | `{}` | Node labels for pod assignment. Evaluated as a template. | +| pepperbot.redisHost | string | `"redis-headless.example.svc.cluster.local"` | Telegram-Pepperbot Redis Host | +| pepperbot.telegramToken | string | `""` | Telegram-Pepperbot Telegram Bot Token | +| podAnnotations | object | `{}` | Annotations for Telegram-Pepperbot pods | +| podSecurityContext | object | `{}` | Pod Security Context for Telegram-Pepperbot pods | +| replicaCount | int | `2` | Number of Telegram-Pepperbot replicas to deploy | +| resources | object | `{}` | Resources for pods. Evaluated as a template. | +| revisionHistoryLimit | int | `1` | Number of Telegram-Pepperbot revisions to keep | +| securityContext | object | `{}` | Security Context for Telegram-Pepperbot | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | 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 pod assignment. Evaluated as a template. | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/telegram-pepperbot/templates/NOTES.txt b/charts/telegram-pepperbot/templates/NOTES.txt new file mode 100644 index 0000000..bdd95ed --- /dev/null +++ b/charts/telegram-pepperbot/templates/NOTES.txt @@ -0,0 +1 @@ +Please wait a few seconds until the {{ .Chart.Name }} chart is fully installed. diff --git a/charts/telegram-pepperbot/templates/_helpers.tpl b/charts/telegram-pepperbot/templates/_helpers.tpl new file mode 100644 index 0000000..bcf4ff2 --- /dev/null +++ b/charts/telegram-pepperbot/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "telegram-pepperbot.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 "telegram-pepperbot.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 "telegram-pepperbot.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "telegram-pepperbot.labels" -}} +helm.sh/chart: {{ include "telegram-pepperbot.chart" . }} +{{ include "telegram-pepperbot.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "telegram-pepperbot.selectorLabels" -}} +app.kubernetes.io/name: {{ include "telegram-pepperbot.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "telegram-pepperbot.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "telegram-pepperbot.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/telegram-pepperbot/templates/deployment.yaml b/charts/telegram-pepperbot/templates/deployment.yaml new file mode 100644 index 0000000..54ccf9c --- /dev/null +++ b/charts/telegram-pepperbot/templates/deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "telegram-pepperbot.fullname" . }} + labels: + {{- include "telegram-pepperbot.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} + selector: + matchLabels: + {{- include "telegram-pepperbot.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "telegram-pepperbot.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "telegram-pepperbot.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: {{ .Chart.Name }}-redis-ready + image: busybox:1.35 + command: [ 'sh', '-c', 'echo -e "Checking for the availability of Redis Server"; while ! nc -z {{ .Values.pepperbot.redisHost }} 6379; do sleep 1; printf "-"; done; echo -e " >> Redis Server is ready";' ] + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: REDIS_URL + value: "redis://{{ .Values.pepperbot.redisHost }}:6379" + - name: TELOXIDE_TOKEN + value: "{{ .Values.pepperbot.telegramToken }}" + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- 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/telegram-pepperbot/templates/serviceaccount.yaml b/charts/telegram-pepperbot/templates/serviceaccount.yaml new file mode 100644 index 0000000..aaedad1 --- /dev/null +++ b/charts/telegram-pepperbot/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "telegram-pepperbot.serviceAccountName" . }} + labels: + {{- include "telegram-pepperbot.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/telegram-pepperbot/values.yaml b/charts/telegram-pepperbot/values.yaml new file mode 100644 index 0000000..b5c8123 --- /dev/null +++ b/charts/telegram-pepperbot/values.yaml @@ -0,0 +1,76 @@ +# Default values for telegram-pepperbot. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# -- Number of Telegram-Pepperbot replicas to deploy +replicaCount: 2 +# -- Number of Telegram-Pepperbot revisions to keep +revisionHistoryLimit: 1 + +pepperbot: + # -- Telegram-Pepperbot Redis Host + redisHost: "redis-headless.example.svc.cluster.local" + # -- Telegram-Pepperbot Telegram Bot Token + telegramToken: "" + +image: + # -- Telegram-Pepperbot image repository + repository: marnixjanssen/telgram-pepperbot + # -- Telegram-Pepperbot image pull policy + pullPolicy: Always + # -- Overrides the image tag whose default is the chart appVersion. + tag: "" + +# -- Specify docker-registry secret names as an array +imagePullSecrets: [] +# -- String to partially override names.fullname +nameOverride: "" +# -- String to fully override names.fullname +fullnameOverride: "" + +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Annotations to add to the service account + annotations: {} + # -- The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +# -- Annotations for Telegram-Pepperbot pods +podAnnotations: {} + +# -- Pod Security Context for Telegram-Pepperbot pods +podSecurityContext: {} + # fsGroup: 2000 + +# -- Security Context for Telegram-Pepperbot +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +# -- Resources for pods. Evaluated as a template. +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +# -- Node labels for pod assignment. Evaluated as a template. +nodeSelector: {} + +# -- Tolerations for pod assignment. Evaluated as a template. +tolerations: [] + +# -- Affinity for pod assignment +affinity: {}