add gatus

This commit is contained in:
Joseph Hanson 2024-09-05 22:55:58 -05:00
parent e4bfce1c60
commit d9382c2373
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
7 changed files with 353 additions and 0 deletions

View file

@ -0,0 +1,23 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/external-secrets.io/externalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: gatus
spec:
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-connect
target:
name: gatus-secret
template:
engineVersion: v2
data:
CUSTOM_PUSHOVER_TOKEN: "{{ .gatus_token }}"
CUSTOM_PUSHOVER_USER_KEY: "{{ .userkey_jahanson }}"
DATABASE_URI: "postgresql://{{ .pg_username }}:{{ .pg_password }}@postgres-primary-real.database.svc:{{ .pg_port }}/{{ .pg_database }}"
dataFrom:
- extract:
key: pushover
- extract:
key: gatus

View file

@ -0,0 +1,131 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: gatus
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 3.4.0
sourceRef:
kind: HelmRepository
name: bjw-s
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
controllers:
gatus:
annotations:
reloader.stakater.com/auto: "true"
initContainers:
init-config:
image:
repository: ghcr.io/kiwigrid/k8s-sidecar
tag: 1.27.6@sha256:db85bd5532530d288736b35e63baceacbf570bf863d85a0404b33c1e1631f63b
env:
FOLDER: /config
LABEL: gatus.io/enabled
NAMESPACE: ALL
RESOURCE: both
UNIQUE_FILENAMES: true
METHOD: WATCH
restartPolicy: Always
resources: &resources
requests:
cpu: 10m
limits:
memory: 256Mi
containers:
app:
image:
repository: ghcr.io/twin/gatus
tag: v5.12.1@sha256:3cc4e90534c05599f07fbdf15580401aa7771fac15f51d1dc8f7de265d70d12f
env:
TZ: America/Chicago
GATUS_CONFIG_PATH: /config
GATUS_DELAY_START_SECONDS: 5
CUSTOM_WEB_PORT: &port 80
envFrom:
- secretRef:
name: gatus-secret
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /health
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
resources: *resources
pod:
dnsConfig:
options:
- { name: ndots, value: "1" }
securityContext:
runAsUser: 568
runAsGroup: 568
runAsNonRoot: true
fsGroup: 568
fsGroupChangePolicy: OnRootMismatch
service:
app:
controller: gatus
ports:
http:
port: *port
serviceMonitor:
app:
serviceName: gatus
endpoints:
- port: http
scheme: http
path: /metrics
interval: 1m
scrapeTimeout: 10s
ingress:
app:
className: external-nginx
annotations:
external-dns.alpha.kubernetes.io/cloudflare-proxied: "true"
external-dns.alpha.kubernetes.io/target: external.hsn.dev
hosts:
- host: &host status.hsn.dev
paths:
- path: /
service:
identifier: app
port: http
tls:
- hosts: [*host]
serviceAccount:
create: true
name: gatus
persistence:
config:
type: emptyDir
config-file:
type: configMap
name: gatus-configmap
globalMounts:
- path: /config/config.yaml
subPath: config.yaml
readOnly: true

View file

@ -0,0 +1,14 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./externalsecret.yaml
- ./helmrelease.yaml
- ./rbac.yaml
configMapGenerator:
- name: gatus-configmap
files:
- config.yaml=./resources/config.yml
generatorOptions:
disableNameSuffixHash: true

View file

@ -0,0 +1,22 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gatus
rules:
- apiGroups: [""]
resources: ["configmaps", "secrets"]
verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: gatus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: gatus
subjects:
- kind: ServiceAccount
name: gatus
namespace: observability

View file

@ -0,0 +1,133 @@
---
# Note: Gatus vars should be escaped with $${VAR_NAME} to avoid interpolation by Flux
web:
port: $${CUSTOM_WEB_PORT}
storage:
type: postgres
path: $${DATABASE_URI}
caching: true
metrics: true
debug: false
ui:
title: Status | Gatus
header: Status
alerting:
pushover:
application-token: $${CUSTOM_PUSHOVER_TOKEN}
user-key: $${CUSTOM_PUSHOVER_USER_KEY}
default-alert:
description: health-check failed
send-on-resolved: true
failure-threshold: 5
success-threshold: 2
connectivity:
checker:
target: 1.1.1.1:53
interval: 1m
endpoints:
- name: status
group: external
url: https://status.hsn.dev
interval: 1m
client:
dns-resolver: tcp://1.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
# - name: Umami
# group: external
# url: https://umi.hsn.dev/script.js
# interval: 1m
# client:
# dns-resolver: tcp://1.1.1.1:53
# conditions:
# - "[STATUS] == 200"
# alerts:
# - type: pushover
- name: Nextcloud External
group: external
url: https://nc.hsn.dev
interval: 1m
ui:
hide-url: true
hide-hostname: true
client:
dns-resolver: tcp://1.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
- name: flux-webhook
group: external
url: https://flux-receiver.hsn.dev
interval: 1m
client:
dns-resolver: tcp://1.1.1.1:53
conditions:
- "[STATUS] == 404"
alerts:
- type: pushover
- name: Elessar
group: internal
url: https://elessar.jahanson.tech
interval: 1m
client:
dns-resolver: tcp://10.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
- name: Sting
group: internal
url: http://sting.jahanson.tech
interval: 1m
client:
dns-resolver: tcp://10.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
# - name: Gandalf
# group: internal
# url: https://gandalf.jahanson.tech:8443
# interval: 1m
# client:
# dns-resolver: tcp://10.1.1.1:53
# conditions:
# - "[STATUS] == 200"
# alerts:
# - type: pushover
- name: Gollum
group: internal
url: http://gollum.jahanson.tech
interval: 1m
client:
dns-resolver: tcp://10.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
- name: Nextcloud Internal
group: internal
url: https://nc.hsn.dev
interval: 1m
ui:
hide-url: true
hide-hostname: true
client:
dns-resolver: tcp://10.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
- name: Home Assistant
group: internal
url: https://hass.jahanson.tech
interval: 1m
client:
dns-resolver: tcp://10.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app gatus
namespace: flux-system
spec:
targetNamespace: observability
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: crunchy-postgres-operator
- name: external-secrets-stores
path: ./kubernetes/apps/observability/gatus/app
prune: true
sourceRef:
kind: GitRepository
name: theshire
wait: false
interval: 30m
retryInterval: 1m
timeout: 5m
postBuild:
substitute:
APP: *app
DB_NAME: gatus
DB_USER: gatus

View file

@ -8,3 +8,4 @@ resources:
# Flux-Kustomizations
- ./kube-prometheus-stack/ks.yaml
- ./prometheus-operator-crds/ks.yaml
- ./gatus/ks.yaml