-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9053c0
commit e1e8bcf
Showing
10 changed files
with
512 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: v2 | ||
name: tesbot | ||
description: A Helm chart for deploying the tesbot application | ||
home: https://github.com/glenndehaan/charts | ||
keywords: | ||
- telegram | ||
- tesla | ||
- 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# tesbot | ||
|
||
![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 tesbot application | ||
|
||
**Homepage:** <https://github.com/glenndehaan/charts> | ||
|
||
## Maintainers | ||
|
||
| Name | Email | Url | | ||
| ---- | ------ | --- | | ||
| glenndehaan | <glenn@dehaan.cloud> | <https://glenndehaan.com> | | ||
|
||
## Source Code | ||
|
||
* <https://github.com/glenndehaan/charts> | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| affinity | object | `{}` | Affinity for pod assignment | | ||
| fullnameOverride | string | `""` | String to fully override names.fullname | | ||
| image.pullPolicy | string | `"Always"` | tesbot image pull policy | | ||
| image.repository | string | `"glenndehaan/tesbot"` | tesbot 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 | | ||
| ingress.annotations | object | `{}` | Additional annotations for the Ingress resource. To enable certificate autogeneration, place here your cert-manager annotations. | | ||
| ingress.className | string | `""` | Set the ingressClassName on the ingress record for k8s 1.18+ | | ||
| ingress.enabled | bool | `false` | Set to true to enable ingress record generation | | ||
| ingress.hosts[0] | object | `{"host":"tesbot.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}` | Default host | | ||
| ingress.tls | list | `[]` | TLS secret configuration | | ||
| nameOverride | string | `""` | String to partially override names.fullname | | ||
| nodeSelector | object | `{}` | Node labels for pod assignment. Evaluated as a template. | | ||
| podAnnotations | object | `{}` | Annotations for tesbot pods | | ||
| podSecurityContext | object | `{}` | Pod Security Context for tesbot pods | | ||
| replicaCount | int | `4` | Number of tesbot replicas to deploy | | ||
| resources | object | `{"limits":{"memory":"25Mi"},"requests":{"memory":"25Mi"}}` | Resources for pods. Evaluated as a template. | | ||
| revisionHistoryLimit | int | `1` | Number of tesbot revisions to keep | | ||
| securityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"privileged":false,"readOnlyRootFilesystem":true}` | Security Context for tesbot | | ||
| service.port | int | `8080` | Service HTTP port | | ||
| service.type | string | `"ClusterIP"` | Service type | | ||
| 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 | | ||
| tesbot.deployments | object | `{"bot":true,"processor":true}` | tesbot Deployment Toggles | | ||
| tesbot.deployments.bot | bool | `true` | tesbot Enables/Disabled the bot deployment | | ||
| tesbot.deployments.processor | bool | `true` | tesbot Enables/Disabled the processor deployment | | ||
| tesbot.logLevel | string | `"info"` | tesbot Logger Level | | ||
| tesbot.redisHost | string | `"redis-headless.example.svc.cluster.local"` | tesbot Redis Host | | ||
| tesbot.telegramToken | string | `""` | tesbot Telegram Bot Token | | ||
| 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Please wait a few seconds until the {{ .Chart.Name }} chart is fully installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "tesbot.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 "tesbot.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 "tesbot.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "tesbot.labels" -}} | ||
helm.sh/chart: {{ include "tesbot.chart" . }} | ||
{{ include "tesbot.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "tesbot.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "tesbot.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "tesbot.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "tesbot.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{{- if .Values.tesbot.deployments.processor -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: processor-{{ include "tesbot.fullname" . }} | ||
labels: | ||
{{- include "tesbot.labels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} | ||
selector: | ||
matchLabels: | ||
{{- include "tesbot.selectorLabels" . | nindent 6 }} | ||
app.kubernetes.io/type: processor | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "tesbot.selectorLabels" . | nindent 8 }} | ||
app.kubernetes.io/type: processor | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "tesbot.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.tesbot.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 }} | ||
command: ["dumb-init", "processor"] | ||
env: | ||
- name: HELM_CHART_VERSION | ||
value: "v{{ .Chart.Version }}" | ||
- name: REDIS_URL | ||
value: "redis://{{ .Values.tesbot.redisHost }}:6379" | ||
- name: TELOXIDE_TOKEN | ||
value: "{{ .Values.tesbot.telegramToken }}" | ||
- name: RUST_LOG | ||
value: "{{ .Values.tesbot.logLevel }}" | ||
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 }} | ||
--- | ||
{{- end }} | ||
{{- if .Values.tesbot.deployments.bot -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: bot-{{ include "tesbot.fullname" . }} | ||
labels: | ||
{{- include "tesbot.labels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} | ||
selector: | ||
matchLabels: | ||
{{- include "tesbot.selectorLabels" . | nindent 6 }} | ||
app.kubernetes.io/type: bot | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "tesbot.selectorLabels" . | nindent 8 }} | ||
app.kubernetes.io/type: bot | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "tesbot.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.tesbot.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 }} | ||
command: ["dumb-init", "bot"] | ||
env: | ||
- name: HELM_CHART_VERSION | ||
value: "v{{ .Chart.Version }}" | ||
- name: REDIS_URL | ||
value: "redis://{{ .Values.tesbot.redisHost }}:6379" | ||
- name: TELOXIDE_TOKEN | ||
value: "{{ .Values.tesbot.telegramToken }}" | ||
- name: RUST_LOG | ||
value: "{{ .Values.tesbot.logLevel }}" | ||
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 }} | ||
--- | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "tesbot.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} | ||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} | ||
{{- end }} | ||
{{- end }} | ||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1 | ||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||
apiVersion: networking.k8s.io/v1beta1 | ||
{{- else -}} | ||
apiVersion: extensions/v1beta1 | ||
{{- end }} | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "tesbot.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||
ingressClassName: {{ .Values.ingress.className }} | ||
{{- end }} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
{{- range .paths }} | ||
- path: {{ .path }} | ||
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} | ||
pathType: {{ .pathType }} | ||
{{- end }} | ||
backend: | ||
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- else }} | ||
serviceName: {{ $fullName }} | ||
servicePort: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.