Skip to content
Merged
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
30 changes: 30 additions & 0 deletions argocd-helm-charts/goalerts/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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
*~
# Various IDEs
.project
.idea/
*.tmproj
# img folder
img/
# Changelog
CHANGELOG.md
package-lock.json
package.json
# Testing
docker-compose.yaml
tests
16 changes: 16 additions & 0 deletions argocd-helm-charts/goalerts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: goalerts
description: GoAlert - open source on-call scheduling, automated escalations and notifications.
type: application
version: 1.0.0
appVersion: v0.32.0
home: https://github.com/target/goalert
sources:
- https://github.com/target/goalert
keywords:
- on-call
- scheduling
- escalations
- notifications
- alerting
- incident-response
1 change: 1 addition & 0 deletions argocd-helm-charts/goalerts/charts/kubeaid-addons
76 changes: 76 additions & 0 deletions argocd-helm-charts/goalerts/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# goalert

GoAlert - open source on-call scheduling, automated escalations, and notifications. App version `v0.32.0`.

## 1. How to setup

GoAlert reads two values from an existing Secret (default name `goalert`, set via
`goalert.existingSecret.name`):

| Key | What it is |
|---|---|
| `GOALERT_DB_URL` | Postgres connection string |
| `GOALERT_DATA_ENCRYPTION_KEY` | Encrypts data at rest. **Back this up** - losing it makes encrypted data unrecoverable, and it must never change once set. |

### Create it

```bash
NS=goalert # your target namespace

# 1. A strong data-encryption key (store a copy somewhere safe):
ENC_KEY="$(openssl rand -base64 32)"

# 2. The DB URL. If you're using the CNPG cluster this chart provisions, read it
DB_URL="$(kubectl -n "$NS" get secret goalert-pgsql-app \
-o jsonpath='{.data.uri}' | base64 -d)?sslmode=require"

# 3. Create the Secret:
kubectl create secret generic goalert -n "$NS" \
--from-literal=GOALERT_DB_URL="$DB_URL" \
--from-literal=GOALERT_DATA_ENCRYPTION_KEY="$ENC_KEY"
```

Note: the CNPG cluster (and its `goalert-pgsql-app` secret) must exist first, so sync/deploy the chart once to provision the DB, then create this Secret.

### GitOps (sealed-secrets)

Seal the same object instead of applying it:

```bash
kubectl create secret generic goalert -n "$NS" \
--from-literal=GOALERT_DB_URL="$DB_URL" \
--from-literal=GOALERT_DATA_ENCRYPTION_KEY="$ENC_KEY" \
--dry-run=client -o yaml \
| kubeseal --format yaml > goalert-sealed-secret.yaml
```
(Offline sealing: `kubeseal --cert <controller-cert.pem>`.)

## 2. First admin user

GoAlert has **no default login** - create the first admin with its CLI inside the
pod (it uses `GOALERT_DB_URL` from the Secret above):

```bash
kubectl -n "$NS" exec -it deploy/goalerts -- goalert add-user --admin --user admin
```

Log in at your ingress URL with that account, then create real per-person admin
accounts from the UI and remove this bootstrap one.

## 3. Access

Set `ingress.*` in your values (host, `className`, TLS), or port-forward the
service (`:8081`) to reach the web UI.

## Configuration

| Value | Default | Notes |
|---|---|---|
| `goalert.existingSecret.name` | `goalert` | Secret holding the two keys above |
| `postgresql.enabled` | `false` | Bundled Postgres removed; use CNPG |
| `global.postgresql.enabled` | `true` | Provision the CNPG cluster via kubeaid-addons |
| `global.postgresql.instanceName` | `goalert` | → cluster `goalert-pgsql` |
| `ingress.enabled` | `false` | Set host/class/TLS to expose |
| `resources` | mem-limited | No CPU limit by policy |

Upstream project: https://github.com/target/goalert
82 changes: 82 additions & 0 deletions argocd-helm-charts/goalerts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "goalert.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 "goalert.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 "goalert.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "goalert.selectorLabels" -}}
app.kubernetes.io/name: {{ include "goalert.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "goalert.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "goalert.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Generate the PostgreSQL connection string
*/}}
{{- define "goalert.databaseUrl" -}}
{{- if .Values.postgresql.enabled -}}
{{- $postgresHost := printf "%s-postgresql" (include "goalert.fullname" .) -}}
{{- $postgresPort := .Values.postgresql.service.port | toString -}}
{{- $postgresUser := .Values.postgresql.auth.username -}}
{{- $postgresPassword := .Values.postgresql.auth.password -}}
{{- $postgresDatabase := .Values.postgresql.auth.database -}}
{{- $postgresSslMode := .Values.postgresql.sslmode -}}
{{- if or (not $postgresUser) (not $postgresPassword) (not $postgresDatabase) -}}
{{- fail "PostgreSQL username, password, and database must be provided" -}}
{{- end -}}
{{- printf "postgres://%s:%s@%s:%s/%s?sslmode=%s" $postgresUser $postgresPassword $postgresHost $postgresPort $postgresDatabase $postgresSslMode -}}
{{- else -}}
{{- .Values.goalert.environment.GOALERT_DB_URL -}}
{{- end -}}
{{- end -}}
76 changes: 76 additions & 0 deletions argocd-helm-charts/goalerts/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "goalert.fullname" . }}
labels:
{{- include "goalert.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "goalert.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "goalert.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "goalert.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
env:
{{- if .Values.goalert.existingSecret.name }}
{{- range $key, $value := .Values.goalert.existingSecret.keys }}
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ $.Values.goalert.existingSecret.name }}
key: {{ $value }}
{{- end }}
{{- else }}
- name: GOALERT_DB_URL
value: {{ include "goalert.databaseUrl" . | quote }}
- name: GOALERT_DATA_ENCRYPTION_KEY
value: {{ .Values.goalert.environment.GOALERT_DATA_ENCRYPTION_KEY | quote }}
{{- end }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
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 }}
61 changes: 61 additions & 0 deletions argocd-helm-charts/goalerts/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "goalert.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 "goalert.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 }}
15 changes: 15 additions & 0 deletions argocd-helm-charts/goalerts/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "goalert.fullname" . }}
labels:
{{- include "goalert.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "goalert.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions argocd-helm-charts/goalerts/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "goalert.serviceAccountName" . }}
labels:
{{- include "goalert.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading