Skip to content

Commit 8384fb4

Browse files
committed
feat(meowbot): add meowbot chart
1 parent 7a3759e commit 8384fb4

17 files changed

Lines changed: 545 additions & 0 deletions

charts/meowbot/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/meowbot/Chart.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
name: meowbot
3+
description: A Helm chart for Kubernetes
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.0.0"

charts/meowbot/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# meowbot Helm Chart
2+
3+
[![Chart Version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fdotablaze-tech%2Fdeployments%2Fmain%2Fcharts%2Fmeowbot%2FChart.yaml&query=%24.appVersion&prefix=v&label=Chart)](https://github.com/dotablaze-tech/deployments/blob/main/charts/meowbot/Chart.yaml)
4+
[![Dev Version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fdotablaze-tech%2Fdeployments%2Fmain%2Fcharts%2Fmeowbot%2Fvalues-dev.yaml&query=%24.image.tag&prefix=v&label=Dev)](https://github.com/dotablaze-tech/deployments/blob/main/charts/meowbot/values-dev.yaml)
5+
[![Prod Version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fdotablaze-tech%2Fdeployments%2Fmain%2Fcharts%2Fmeowbot%2Fvalues-prd.yaml&query=%24.image.tag&prefix=v&label=Prod)](https://github.com/dotablaze-tech/deployments/blob/main/charts/meowbot/values-prd.yaml)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7+
8+
This Helm chart is used to deploy the `meowbot` Discord bot on Kubernetes via Argo CD. It provides a customizable,
9+
environment-specific configuration for managing runtime secrets, autoscaling, ingress, and service exposure.
10+
11+
> **Note**: `meowbot` is built using [bwmarrin/discordgo](https://github.com/bwmarrin/discordgo) and supports regex-based interactions, per-guild state, logging via `slog`, and slash commands.
12+
13+
---
14+
15+
## 📁 Layout
16+
17+
- `Chart.yaml` – Chart metadata and versioning
18+
- `templates/` – Kubernetes manifests:
19+
- `deployment.yaml` – Discord bot deployment logic
20+
- `externalsecrets.yaml` – Secrets configuration (e.g., bot token)
21+
- `ingress.yaml`, `service.yaml` – Exposure options (if needed)
22+
- `hpa.yaml` – Autoscaling settings
23+
- `serviceaccount.yaml` – Optional service account
24+
- `NOTES.txt`, `tests/` – Installation notes and connectivity test
25+
- `values.yaml` – Base configuration
26+
- `values-dev.yaml`, `values-prd.yaml` – Environment-specific overrides
27+
28+
---
29+
30+
## 🚀 Deployment
31+
32+
This chart is deployed by Argo CD using an `ApplicationSet` generator that maps environments to values files.
33+
34+
To deploy manually for testing:
35+
36+
```bash
37+
helm upgrade --install meowbot ./meowbot -f values-dev.yaml
38+
```
39+
40+
To uninstall:
41+
42+
```bash
43+
helm uninstall meowbot
44+
```
45+
46+
---
47+
48+
## 📂 Path
49+
50+
This chart is located at:
51+
52+
```
53+
charts/
54+
└── meowbot/
55+
├── Chart.yaml
56+
├── values.yaml
57+
├── values-dev.yaml
58+
├── values-prd.yaml
59+
└── templates/
60+
├── deployment.yaml
61+
├── externalsecrets.yaml
62+
├── hpa.yaml
63+
├── ingress.yaml
64+
├── service.yaml
65+
├── serviceaccount.yaml
66+
├── _helpers.tpl
67+
├── NOTES.txt
68+
└── tests/
69+
└── test-connection.yaml
70+
```
71+
72+
---
73+
74+
## 🧠 Features
75+
76+
- 🧩 Slash commands & custom regex triggers
77+
- 📡 Multi-guild support with persistent state
78+
- 🔒 Secrets managed through External Secrets
79+
- 📈 Autoscaling via HPA
80+
- 🛡️ Minimal RBAC via ServiceAccount (optional)
81+
82+
---
83+
84+
## 📝 License
85+
86+
This chart is licensed under the [MIT License](https://opensource.org/licenses/MIT). See the `LICENSE` file for details.

charts/meowbot/templates/NOTES.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "meowbot.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "meowbot.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "meowbot.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "meowbot.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "meowbot.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "meowbot.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "meowbot.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "meowbot.labels" -}}
37+
helm.sh/chart: {{ include "meowbot.chart" . }}
38+
{{ include "meowbot.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "meowbot.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "meowbot.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "meowbot.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "meowbot.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "meowbot.fullname" . }}
5+
labels:
6+
{{- include "meowbot.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
12+
selector:
13+
matchLabels:
14+
{{- include "meowbot.selectorLabels" . | nindent 6 }}
15+
template:
16+
metadata:
17+
{{- with .Values.podAnnotations }}
18+
annotations:
19+
{{- toYaml . | nindent 8 }}
20+
{{- end }}
21+
labels:
22+
{{- include "meowbot.labels" . | nindent 8 }}
23+
{{- with .Values.podLabels }}
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
spec:
27+
{{- with .Values.imagePullSecrets }}
28+
imagePullSecrets:
29+
{{- toYaml . | nindent 8 }}
30+
{{- end }}
31+
serviceAccountName: {{ include "meowbot.serviceAccountName" . }}
32+
securityContext:
33+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
34+
containers:
35+
- name: {{ .Chart.Name }}
36+
securityContext:
37+
{{- toYaml .Values.securityContext | nindent 12 }}
38+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
39+
imagePullPolicy: {{ .Values.image.pullPolicy }}
40+
{{- if or .Values.envs .Values.envSecrets }}
41+
env:
42+
- name: SD_VERSION
43+
value: "{{ .Values.image.tag | default .Chart.AppVersion }}"
44+
{{- range $key, $value := .Values.envs }}
45+
- name: {{ $key }}
46+
value: {{ $value | quote }}
47+
{{- end }}
48+
{{- range .Values.envSecrets }}
49+
- name: {{ .secretKey }}
50+
valueFrom:
51+
secretKeyRef:
52+
name: {{ .secretName }}
53+
key: {{ .secretKey | quote }}
54+
{{- end }}
55+
{{- end }}
56+
ports:
57+
- name: http
58+
containerPort: {{ .Values.service.port }}
59+
protocol: TCP
60+
livenessProbe:
61+
{{- toYaml .Values.livenessProbe | nindent 12 }}
62+
readinessProbe:
63+
{{- toYaml .Values.readinessProbe | nindent 12 }}
64+
resources:
65+
{{- toYaml .Values.resources | nindent 12 }}
66+
{{- with .Values.volumeMounts }}
67+
volumeMounts:
68+
{{- toYaml . | nindent 12 }}
69+
{{- end }}
70+
{{- with .Values.volumes }}
71+
volumes:
72+
{{- toYaml . | nindent 8 }}
73+
{{- end }}
74+
{{- with .Values.nodeSelector }}
75+
nodeSelector:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}
78+
{{- with .Values.affinity }}
79+
affinity:
80+
{{- toYaml . | nindent 8 }}
81+
{{- end }}
82+
{{- with .Values.tolerations }}
83+
tolerations:
84+
{{- toYaml . | nindent 8 }}
85+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{- range .Values.externalSecrets }}
2+
{{- $secretName := .secretName }}
3+
apiVersion: external-secrets.io/v1beta1
4+
kind: ExternalSecret
5+
metadata:
6+
name: {{ $secretName }}
7+
spec:
8+
refreshInterval: {{ .refreshInterval }}
9+
secretStoreRef:
10+
name: {{ .secretStoreName }}
11+
kind: SecretStore
12+
target:
13+
name: {{ $secretName }}
14+
data:
15+
{{- range $.Values.envSecrets }}
16+
{{ if eq .secretName $secretName }}
17+
- secretKey: {{ .secretKey }}
18+
remoteRef:
19+
key: {{ .key }}
20+
property: {{ .property }}
21+
{{- end }}
22+
{{- end }}
23+
---
24+
{{- end }}

charts/meowbot/templates/hpa.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "meowbot.fullname" . }}
6+
labels:
7+
{{- include "meowbot.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "meowbot.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
target:
21+
type: Utilization
22+
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
23+
{{- end }}
24+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
25+
- type: Resource
26+
resource:
27+
name: memory
28+
target:
29+
type: Utilization
30+
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
31+
{{- end }}
32+
{{- end }}

0 commit comments

Comments
 (0)