Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ jobs:
id: helm-tests
continue-on-error: true
run: |

# Create log directory
mkdir -p /tmp/helm-logs

Expand Down
23 changes: 23 additions & 0 deletions charts/postmortem-bot/.helmignore
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/
5 changes: 5 additions & 0 deletions charts/postmortem-bot/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: postmortem-bot
version: 0.1.0
description: A Helm chart for deploying the Postmortem Automation Bot (Webhook Server & Discord Bot)
appVersion: "1.0.0"
145 changes: 145 additions & 0 deletions charts/postmortem-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Postmortem Bot Helm Chart

This Helm chart deploys the Postmortem Automation Bot to your Kubernetes cluster, including both the webhook server and Discord bot.

## Prerequisites

- Kubernetes cluster (1.19+)
- Helm 3.x
- Docker image built and pushed to container registry

## Installation

### Quick Install

```bash
helm install postmortem-bot ./helm/postmortem-bot
```

### Install with Custom Values

```bash
helm install postmortem-bot ./helm/postmortem-bot \
--set webhook.image.repository=ghcr.io/techops-services/postmortem-automation \
--set webhook.image.tag=v1.0.0 \
--set discordbot.image.repository=ghcr.io/techops-services/postmortem-automation \
--set discordbot.image.tag=v1.0.0
```

### Install with Values File

Create a `custom-values.yaml`:

```yaml
webhook:
enabled: true
replicaCount: 2
image:
repository: ghcr.io/techops-services/postmortem-automation
tag: v1.0.0
env:
- name: PAGERDUTY_API_KEY
valueFrom:
secretKeyRef:
name: postmortem-secrets
key: pagerduty-api-key
- name: DISCORD_WEBHOOK_URL
valueFrom:
secretKeyRef:
name: postmortem-secrets
key: discord-webhook-url

discordbot:
enabled: true
replicaCount: 1
image:
repository: ghcr.io/techops-services/postmortem-automation
tag: v1.0.0
env:
- name: DISCORD_BOT_TOKEN
valueFrom:
secretKeyRef:
name: postmortem-secrets
key: discord-bot-token
```

Then install:

```bash
helm install postmortem-bot ./helm/postmortem-bot -f custom-values.yaml
```

## Configuration

### Webhook Server Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `webhook.enabled` | Enable webhook deployment | `true` |
| `webhook.replicaCount` | Number of replicas | `1` |
| `webhook.image.repository` | Image repository | `ghcr.io/techops-services/postmortem-automation` |
| `webhook.image.tag` | Image tag | `latest` |
| `webhook.service.type` | Service type | `ClusterIP` |
| `webhook.service.port` | Service port | `8080` |
| `webhook.resources` | Resource limits/requests | See values.yaml |
| `webhook.env` | Environment variables | `[]` |

### Discord Bot Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `discordbot.enabled` | Enable Discord bot deployment | `true` |
| `discordbot.replicaCount` | Number of replicas | `1` |
| `discordbot.image.repository` | Image repository | `ghcr.io/techops-services/postmortem-automation` |
| `discordbot.image.tag` | Image tag | `latest` |
| `discordbot.service.type` | Service type | `ClusterIP` |
| `discordbot.service.port` | Service port | `8081` |
| `discordbot.resources` | Resource limits/requests | See values.yaml |
| `discordbot.env` | Environment variables | `[]` |

## Creating Secrets

Before deploying, create a Kubernetes secret with your credentials:

```bash
kubectl create secret generic postmortem-secrets \
--from-literal=pagerduty-api-key=YOUR_PAGERDUTY_KEY \
--from-literal=discord-webhook-url=YOUR_DISCORD_WEBHOOK \
--from-literal=discord-bot-token=YOUR_DISCORD_BOT_TOKEN \
--from-literal=google-drive-folder-id=YOUR_FOLDER_ID
```

## Upgrading

```bash
helm upgrade postmortem-bot ./helm/postmortem-bot -f custom-values.yaml
```

## Uninstalling

```bash
helm uninstall postmortem-bot
```

## Examples

### Deploy Only Webhook Server

```bash
helm install postmortem-bot ./helm/postmortem-bot \
--set discordbot.enabled=false
```

### Deploy Only Discord Bot

```bash
helm install postmortem-bot ./helm/postmortem-bot \
--set webhook.enabled=false
```

### Scale Webhook Replicas

```bash
helm upgrade postmortem-bot ./helm/postmortem-bot \
--set webhook.replicaCount=3
```
45 changes: 45 additions & 0 deletions charts/postmortem-bot/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "postmortem-bot.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "postmortem-bot.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "postmortem-bot.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "postmortem-bot.labels" -}}
helm.sh/chart: {{ include "postmortem-bot.chart" . }}
{{ include "postmortem-bot.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
{{- define "postmortem-bot.selectorLabels" -}}
app.kubernetes.io/name: {{ include "postmortem-bot.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
46 changes: 46 additions & 0 deletions charts/postmortem-bot/templates/discordbot-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- if .Values.discordbot.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "postmortem-bot.fullname" . }}-discordbot
labels:
{{- include "postmortem-bot.labels" . | nindent 4 }}
app.kubernetes.io/component: discordbot
spec:
replicas: {{ .Values.discordbot.replicaCount }}
selector:
matchLabels:
{{- include "postmortem-bot.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: discordbot
template:
metadata:
labels:
{{- include "postmortem-bot.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: discordbot
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: discordbot
image: "{{ .Values.discordbot.image.repository }}:{{ .Values.discordbot.image.tag }}"
imagePullPolicy: {{ .Values.discordbot.image.pullPolicy }}
args: ["discordbot"]
ports:
- name: http
containerPort: 8081
protocol: TCP
env:
{{- range .Values.discordbot.env }}
- name: {{ .name }}
{{- if .value }}
value: {{ .value | quote }}
{{- else if .valueFrom }}
valueFrom:
{{- toYaml .valueFrom | nindent 16 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.discordbot.resources | nindent 12 }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/postmortem-bot/templates/discordbot-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.discordbot.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "postmortem-bot.fullname" . }}-discordbot
labels:
{{- include "postmortem-bot.labels" . | nindent 4 }}
app.kubernetes.io/component: discordbot
spec:
type: {{ .Values.discordbot.service.type }}
ports:
- port: {{ .Values.discordbot.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "postmortem-bot.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: discordbot
{{- end }}
58 changes: 58 additions & 0 deletions charts/postmortem-bot/templates/webhook-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{{- if .Values.webhook.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "postmortem-bot.fullname" . }}-webhook
labels:
{{- include "postmortem-bot.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
spec:
replicas: {{ .Values.webhook.replicaCount }}
selector:
matchLabels:
{{- include "postmortem-bot.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: webhook
template:
metadata:
labels:
{{- include "postmortem-bot.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: webhook
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: webhook
image: "{{ .Values.webhook.image.repository }}:{{ .Values.webhook.image.tag }}"
imagePullPolicy: {{ .Values.webhook.image.pullPolicy }}
args: ["webhook"]
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
{{- range .Values.webhook.env }}
- name: {{ .name }}
{{- if .value }}
value: {{ .value | quote }}
{{- else if .valueFrom }}
valueFrom:
{{- toYaml .valueFrom | nindent 16 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.webhook.resources | nindent 12 }}
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 5
periodSeconds: 5
{{- end }}
19 changes: 19 additions & 0 deletions charts/postmortem-bot/templates/webhook-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.webhook.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "postmortem-bot.fullname" . }}-webhook
labels:
{{- include "postmortem-bot.labels" . | nindent 4 }}
app.kubernetes.io/component: webhook
spec:
type: {{ .Values.webhook.service.type }}
ports:
- port: {{ .Values.webhook.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "postmortem-bot.selectorLabels" . | nindent 4 }}
app.kubernetes.io/component: webhook
{{- end }}
Loading
Loading