Merge pull request 'feat(deploy): Helm chart' (#139) from feat/helm into main
This commit was merged in pull request #139.
This commit is contained in:
commit
b05afc8c79
16 files changed
+1202
-2
No files matched your search
@@ -13,6 +13,7 @@ concurrency:
|
|||||||
env:
|
env:
|
||||||
GOLANGCI_LINT_VERSION: v2.15.0
|
GOLANGCI_LINT_VERSION: v2.15.0
|
||||||
SQLC_VERSION: v1.31.1
|
SQLC_VERSION: v1.31.1
|
||||||
|
HELM_VERSION: v3.19.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
@@ -45,6 +46,21 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
|
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
|
||||||
"$(go env GOPATH)/bin/golangci-lint" run ./...
|
"$(go env GOPATH)/bin/golangci-lint" run ./...
|
||||||
|
- name: Helm chart
|
||||||
|
run: |
|
||||||
|
curl -fsSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" | tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
|
||||||
|
chart=deploy/helm/uptimesebi
|
||||||
|
base="--set publicURL=https://uptime.example.com --set redis.url=redis://redis:6379/0 --set secretKeys.value=k1:test"
|
||||||
|
helm lint --strict "$chart" $base --set database.url=postgres://u:p@db/uptime
|
||||||
|
# Every combination renders; missing settings fail with a message.
|
||||||
|
helm template t "$chart" $base --set database.url=postgres://u:p@db/uptime >/dev/null
|
||||||
|
helm template t "$chart" $base --set database.bundled.enabled=true --set ingress.enabled=true --set ingress.tls.enabled=true \
|
||||||
|
--set checker.enabled=true --set checker.token=usa_x --set statuspage.enabled=true --set statuspage.token=usa_y \
|
||||||
|
--set 'statuspage.hosts={status.example.com}' --set statuspage.ingress.enabled=true \
|
||||||
|
--set redis.sentinel.master=m --set 'redis.sentinel.addrs={s1:26379}' --set redis.sentinel.password=p >/dev/null
|
||||||
|
helm template t "$chart" --set publicURL=https://uptime.example.com --set secretKeys.value=k1:test \
|
||||||
|
--set database.bundled.enabled=true --set redis.bundled.enabled=true --set redis.bundled.persistence.enabled=false >/dev/null
|
||||||
|
if helm template t "$chart" $base >/dev/null 2>&1; then echo "rendered without a database" >&2; exit 1; fi
|
||||||
# The install script the API serves must stay POSIX sh for Alpine,
|
# The install script the API serves must stay POSIX sh for Alpine,
|
||||||
# Debian and Raspberry Pi OS; the test renders and checks it.
|
# Debian and Raspberry Pi OS; the test renders and checks it.
|
||||||
- name: shellcheck
|
- name: shellcheck
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: npm ci --no-audit --no-fund && npm run build
|
run: npm ci --no-audit --no-fund && npm run build
|
||||||
|
- name: Package Helm chart
|
||||||
|
run: |
|
||||||
|
curl -fsSL "https://get.helm.sh/helm-v3.19.0-linux-amd64.tar.gz" | tar -xz -C /usr/local/bin --strip-components=1 linux-amd64/helm
|
||||||
|
# Chart and app version follow the release; image tags drop the v.
|
||||||
|
helm package deploy/helm/uptimesebi --version "${GITHUB_REF_NAME#v}" --app-version "${GITHUB_REF_NAME#v}" -d dist
|
||||||
- name: Build binaries
|
- name: Build binaries
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
@@ -48,7 +53,7 @@ jobs:
|
|||||||
tar -C dist -czf "dist/$dir.tar.gz" "$dir"
|
tar -C dist -czf "dist/$dir.tar.gz" "$dir"
|
||||||
done
|
done
|
||||||
go run ./tools/release sbom "$GITHUB_REF_NAME" dist/uptimesebi_*_linux_amd64/{api,checker,statuspage} > dist/sbom.spdx.json
|
go run ./tools/release sbom "$GITHUB_REF_NAME" dist/uptimesebi_*_linux_amd64/{api,checker,statuspage} > dist/sbom.spdx.json
|
||||||
(cd dist && sha256sum ./*.tar.gz ./sbom.spdx.json | sed 's| \./| |' > SHA256SUMS)
|
(cd dist && sha256sum ./*.tar.gz ./*.tgz ./sbom.spdx.json | sed 's| \./| |' > SHA256SUMS)
|
||||||
cat dist/SHA256SUMS
|
cat dist/SHA256SUMS
|
||||||
- name: Sign checksums
|
- name: Sign checksums
|
||||||
env:
|
env:
|
||||||
@@ -73,8 +78,20 @@ jobs:
|
|||||||
go run ./tools/release notes -json "$GITHUB_REF_NAME" > release.json
|
go run ./tools/release notes -json "$GITHUB_REF_NAME" > release.json
|
||||||
id="$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
id="$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||||
--data-binary @release.json "$api/releases" | grep -o '"id":[0-9]*' | head -n1 | cut -d: -f2)"
|
--data-binary @release.json "$api/releases" | grep -o '"id":[0-9]*' | head -n1 | cut -d: -f2)"
|
||||||
for f in dist/*.tar.gz dist/sbom.spdx.json dist/SHA256SUMS dist/SHA256SUMS.minisig; do
|
for f in dist/*.tar.gz dist/*.tgz dist/sbom.spdx.json dist/SHA256SUMS dist/SHA256SUMS.minisig; do
|
||||||
[ -f "$f" ] || continue
|
[ -f "$f" ] || continue
|
||||||
curl -fsS -o /dev/null -X POST -H "Authorization: token $TOKEN" \
|
curl -fsS -o /dev/null -X POST -H "Authorization: token $TOKEN" \
|
||||||
-F "attachment=@$f" "$api/releases/$id/assets?name=$(basename "$f")"
|
-F "attachment=@$f" "$api/releases/$id/assets?name=$(basename "$f")"
|
||||||
done
|
done
|
||||||
|
# helm repo add uptimesebi <server>/api/packages/<owner>/helm
|
||||||
|
- name: Publish Helm chart
|
||||||
|
env:
|
||||||
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$PACKAGE_TOKEN" ]; then
|
||||||
|
echo "::warning::PACKAGE_TOKEN is not set; the chart is only attached to the release."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
owner="$(printf '%s' "${GITHUB_REPOSITORY%/*}" | tr 'A-Z' 'a-z')"
|
||||||
|
curl -fsS --user "$GITHUB_ACTOR:$PACKAGE_TOKEN" -X POST --upload-file dist/uptimesebi-*.tgz \
|
||||||
|
"$GITHUB_SERVER_URL/api/packages/$owner/helm/api/charts"
|
||||||
@@ -123,6 +123,22 @@ All settings are environment variables; [`.env.example`](.env.example) lists the
|
|||||||
- `UPTIME_TRUSTED_PROXIES` must name your reverse proxy, or client addresses in the audit log and rate limits will be the proxy's.
|
- `UPTIME_TRUSTED_PROXIES` must name your reverse proxy, or client addresses in the audit log and rate limits will be the proxy's.
|
||||||
- `UPTIME_RETENTION_*` set how long results, aggregates, audit entries and captured responses are kept.
|
- `UPTIME_RETENTION_*` set how long results, aggregates, audit entries and captured responses are kept.
|
||||||
|
|
||||||
|
### Kubernetes
|
||||||
|
|
||||||
|
The Helm chart in [`deploy/helm/uptimesebi`](deploy/helm/uptimesebi) runs the console and API, and optionally a checker and status page servers in the cluster. Bring your own PostgreSQL with TimescaleDB and your own Redis (directly or through Sentinel). Each release publishes the chart:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
helm repo add uptimesebi https://git.zb-server.de/api/packages/zb-server/helm
|
||||||
|
helm install uptime uptimesebi/uptimesebi -n uptime --create-namespace \
|
||||||
|
--set publicURL=https://uptime.example.com \
|
||||||
|
--set database.url='postgres://uptime:…@db:5432/uptime?sslmode=require' \
|
||||||
|
--set redis.url='redis://:…@redis:6379/0' \
|
||||||
|
--set secretKeys.value="k1:$(head -c32 /dev/urandom | base64)" \
|
||||||
|
--set ingress.enabled=true --set ingress.tls.enabled=true
|
||||||
|
```
|
||||||
|
|
||||||
|
Every setting can come from an existing secret instead (`existingSecret`); [`values.yaml`](deploy/helm/uptimesebi/values.yaml) explains them all. Migrations run as a hook before each install and upgrade. To try it out without a database and Redis of your own, `--set database.bundled.enabled=true --set redis.bundled.enabled=true` adds a single TimescaleDB and Redis, without backups or high availability. Pods run unprivileged with a read-only root filesystem; the API pods need amd64 nodes, checkers and status page servers run on ARM too.
|
||||||
|
|
||||||
Run as many API, checker and status page instances as you need; they share no local state. The supported setups are:
|
Run as many API, checker and status page instances as you need; they share no local state. The supported setups are:
|
||||||
|
|
||||||
| Mode | Console and API | Checkers | Status pages |
|
| Mode | Console and API | Checkers | Status pages |
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
.DS_Store
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
ci/
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: uptimesebi
|
||||||
|
description: Uptime monitoring with checkers in many regions and public status pages.
|
||||||
|
type: application
|
||||||
|
# The release workflow sets both versions from the release tag.
|
||||||
|
version: 0.0.0-dev
|
||||||
|
appVersion: edge
|
||||||
|
home: https://git.zb-server.de/ZB-Server/uptimesebi
|
||||||
|
sources:
|
||||||
|
- https://git.zb-server.de/ZB-Server/uptimesebi
|
||||||
|
keywords:
|
||||||
|
- monitoring
|
||||||
|
- uptime
|
||||||
|
- status-page
|
||||||
|
kubeVersion: ">=1.27.0-0"
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
UptimeSebi {{ include "uptimesebi.tag" . }} is being rolled out.
|
||||||
|
|
||||||
|
Console: {{ .Values.publicURL }}
|
||||||
|
{{- if not .Values.ingress.enabled }}
|
||||||
|
No ingress is enabled; try it with:
|
||||||
|
kubectl -n {{ .Release.Namespace }} port-forward svc/{{ include "uptimesebi.fullname" . }}-api {{ .Values.api.service.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if eq .Values.signup "first-user" }}
|
||||||
|
The first account to sign up becomes the administrator.
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
Checkers and status page servers outside the cluster: create them in the
|
||||||
|
console (Settings -> Regions) and install them with the command shown there.
|
||||||
|
{{- if or .Values.database.bundled.enabled .Values.redis.bundled.enabled }}
|
||||||
|
|
||||||
|
The bundled {{ if .Values.database.bundled.enabled }}database{{ end }}{{ if and .Values.database.bundled.enabled .Values.redis.bundled.enabled }} and {{ end }}{{ if .Values.redis.bundled.enabled }}Redis{{ end }} are meant for trying UptimeSebi out: no backups
|
||||||
|
and no high availability. Their volumes and passwords are kept on uninstall.
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
{{/* Names and labels. */}}
|
||||||
|
{{- define "uptimesebi.name" -}}
|
||||||
|
{{- .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "uptimesebi.fullname" -}}
|
||||||
|
{{- if contains .Chart.Name .Release.Name -}}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "uptimesebi.labels" -}}
|
||||||
|
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
app.kubernetes.io/name: {{ include "uptimesebi.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
app.kubernetes.io/version: {{ include "uptimesebi.tag" . | quote }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* selector labels of one component: include with (list . "api"). */}}
|
||||||
|
{{- define "uptimesebi.selector" -}}
|
||||||
|
{{- $root := index . 0 -}}
|
||||||
|
app.kubernetes.io/name: {{ include "uptimesebi.name" $root }}
|
||||||
|
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||||
|
app.kubernetes.io/component: {{ index . 1 }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "uptimesebi.tag" -}}
|
||||||
|
{{- .Values.image.tag | default .Chart.AppVersion -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* image of a component: include with (list . "" | "-checker" | "-statuspage"). */}}
|
||||||
|
{{- define "uptimesebi.image" -}}
|
||||||
|
{{- $root := index . 0 -}}
|
||||||
|
{{- printf "%s%s:%s" $root.Values.image.repository (index . 1) (include "uptimesebi.tag" $root) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "uptimesebi.secretName" -}}
|
||||||
|
{{- include "uptimesebi.fullname" . }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "uptimesebi.apiURL" -}}
|
||||||
|
{{- printf "http://%s-api:%d" (include "uptimesebi.fullname" .) (int .Values.api.service.port) -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "uptimesebi.publicHost" -}}
|
||||||
|
{{- .Values.ingress.host | default (urlParse (required "publicURL is required, e.g. https://uptime.example.com" .Values.publicURL)).host -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
secretEnv renders an env var from a value or an existing secret: include
|
||||||
|
with (list $secret "UPTIME_X" .Values.x.existingSecret .Values.x.existingSecretKey "x-key"),
|
||||||
|
where $secret is the chart's secret holding values under the last argument.
|
||||||
|
*/}}
|
||||||
|
{{- define "uptimesebi.secretEnv" -}}
|
||||||
|
- name: {{ index . 1 }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
{{- if index . 2 }}
|
||||||
|
name: {{ index . 2 }}
|
||||||
|
key: {{ index . 3 }}
|
||||||
|
{{- else }}
|
||||||
|
name: {{ index . 0 }}
|
||||||
|
key: {{ index . 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* secretData is what the chart's secrets hold, as YAML. */}}
|
||||||
|
{{- define "uptimesebi.secretData" -}}
|
||||||
|
{{- $data := dict -}}
|
||||||
|
{{- if and .Values.secretKeys.value (not .Values.secretKeys.existingSecret) }}{{ $_ := set $data "secret-keys" .Values.secretKeys.value }}{{ end -}}
|
||||||
|
{{- if and .Values.database.url (not .Values.database.existingSecret) (not .Values.database.bundled.enabled) }}{{ $_ := set $data "database-url" .Values.database.url }}{{ end -}}
|
||||||
|
{{- if and .Values.redis.url (not .Values.redis.existingSecret) (not .Values.redis.bundled.enabled) }}{{ $_ := set $data "redis-url" .Values.redis.url }}{{ end -}}
|
||||||
|
{{- if and .Values.redis.sentinel.password (not .Values.redis.sentinel.existingSecret) }}{{ $_ := set $data "redis-sentinel-password" .Values.redis.sentinel.password }}{{ end -}}
|
||||||
|
{{- if and .Values.smtp.url (not .Values.smtp.existingSecret) }}{{ $_ := set $data "smtp-url" .Values.smtp.url }}{{ end -}}
|
||||||
|
{{- if and .Values.checker.token (not .Values.checker.existingSecret) }}{{ $_ := set $data "checker-token" .Values.checker.token }}{{ end -}}
|
||||||
|
{{- if and .Values.statuspage.token (not .Values.statuspage.existingSecret) }}{{ $_ := set $data "statuspage-token" .Values.statuspage.token }}{{ end -}}
|
||||||
|
{{- if $data }}{{ toYaml $data }}{{ end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* databaseSet tells whether a database is configured. */}}
|
||||||
|
{{- define "uptimesebi.databaseSet" -}}
|
||||||
|
{{- if or .Values.database.url .Values.database.existingSecret .Values.database.bundled.enabled -}}true{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Environment of the API and the migrations: include with (list . $secret),
|
||||||
|
$secret being the chart secret to read values from.
|
||||||
|
*/}}
|
||||||
|
{{- define "uptimesebi.platformEnv" -}}
|
||||||
|
{{- $secret := index . 1 -}}
|
||||||
|
{{- with index . 0 -}}
|
||||||
|
- name: UPTIME_EDITION
|
||||||
|
value: {{ .Values.edition | quote }}
|
||||||
|
- name: UPTIME_LOG_LEVEL
|
||||||
|
value: {{ .Values.logLevel | quote }}
|
||||||
|
- name: UPTIME_PUBLIC_URL
|
||||||
|
value: {{ required "publicURL is required, e.g. https://uptime.example.com" .Values.publicURL | trimSuffix "/" | quote }}
|
||||||
|
- name: UPTIME_SIGNUP
|
||||||
|
value: {{ .Values.signup | quote }}
|
||||||
|
- name: UPTIME_AGENT_IMAGE
|
||||||
|
value: {{ .Values.image.repository | quote }}
|
||||||
|
{{- with .Values.trustedProxies }}
|
||||||
|
- name: UPTIME_TRUSTED_PROXIES
|
||||||
|
value: {{ join "," . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.statusPageURL }}
|
||||||
|
- name: UPTIME_STATUSPAGE_URL
|
||||||
|
value: {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if not (include "uptimesebi.databaseSet" .) }}
|
||||||
|
{{- fail "set database.url, database.existingSecret or database.bundled.enabled" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.database.bundled.enabled }}
|
||||||
|
- name: UPTIME_DB_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-db
|
||||||
|
key: password
|
||||||
|
- name: UPTIME_DATABASE_URL
|
||||||
|
value: {{ printf "postgres://uptime:$(UPTIME_DB_PASSWORD)@%s-db:5432/uptime?sslmode=disable" (include "uptimesebi.fullname" .) | quote }}
|
||||||
|
{{- else }}
|
||||||
|
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_DATABASE_URL" .Values.database.existingSecret .Values.database.existingSecretKey "database-url") }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.bundled.enabled }}
|
||||||
|
- name: UPTIME_REDIS_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-redis
|
||||||
|
key: password
|
||||||
|
- name: UPTIME_REDIS_URL
|
||||||
|
value: {{ printf "redis://:$(UPTIME_REDIS_PASSWORD)@%s-redis:6379/0" (include "uptimesebi.fullname" .) | quote }}
|
||||||
|
{{- else if .Values.redis.sentinel.master }}
|
||||||
|
- name: UPTIME_REDIS_SENTINEL_MASTER
|
||||||
|
value: {{ .Values.redis.sentinel.master | quote }}
|
||||||
|
- name: UPTIME_REDIS_SENTINEL_ADDRS
|
||||||
|
value: {{ required "redis.sentinel.addrs is required with redis.sentinel.master" .Values.redis.sentinel.addrs | join "," | quote }}
|
||||||
|
{{- with .Values.redis.sentinel.username }}
|
||||||
|
- name: UPTIME_REDIS_SENTINEL_USERNAME
|
||||||
|
value: {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.redis.sentinel.password .Values.redis.sentinel.existingSecret }}
|
||||||
|
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_REDIS_SENTINEL_PASSWORD" .Values.redis.sentinel.existingSecret .Values.redis.sentinel.existingSecretKey "redis-sentinel-password") }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if or .Values.redis.url .Values.redis.existingSecret }}
|
||||||
|
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_REDIS_URL" .Values.redis.existingSecret .Values.redis.existingSecretKey "redis-url") }}
|
||||||
|
{{- else }}
|
||||||
|
{{- fail "set redis.url, redis.existingSecret, redis.sentinel.master or redis.bundled.enabled" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.secretKeys.value .Values.secretKeys.existingSecret }}
|
||||||
|
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_SECRET_KEYS" .Values.secretKeys.existingSecret .Values.secretKeys.existingSecretKey "secret-keys") }}
|
||||||
|
{{- else }}
|
||||||
|
{{- fail "set secretKeys.value or secretKeys.existingSecret, e.g. k1:$(head -c32 /dev/urandom | base64)" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.smtp.url .Values.smtp.existingSecret }}
|
||||||
|
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_SMTP_URL" .Values.smtp.existingSecret .Values.smtp.existingSecretKey "smtp-url") }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.extraEnv }}
|
||||||
|
{{ toYaml . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Volumes every pod gets: the root filesystem is read-only. */}}
|
||||||
|
{{- define "uptimesebi.tmpVolume" -}}
|
||||||
|
- name: tmp
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
sizeLimit: 64Mi
|
||||||
|
{{- end -}}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
{{- $secret := include "uptimesebi.secretName" . }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-api
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.api.replicas }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "api") | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "api") | nindent 8 }}
|
||||||
|
annotations:
|
||||||
|
# Roll the pods when values in the chart's secret change.
|
||||||
|
checksum/secret: {{ include "uptimesebi.secretData" . | sha256sum }}
|
||||||
|
{{- with .Values.api.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
{{- if and .Values.migrations.enabled .Values.database.bundled.enabled }}
|
||||||
|
initContainers:
|
||||||
|
# With the bundled database the migrations cannot run as a hook
|
||||||
|
# before the install; concurrent runs serialize on a lock.
|
||||||
|
- name: migrate
|
||||||
|
image: {{ include "uptimesebi.image" (list . "") }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
args: [migrate, up]
|
||||||
|
env:
|
||||||
|
{{- include "uptimesebi.platformEnv" (list . $secret) | nindent 12 }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.migrations.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
{{- end }}
|
||||||
|
containers:
|
||||||
|
- name: api
|
||||||
|
image: {{ include "uptimesebi.image" (list . "") }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
args: [serve]
|
||||||
|
env:
|
||||||
|
{{- include "uptimesebi.platformEnv" (list . $secret) | nindent 12 }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
startupProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
periodSeconds: 2
|
||||||
|
failureThreshold: 60
|
||||||
|
livenessProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet: {path: /readyz, port: http}
|
||||||
|
periodSeconds: 5
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.api.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
volumes:
|
||||||
|
{{- include "uptimesebi.tmpVolume" . | nindent 8 }}
|
||||||
|
{{- with .Values.api.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.api.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.api.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-api
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: api
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.api.service.type }}
|
||||||
|
selector:
|
||||||
|
{{- include "uptimesebi.selector" (list . "api") | nindent 4 }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: {{ .Values.api.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
{{- if and .Values.api.podDisruptionBudget.enabled (gt (int .Values.api.replicas) 1) }}
|
||||||
|
---
|
||||||
|
apiVersion: policy/v1
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-api
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
minAvailable: {{ .Values.api.podDisruptionBudget.minAvailable }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "api") | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
{{- if .Values.checker.enabled }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-checker
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: checker
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.checker.replicas }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "checker") | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "checker") | nindent 8 }}
|
||||||
|
annotations:
|
||||||
|
checksum/secret: {{ include "uptimesebi.secretData" . | sha256sum }}
|
||||||
|
{{- with .Values.checker.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
{{- if .Values.checker.pingSysctl }}
|
||||||
|
sysctls:
|
||||||
|
# A safe sysctl: unprivileged ICMP sockets for ping monitors.
|
||||||
|
- name: net.ipv4.ping_group_range
|
||||||
|
value: "0 2147483647"
|
||||||
|
{{- end }}
|
||||||
|
# Checks may take a while; the checker hands its queue back on SIGTERM.
|
||||||
|
terminationGracePeriodSeconds: 40
|
||||||
|
containers:
|
||||||
|
- name: checker
|
||||||
|
image: {{ include "uptimesebi.image" (list . "-checker") }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
env:
|
||||||
|
- name: UPTIME_API_URL
|
||||||
|
value: {{ .Values.checker.apiURL | default (include "uptimesebi.apiURL" .) | quote }}
|
||||||
|
{{- if not (or .Values.checker.token .Values.checker.existingSecret) }}
|
||||||
|
{{- fail "checker.enabled needs checker.token or checker.existingSecret (see values.yaml)" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- include "uptimesebi.secretEnv" (list (include "uptimesebi.secretName" .) "UPTIME_AGENT_TOKEN" .Values.checker.existingSecret .Values.checker.existingSecretKey "checker-token") | nindent 12 }}
|
||||||
|
- name: UPTIME_CHECKER_CONCURRENCY
|
||||||
|
value: {{ .Values.checker.concurrency | quote }}
|
||||||
|
- name: UPTIME_LOG_LEVEL
|
||||||
|
value: {{ .Values.logLevel | quote }}
|
||||||
|
{{- with .Values.extraEnv }}
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: health
|
||||||
|
containerPort: 8081
|
||||||
|
livenessProbe:
|
||||||
|
httpGet: {path: /healthz, port: health}
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet: {path: /readyz, port: health}
|
||||||
|
periodSeconds: 10
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.checker.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
volumes:
|
||||||
|
{{- include "uptimesebi.tmpVolume" . | nindent 8 }}
|
||||||
|
{{- with .Values.checker.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.checker.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.checker.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
{{- if .Values.database.bundled.enabled }}
|
||||||
|
{{- $name := printf "%s-db" (include "uptimesebi.fullname" .) }}
|
||||||
|
{{- $existing := lookup "v1" "Secret" .Release.Namespace $name }}
|
||||||
|
{{- $password := .Values.database.bundled.password }}
|
||||||
|
{{- if and (not $password) $existing }}{{ $password = index $existing.data "password" | b64dec }}{{ end }}
|
||||||
|
{{- if not $password }}{{ $password = randAlphaNum 32 }}{{ end }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: db
|
||||||
|
annotations:
|
||||||
|
# Uninstalling keeps the password, which the kept volume still needs.
|
||||||
|
helm.sh/resource-policy: keep
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
password: {{ $password | quote }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: db
|
||||||
|
spec:
|
||||||
|
clusterIP: None
|
||||||
|
selector:
|
||||||
|
{{- include "uptimesebi.selector" (list . "db") | nindent 4 }}
|
||||||
|
ports:
|
||||||
|
- name: postgres
|
||||||
|
port: 5432
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: db
|
||||||
|
spec:
|
||||||
|
serviceName: {{ $name }}
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "db") | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "db") | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 70
|
||||||
|
runAsGroup: 70
|
||||||
|
fsGroup: 70
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
containers:
|
||||||
|
- name: timescaledb
|
||||||
|
image: {{ printf "%s:%s" .Values.database.bundled.image.repository .Values.database.bundled.image.tag }}
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: uptime
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: uptime
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ $name }}
|
||||||
|
key: password
|
||||||
|
- name: PGDATA
|
||||||
|
value: /var/lib/postgresql/data/pgdata
|
||||||
|
ports:
|
||||||
|
- name: postgres
|
||||||
|
containerPort: 5432
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command: [pg_isready, -U, uptime, -d, uptime]
|
||||||
|
periodSeconds: 5
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command: [pg_isready, -U, uptime, -d, uptime]
|
||||||
|
periodSeconds: 20
|
||||||
|
failureThreshold: 6
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
capabilities:
|
||||||
|
drop: [ALL]
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.database.bundled.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
- name: run
|
||||||
|
mountPath: /var/run/postgresql
|
||||||
|
volumes:
|
||||||
|
- name: run
|
||||||
|
emptyDir: {}
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes: [ReadWriteOnce]
|
||||||
|
{{- with .Values.database.bundled.persistence.storageClass }}
|
||||||
|
storageClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.database.bundled.persistence.size }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.ingress.className }}
|
||||||
|
ingressClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.ingress.tls.enabled }}
|
||||||
|
tls:
|
||||||
|
- hosts: [{{ include "uptimesebi.publicHost" . | quote }}]
|
||||||
|
secretName: {{ .Values.ingress.tls.secretName | default (printf "%s-tls" (include "uptimesebi.fullname" .)) }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
- host: {{ include "uptimesebi.publicHost" . | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-api
|
||||||
|
port:
|
||||||
|
name: http
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
{{- if and .Values.migrations.enabled (not .Values.database.bundled.enabled) }}
|
||||||
|
{{- $secret := printf "%s-migrate" (include "uptimesebi.fullname" .) }}
|
||||||
|
{{- with include "uptimesebi.secretData" . }}
|
||||||
|
# The hook runs before the release's resources exist, so it brings its own
|
||||||
|
# copy of the secrets and removes it afterwards.
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ $secret }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" $ | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
helm.sh/hook: pre-install,pre-upgrade
|
||||||
|
helm.sh/hook-weight: "-10"
|
||||||
|
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
{{- . | nindent 2 }}
|
||||||
|
---
|
||||||
|
{{- end }}
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.fullname" . }}-migrate
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: migrate
|
||||||
|
annotations:
|
||||||
|
helm.sh/hook: pre-install,pre-upgrade
|
||||||
|
helm.sh/hook-weight: "0"
|
||||||
|
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
||||||
|
spec:
|
||||||
|
backoffLimit: {{ .Values.migrations.backoffLimit }}
|
||||||
|
activeDeadlineSeconds: 900
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "migrate") | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: migrate
|
||||||
|
image: {{ include "uptimesebi.image" (list . "") }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
args: [migrate, up]
|
||||||
|
env:
|
||||||
|
{{- include "uptimesebi.platformEnv" (list . $secret) | nindent 12 }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.migrations.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
volumes:
|
||||||
|
{{- include "uptimesebi.tmpVolume" . | nindent 8 }}
|
||||||
|
{{- with .Values.api.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.api.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
{{- if .Values.redis.bundled.enabled }}
|
||||||
|
{{- $name := printf "%s-redis" (include "uptimesebi.fullname" .) }}
|
||||||
|
{{- $existing := lookup "v1" "Secret" .Release.Namespace $name }}
|
||||||
|
{{- $password := .Values.redis.bundled.password }}
|
||||||
|
{{- if and (not $password) $existing }}{{ $password = index $existing.data "password" | b64dec }}{{ end }}
|
||||||
|
{{- if not $password }}{{ $password = randAlphaNum 32 }}{{ end }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: redis
|
||||||
|
annotations:
|
||||||
|
# Uninstalling keeps the password along with the kept volume.
|
||||||
|
helm.sh/resource-policy: keep
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
password: {{ $password | quote }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: redis
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
{{- include "uptimesebi.selector" (list . "redis") | nindent 4 }}
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
port: 6379
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: redis
|
||||||
|
spec:
|
||||||
|
serviceName: {{ $name }}
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "redis") | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "redis") | nindent 8 }}
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 999
|
||||||
|
runAsGroup: 999
|
||||||
|
fsGroup: 999
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
image: {{ printf "%s:%s" .Values.redis.bundled.image.repository .Values.redis.bundled.image.tag }}
|
||||||
|
command: [redis-server]
|
||||||
|
args:
|
||||||
|
- --requirepass
|
||||||
|
- $(REDIS_PASSWORD)
|
||||||
|
- --appendonly
|
||||||
|
- {{ ternary "yes" "no" .Values.redis.bundled.persistence.enabled | quote }}
|
||||||
|
- --save
|
||||||
|
- ""
|
||||||
|
env:
|
||||||
|
- name: REDIS_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ $name }}
|
||||||
|
key: password
|
||||||
|
- name: REDISCLI_AUTH
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ $name }}
|
||||||
|
key: password
|
||||||
|
ports:
|
||||||
|
- name: redis
|
||||||
|
containerPort: 6379
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command: [redis-cli, ping]
|
||||||
|
periodSeconds: 5
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: redis
|
||||||
|
periodSeconds: 20
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: [ALL]
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.redis.bundled.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
{{- if not .Values.redis.bundled.persistence.enabled }}
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
emptyDir: {}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.redis.bundled.persistence.enabled }}
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes: [ReadWriteOnce]
|
||||||
|
{{- with .Values.redis.bundled.persistence.storageClass }}
|
||||||
|
storageClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: {{ .Values.redis.bundled.persistence.size }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{{- with include "uptimesebi.secretData" . }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "uptimesebi.secretName" $ }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" $ | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
stringData:
|
||||||
|
{{- . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
{{- if .Values.statuspage.enabled }}
|
||||||
|
{{- $name := printf "%s-statuspage" (include "uptimesebi.fullname" .) }}
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: statuspage
|
||||||
|
spec:
|
||||||
|
replicas: {{ .Values.statuspage.replicas }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "statuspage") | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "statuspage") | nindent 8 }}
|
||||||
|
annotations:
|
||||||
|
checksum/secret: {{ include "uptimesebi.secretData" . | sha256sum }}
|
||||||
|
{{- with .Values.statuspage.podAnnotations }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
automountServiceAccountToken: false
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: statuspage
|
||||||
|
image: {{ include "uptimesebi.image" (list . "-statuspage") }}
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
env:
|
||||||
|
- name: UPTIME_API_URL
|
||||||
|
value: {{ .Values.statuspage.apiURL | default (include "uptimesebi.apiURL" .) | quote }}
|
||||||
|
{{- if not (or .Values.statuspage.token .Values.statuspage.existingSecret) }}
|
||||||
|
{{- fail "statuspage.enabled needs statuspage.token or statuspage.existingSecret (see values.yaml)" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- include "uptimesebi.secretEnv" (list (include "uptimesebi.secretName" .) "UPTIME_AGENT_TOKEN" .Values.statuspage.existingSecret .Values.statuspage.existingSecretKey "statuspage-token") | nindent 12 }}
|
||||||
|
- name: UPTIME_STATUSPAGE_HOSTS
|
||||||
|
value: {{ required "statuspage.hosts needs at least one host name" .Values.statuspage.hosts | join "," | quote }}
|
||||||
|
- name: UPTIME_STATUSPAGE_CACHE_DIR
|
||||||
|
value: /var/lib/uptimesebi
|
||||||
|
- name: UPTIME_TRUSTED_PROXIES
|
||||||
|
value: {{ join "," .Values.trustedProxies | quote }}
|
||||||
|
- name: UPTIME_LOG_LEVEL
|
||||||
|
value: {{ .Values.logLevel | quote }}
|
||||||
|
{{- with .Values.extraEnv }}
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8082
|
||||||
|
livenessProbe:
|
||||||
|
httpGet: {path: /healthz, port: http}
|
||||||
|
periodSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet: {path: /readyz, port: http}
|
||||||
|
periodSeconds: 5
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.statuspage.resources | nindent 12 }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
# Snapshots keep pages up while the API is away; rebuilt on start.
|
||||||
|
- name: cache
|
||||||
|
mountPath: /var/lib/uptimesebi
|
||||||
|
volumes:
|
||||||
|
{{- include "uptimesebi.tmpVolume" . | nindent 8 }}
|
||||||
|
- name: cache
|
||||||
|
emptyDir:
|
||||||
|
sizeLimit: 256Mi
|
||||||
|
{{- with .Values.statuspage.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.statuspage.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.statuspage.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
app.kubernetes.io/component: statuspage
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.statuspage.service.type }}
|
||||||
|
selector:
|
||||||
|
{{- include "uptimesebi.selector" (list . "statuspage") | nindent 4 }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: {{ .Values.statuspage.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
{{- if and .Values.statuspage.podDisruptionBudget.enabled (gt (int .Values.statuspage.replicas) 1) }}
|
||||||
|
---
|
||||||
|
apiVersion: policy/v1
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
spec:
|
||||||
|
minAvailable: {{ .Values.statuspage.podDisruptionBudget.minAvailable }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{- include "uptimesebi.selector" (list . "statuspage") | nindent 6 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.statuspage.ingress.enabled }}
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $name }}
|
||||||
|
labels:
|
||||||
|
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.statuspage.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.statuspage.ingress.className }}
|
||||||
|
ingressClassName: {{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.statuspage.ingress.tls.enabled }}
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
{{- toYaml .Values.statuspage.hosts | nindent 8 }}
|
||||||
|
secretName: {{ .Values.statuspage.ingress.tls.secretName | default (printf "%s-tls" $name) }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.statuspage.hosts }}
|
||||||
|
- host: {{ . | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: {{ $name }}
|
||||||
|
port:
|
||||||
|
name: http
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
# Default values for UptimeSebi. Only publicURL, the database, Redis and
|
||||||
|
# secretKeys have to be set; everything else has working defaults.
|
||||||
|
|
||||||
|
image:
|
||||||
|
# The API image; checkers and status page servers use <repository>-checker
|
||||||
|
# and <repository>-statuspage with the same tag.
|
||||||
|
repository: git.zb-server.de/zb-server/uptimesebi
|
||||||
|
# Defaults to the chart's appVersion.
|
||||||
|
tag: ""
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
imagePullSecrets: []
|
||||||
|
|
||||||
|
# -- Platform --
|
||||||
|
|
||||||
|
# Address users reach the console at, e.g. https://uptime.example.com.
|
||||||
|
# Used for links in mails, SSO callbacks and the agent install script.
|
||||||
|
publicURL: ""
|
||||||
|
# selfhosted or cloud.
|
||||||
|
edition: selfhosted
|
||||||
|
logLevel: info
|
||||||
|
# Who may sign up: first-user, open or closed.
|
||||||
|
signup: first-user
|
||||||
|
# Reverse proxies whose X-Forwarded-For is believed, e.g. the pod network of
|
||||||
|
# the ingress controller. Client addresses feed rate limits and the audit
|
||||||
|
# log; without this they are the ingress controller's.
|
||||||
|
trustedProxies: []
|
||||||
|
# Where the platform's status page servers are reachable.
|
||||||
|
statusPageURL: ""
|
||||||
|
# Further environment variables for every component, e.g. UPTIME_RETENTION_*.
|
||||||
|
extraEnv: []
|
||||||
|
# - name: UPTIME_RETENTION_RAW
|
||||||
|
# value: 720h
|
||||||
|
|
||||||
|
# Encrypts stored secrets (UPTIME_SECRET_KEYS): "k1:<32 random bytes, base64>",
|
||||||
|
# e.g. echo "k1:$(head -c32 /dev/urandom | base64)". Keep it safe; rotate by
|
||||||
|
# prepending a new key. Or name a secret that holds it.
|
||||||
|
secretKeys:
|
||||||
|
value: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: secret-keys
|
||||||
|
|
||||||
|
# Outgoing mail, e.g. smtp://user:pass@host:587?from=alerts@example.com.
|
||||||
|
smtp:
|
||||||
|
url: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: smtp-url
|
||||||
|
|
||||||
|
# -- PostgreSQL with TimescaleDB --
|
||||||
|
|
||||||
|
database:
|
||||||
|
# postgres://user:password@host:5432/uptime?sslmode=require. The user needs
|
||||||
|
# to create the timescaledb and citext extensions on the first migration.
|
||||||
|
url: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: database-url
|
||||||
|
# A single TimescaleDB in the cluster, for trying UptimeSebi out. Without
|
||||||
|
# backups or high availability: for production use your own database.
|
||||||
|
bundled:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
repository: timescale/timescaledb
|
||||||
|
tag: 2.30.1-pg16
|
||||||
|
# Generated on install if empty, then kept.
|
||||||
|
password: ""
|
||||||
|
persistence:
|
||||||
|
size: 10Gi
|
||||||
|
storageClass: ""
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
# -- Redis --
|
||||||
|
# Point to your own Redis, directly or through Sentinel, or bundle one.
|
||||||
|
|
||||||
|
redis:
|
||||||
|
# redis://:password@host:6379/0 or rediss:// for TLS.
|
||||||
|
url: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: redis-url
|
||||||
|
sentinel:
|
||||||
|
master: ""
|
||||||
|
addrs: []
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: redis-sentinel-password
|
||||||
|
# A single Redis in the cluster, for trying UptimeSebi out. Without high
|
||||||
|
# availability: for production use your own Redis.
|
||||||
|
bundled:
|
||||||
|
enabled: false
|
||||||
|
image:
|
||||||
|
repository: redis
|
||||||
|
tag: 8-alpine
|
||||||
|
# Generated on install if empty, then kept; letters and digits only,
|
||||||
|
# it goes into a URL.
|
||||||
|
password: ""
|
||||||
|
# Sessions, schedules and rate limits survive restarts on a volume;
|
||||||
|
# without one a restart signs everyone out.
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
size: 1Gi
|
||||||
|
storageClass: ""
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
# -- Migrations --
|
||||||
|
|
||||||
|
migrations:
|
||||||
|
# Run "api migrate up" as a hook before every install and upgrade. With
|
||||||
|
# the bundled database, which does not exist before the install, they run
|
||||||
|
# as an init container of the API instead.
|
||||||
|
enabled: true
|
||||||
|
backoffLimit: 3
|
||||||
|
resources: {}
|
||||||
|
|
||||||
|
# -- Console and API --
|
||||||
|
|
||||||
|
api:
|
||||||
|
replicas: 2
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
memory: 512Mi
|
||||||
|
podDisruptionBudget:
|
||||||
|
enabled: true
|
||||||
|
minAvailable: 1
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 8080
|
||||||
|
# The API image is built for amd64 only; checkers and status page servers
|
||||||
|
# run on arm64 and 32-bit ARM too. Also used by the migration job.
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/arch: amd64
|
||||||
|
tolerations: []
|
||||||
|
affinity: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: ""
|
||||||
|
annotations: {}
|
||||||
|
# Defaults to the host of publicURL.
|
||||||
|
host: ""
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
# Secret with the certificate, e.g. made by cert-manager.
|
||||||
|
secretName: ""
|
||||||
|
|
||||||
|
# -- Checker --
|
||||||
|
# A checker in the cluster, for checks from the cluster's region. Create
|
||||||
|
# its region and token first:
|
||||||
|
# kubectl exec deploy/<release>-uptimesebi-api -- api region add <key> <name>
|
||||||
|
# kubectl exec deploy/<release>-uptimesebi-api -- api agent create --kind checker --region <key> --name <name>
|
||||||
|
|
||||||
|
checker:
|
||||||
|
enabled: false
|
||||||
|
replicas: 1
|
||||||
|
token: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: checker-token
|
||||||
|
# Defaults to the API service inside the cluster.
|
||||||
|
apiURL: ""
|
||||||
|
concurrency: 64
|
||||||
|
# Lets the checker send pings without privileges.
|
||||||
|
pingSysctl: true
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
memory: 512Mi
|
||||||
|
nodeSelector: {}
|
||||||
|
tolerations: []
|
||||||
|
affinity: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
# -- Status page server --
|
||||||
|
# Serves public status pages. Create its token first:
|
||||||
|
# kubectl exec deploy/<release>-uptimesebi-api -- api agent create --kind statuspage --name <name>
|
||||||
|
|
||||||
|
statuspage:
|
||||||
|
enabled: false
|
||||||
|
replicas: 2
|
||||||
|
token: ""
|
||||||
|
existingSecret: ""
|
||||||
|
existingSecretKey: statuspage-token
|
||||||
|
# Defaults to the API service inside the cluster.
|
||||||
|
apiURL: ""
|
||||||
|
# Host names serving pages by slug, e.g. status.example.com.
|
||||||
|
hosts: []
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 80
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
className: ""
|
||||||
|
annotations: {}
|
||||||
|
tls:
|
||||||
|
enabled: false
|
||||||
|
secretName: ""
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
memory: 64Mi
|
||||||
|
limits:
|
||||||
|
memory: 256Mi
|
||||||
|
podDisruptionBudget:
|
||||||
|
enabled: true
|
||||||
|
minAvailable: 1
|
||||||
|
nodeSelector: {}
|
||||||
|
tolerations: []
|
||||||
|
affinity: {}
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
# Pod and container security for all components; the images run as user
|
||||||
|
# 65532 without a shell.
|
||||||
|
podSecurityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 65532
|
||||||
|
runAsGroup: 65532
|
||||||
|
fsGroup: 65532
|
||||||
|
seccompProfile:
|
||||||
|
type: RuntimeDefault
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: [ALL]
|
||||||
Reference in new issue
Block a user