diff --git a/clusters/cl01tl/manifests/blocky/ConfigMap-blocky.yaml b/clusters/cl01tl/manifests/blocky/ConfigMap-blocky.yaml index 448a7c411..daddb07ec 100644 --- a/clusters/cl01tl/manifests/blocky/ConfigMap-blocky.yaml +++ b/clusters/cl01tl/manifests/blocky/ConfigMap-blocky.yaml @@ -87,6 +87,7 @@ data: blocky IN A 10.232.1.22 cilium-cl01tl IN A 10.232.1.23 + ;; Application Names actual IN CNAME traefik-cl01tl alertmanager IN CNAME traefik-cl01tl @@ -99,6 +100,7 @@ data: booklore IN CNAME traefik-cl01tl ceph IN CNAME traefik-cl01tl code-server IN CNAME traefik-cl01tl + dawarich IN CNAME traefik-cl01tl directus IN CNAME traefik-cl01tl excalidraw IN CNAME traefik-cl01tl feishin IN CNAME traefik-cl01tl diff --git a/clusters/cl01tl/manifests/blocky/Deployment-blocky.yaml b/clusters/cl01tl/manifests/blocky/Deployment-blocky.yaml index a018cabcb..4e9b727f5 100644 --- a/clusters/cl01tl/manifests/blocky/Deployment-blocky.yaml +++ b/clusters/cl01tl/manifests/blocky/Deployment-blocky.yaml @@ -22,7 +22,7 @@ spec: template: metadata: annotations: - checksum/configMaps: 3904aa62d3fcaf1ee4fce67a7f9f95c4c584948685105f5e4f3075f721b90f76 + checksum/configMaps: 0c7df497327f1d8c1286bbbebb1f4827e47861b632504494f6b91351f137890a labels: app.kubernetes.io/controller: main app.kubernetes.io/instance: blocky diff --git a/clusters/cl01tl/manifests/dawarich/Cluster-dawarich-postgresql-18-cluster.yaml b/clusters/cl01tl/manifests/dawarich/Cluster-dawarich-postgresql-18-cluster.yaml new file mode 100644 index 000000000..01f0f8b5d --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Cluster-dawarich-postgresql-18-cluster.yaml @@ -0,0 +1,62 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: dawarich-postgresql-18-cluster + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm +spec: + instances: 3 + imageName: "ghcr.io/cloudnative-pg/postgis:18.3-standard-trixie" + imagePullPolicy: IfNotPresent + postgresUID: 26 + postgresGID: 26 + storage: + size: 10Gi + storageClass: local-path + walStorage: + size: 2Gi + storageClass: local-path + resources: + limits: + hugepages-2Mi: 256Mi + requests: + cpu: 100m + memory: 256Mi + affinity: + enablePodAntiAffinity: true + topologyKey: kubernetes.io/hostname + primaryUpdateMethod: switchover + primaryUpdateStrategy: unsupervised + logLevel: info + enableSuperuserAccess: false + enablePDB: true + postgresql: + parameters: + hot_standby_feedback: "on" + max_slot_wal_keep_size: 2000MB + shared_buffers: 128MB + monitoring: + enablePodMonitor: true + disableDefaultQueries: false + plugins: + - name: barman-cloud.cloudnative-pg.io + enabled: true + isWALArchiver: true + parameters: + barmanObjectName: "dawarich-postgresql-18-backup-garage-local" + serverName: "dawarich-postgresql-18-backup-1" + bootstrap: + initdb: + database: app + postInitTemplateSQL: + - CREATE EXTENSION postgis; + - CREATE EXTENSION postgis_topology; + - CREATE EXTENSION fuzzystrmatch; + - CREATE EXTENSION postgis_tiger_geocoder; + owner: app diff --git a/clusters/cl01tl/manifests/dawarich/ConfigMap-dawarich-valkey-init-scripts.yaml b/clusters/cl01tl/manifests/dawarich/ConfigMap-dawarich-valkey-init-scripts.yaml new file mode 100644 index 000000000..945066e5b --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ConfigMap-dawarich-valkey-init-scripts.yaml @@ -0,0 +1,87 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: dawarich-valkey-init-scripts + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm +data: + init.sh: |- + #!/bin/sh + set -eu + + # Default config paths + VALKEY_CONFIG=${VALKEY_CONFIG_PATH:-/data/conf/valkey.conf} + + LOGFILE="/data/init.log" + DATA_DIR="/data/conf" + + # Logging function (outputs to stderr and file) + log() { + echo "$(date) $1" | tee -a "$LOGFILE" >&2 + } + + # Clean old log if requested + if [ "${KEEP_OLD_LOGS:-false}" != "true" ]; then + rm -f "$LOGFILE" + fi + + if [ -f "$LOGFILE" ]; then + log "Detected restart of this instance ($HOSTNAME)" + fi + + log "Creating configuration in $DATA_DIR..." + mkdir -p "$DATA_DIR" + rm -f "$VALKEY_CONFIG" + + + # Base valkey.conf + log "Generating base valkey.conf" + { + echo "port 6379" + echo "protected-mode no" + echo "bind * -::*" + echo "dir /data" + } >>"$VALKEY_CONFIG" + # Replica mode configuration + log "Configuring replication mode" + + # Use POD_INDEX from Kubernetes metadata + POD_INDEX=${POD_INDEX:-0} + IS_MASTER=false + + # Check if this is pod-0 (master) + if [ "$POD_INDEX" = "0" ]; then + IS_MASTER=true + log "This pod (index $POD_INDEX) is configured as MASTER" + else + log "This pod (index $POD_INDEX) is configured as REPLICA" + fi + + # Configure replica settings + if [ "$IS_MASTER" = "false" ]; then + MASTER_HOST="dawarich-valkey-0.dawarich-valkey-headless.dawarich.svc.cluster.local" + MASTER_PORT="6379" + + log "Configuring replica to follow master at $MASTER_HOST:$MASTER_PORT" + + { + echo "" + echo "# Replica Configuration" + echo "replicaof $MASTER_HOST $MASTER_PORT" + echo "replica-announce-ip dawarich-valkey-$POD_INDEX.dawarich-valkey-headless.dawarich.svc.cluster.local" + } >>"$VALKEY_CONFIG" + fi + + # Append extra configs if present + if [ -f /usr/local/etc/valkey/valkey.conf ]; then + log "Appending /usr/local/etc/valkey/valkey.conf" + cat /usr/local/etc/valkey/valkey.conf >>"$VALKEY_CONFIG" + fi + if [ -d /extravalkeyconfigs ]; then + log "Appending files in /extravalkeyconfigs/" + cat /extravalkeyconfigs/* >>"$VALKEY_CONFIG" + fi diff --git a/clusters/cl01tl/manifests/dawarich/Deployment-dawarich.yaml b/clusters/cl01tl/manifests/dawarich/Deployment-dawarich.yaml new file mode 100644 index 000000000..0bc80eb83 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Deployment-dawarich.yaml @@ -0,0 +1,253 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: dawarich + labels: + app.kubernetes.io/controller: main + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + helm.sh/chart: dawarich-4.6.2 + namespace: dawarich +spec: + revisionHistoryLimit: 3 + replicas: 1 + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/controller: main + app.kubernetes.io/name: dawarich + app.kubernetes.io/instance: dawarich + template: + metadata: + labels: + app.kubernetes.io/controller: main + app.kubernetes.io/instance: dawarich + app.kubernetes.io/name: dawarich + spec: + enableServiceLinks: false + serviceAccountName: default + automountServiceAccountToken: true + hostIPC: false + hostNetwork: false + hostPID: false + dnsPolicy: ClusterFirst + containers: + - args: + - bin/rails + - server + - -p + - "3000" + - -b + - '::' + command: + - web-entrypoint.sh + env: + - name: RAILS_ENV + value: production + - name: REDIS_URL + value: redis://dawarich-valkey.dawarich:6379 + - name: DATABASE_HOST + valueFrom: + secretKeyRef: + key: host + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_PORT + valueFrom: + secretKeyRef: + key: port + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + key: user + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_NAME + valueFrom: + secretKeyRef: + key: dbname + name: dawarich-postgresql-18-cluster-app + - name: APPLICATION_HOSTS + value: dawarich.alexlebens.net,localhost,::1,127.0.0.1 + - name: TIME_ZONE + value: America/Chicago + - name: APPLICATION_PROTOCOL + value: http + - name: OIDC_ISSUER + value: https://authentik.alexlebens.net/application/o/darwich/.well-known/openid-configuration + - name: OIDC_REDIRECT_URI + value: https://dawarich.alexlebens.net/users/auth/openid_connect/callback + - name: OIDC_CLIENT_ID + valueFrom: + secretKeyRef: + key: client + name: dawarich-oidc-secret + - name: OIDC_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: secret + name: dawarich-oidc-secret + - name: OIDC_PROVIDER_NAME + value: Authentik + - name: OIDC_AUTO_REGISTER + value: "true" + - name: PROMETHEUS_EXPORTER_ENABLED + value: "true" + - name: PROMETHEUS_EXPORTER_HOST + value: 0.0.0.0 + - name: PROMETHEUS_EXPORTER_PORT + value: "9394" + - name: SECRET_KEY_BASE + valueFrom: + secretKeyRef: + key: key + name: dawarich-key-secret + - name: RAILS_LOG_TO_STDOUT + value: "true" + - name: SELF_HOSTED + value: "true" + - name: STORE_GEODATA + value: "true" + image: freikin/dawarich:1.3.1 + imagePullPolicy: IfNotPresent + livenessProbe: + exec: + command: + - /bin/sh + - -c + - wget -qO - http://127.0.0.1:3000/api/v1/health | grep -q '\"status\"\\s*:\\s*\"ok\"' + failureThreshold: 5 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 10 + name: main + resources: + requests: + cpu: 10m + memory: 128Mi + volumeMounts: + - mountPath: /var/app/public + name: public + - mountPath: /var/app/storage + name: storage + - mountPath: /var/app/tmp/imports/watched + name: watched + - args: + - sidekiq + command: + - sidekiq-entrypoint.sh + env: + - name: RAILS_ENV + value: production + - name: REDIS_URL + value: redis://dawarich-valkey.dawarich:6379 + - name: DATABASE_HOST + valueFrom: + secretKeyRef: + key: host + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_PORT + valueFrom: + secretKeyRef: + key: port + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + key: user + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + key: password + name: dawarich-postgresql-18-cluster-app + - name: DATABASE_NAME + valueFrom: + secretKeyRef: + key: dbname + name: dawarich-postgresql-18-cluster-app + - name: APPLICATION_HOSTS + value: dawarich.alexlebens.net,localhost,::1,127.0.0.1 + - name: TIME_ZONE + value: America/Chicago + - name: APPLICATION_PROTOCOL + value: http + - name: DISTANCE_UNIT + value: mi + - name: OIDC_ISSUER + value: https://authentik.alexlebens.net/application/o/darwich/.well-known/openid-configuration + - name: OIDC_REDIRECT_URI + value: https://dawarich.alexlebens.net/users/auth/openid_connect/callback + - name: OIDC_CLIENT_ID + valueFrom: + secretKeyRef: + key: client + name: dawarich-oidc-secret + - name: OIDC_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: secret + name: dawarich-oidc-secret + - name: OIDC_PROVIDER_NAME + value: Authentik + - name: OIDC_AUTO_REGISTER + value: "true" + - name: PROMETHEUS_EXPORTER_ENABLED + value: "true" + - name: PROMETHEUS_EXPORTER_HOST + value: 0.0.0.0 + - name: PROMETHEUS_EXPORTER_PORT + value: "9394" + - name: SECRET_KEY_BASE + valueFrom: + secretKeyRef: + key: key + name: dawarich-key-secret + - name: RAILS_LOG_TO_STDOUT + value: "true" + - name: SELF_HOSTED + value: "true" + - name: STORE_GEODATA + value: "true" + image: freikin/dawarich:1.3.1 + imagePullPolicy: IfNotPresent + livenessProbe: + exec: + command: + - /bin/sh + - -c + - pgrep -f sidekiq + failureThreshold: 5 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 10 + name: sidekiq + resources: + requests: + cpu: 10m + memory: 128Mi + volumeMounts: + - mountPath: /var/app/public + name: public + - mountPath: /var/app/storage + name: storage + - mountPath: /var/app/tmp/imports/watched + name: watched + volumes: + - name: public + persistentVolumeClaim: + claimName: dawarich-public + - name: storage + persistentVolumeClaim: + claimName: dawarich-storage + - name: watched + persistentVolumeClaim: + claimName: dawarich-watched diff --git a/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-key-secret.yaml b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-key-secret.yaml new file mode 100644 index 000000000..4ff36b3e1 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-key-secret.yaml @@ -0,0 +1,21 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: dawarich-key-secret + namespace: dawarich + labels: + app.kubernetes.io/name: dawarich-key-secret + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: key + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /cl01tl/dawarich/key + metadataPolicy: None + property: key diff --git a/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-oidc-secret.yaml b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-oidc-secret.yaml new file mode 100644 index 000000000..f70c0ee20 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-oidc-secret.yaml @@ -0,0 +1,28 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: dawarich-oidc-secret + namespace: dawarich + labels: + app.kubernetes.io/name: dawarich-oidc-secret + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: client + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /authentik/oidc/dawarich + metadataPolicy: None + property: client + - secretKey: secret + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /authentik/oidc/dawarich + metadataPolicy: None + property: secret diff --git a/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-postgresql-18-backup-garage-local-secret.yaml b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-postgresql-18-backup-garage-local-secret.yaml new file mode 100644 index 000000000..bc5bac475 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-postgresql-18-backup-garage-local-secret.yaml @@ -0,0 +1,39 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: dawarich-postgresql-18-backup-garage-local-secret + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich-postgresql-18-backup-garage-local-secret +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: ACCESS_REGION + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/postgres-backups + metadataPolicy: None + property: ACCESS_REGION + - secretKey: ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/postgres-backups + metadataPolicy: None + property: ACCESS_KEY_ID + - secretKey: ACCESS_SECRET_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/postgres-backups + metadataPolicy: None + property: ACCESS_SECRET_KEY diff --git a/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-postgresql-18-recovery-secret.yaml b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-postgresql-18-recovery-secret.yaml new file mode 100644 index 000000000..224092320 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ExternalSecret-dawarich-postgresql-18-recovery-secret.yaml @@ -0,0 +1,39 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: dawarich-postgresql-18-recovery-secret + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich-postgresql-18-recovery-secret +spec: + secretStoreRef: + kind: ClusterSecretStore + name: vault + data: + - secretKey: ACCESS_REGION + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/postgres-backups + metadataPolicy: None + property: ACCESS_REGION + - secretKey: ACCESS_KEY_ID + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/postgres-backups + metadataPolicy: None + property: ACCESS_KEY_ID + - secretKey: ACCESS_SECRET_KEY + remoteRef: + conversionStrategy: Default + decodingStrategy: None + key: /garage/home-infra/postgres-backups + metadataPolicy: None + property: ACCESS_SECRET_KEY diff --git a/clusters/cl01tl/manifests/dawarich/HTTPRoute-dawarich.yaml b/clusters/cl01tl/manifests/dawarich/HTTPRoute-dawarich.yaml new file mode 100644 index 000000000..ce57b6320 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/HTTPRoute-dawarich.yaml @@ -0,0 +1,30 @@ +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: dawarich + labels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + helm.sh/chart: dawarich-4.6.2 + namespace: dawarich +spec: + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: traefik-gateway + namespace: traefik + hostnames: + - "dawarich.alexlebens.net" + rules: + - backendRefs: + - group: "" + kind: Service + name: dawarich + namespace: dawarich + port: 80 + weight: 100 + matches: + - path: + type: PathPrefix + value: / diff --git a/clusters/cl01tl/manifests/dawarich/ObjectStore-dawarich-postgresql-18-backup-garage-local.yaml b/clusters/cl01tl/manifests/dawarich/ObjectStore-dawarich-postgresql-18-backup-garage-local.yaml new file mode 100644 index 000000000..3252fa70c --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ObjectStore-dawarich-postgresql-18-backup-garage-local.yaml @@ -0,0 +1,34 @@ +apiVersion: barmancloud.cnpg.io/v1 +kind: ObjectStore +metadata: + name: dawarich-postgresql-18-backup-garage-local + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich-postgresql-18-backup-garage-local +spec: + retentionPolicy: 7d + instanceSidecarConfiguration: + env: + - name: AWS_REQUEST_CHECKSUM_CALCULATION + value: when_required + - name: AWS_RESPONSE_CHECKSUM_VALIDATION + value: when_required + configuration: + destinationPath: s3://postgres-backups/cl01tl/dawarich/dawarich-postgresql-18-cluster + endpointURL: http://garage-main.garage:3900 + s3Credentials: + accessKeyId: + name: dawarich-postgresql-18-backup-garage-local-secret + key: ACCESS_KEY_ID + secretAccessKey: + name: dawarich-postgresql-18-backup-garage-local-secret + key: ACCESS_SECRET_KEY + region: + name: dawarich-postgresql-18-backup-garage-local-secret + key: ACCESS_REGION diff --git a/clusters/cl01tl/manifests/dawarich/ObjectStore-dawarich-postgresql-18-recovery.yaml b/clusters/cl01tl/manifests/dawarich/ObjectStore-dawarich-postgresql-18-recovery.yaml new file mode 100644 index 000000000..e226bc80f --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ObjectStore-dawarich-postgresql-18-recovery.yaml @@ -0,0 +1,33 @@ +apiVersion: barmancloud.cnpg.io/v1 +kind: ObjectStore +metadata: + name: "dawarich-postgresql-18-recovery" + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: "dawarich-postgresql-18-recovery" +spec: + configuration: + destinationPath: s3://postgres-backups/cl01tl/dawarich/dawarich-postgresql-18-cluster + endpointURL: http://garage-main.garage:3900 + wal: + compression: snappy + maxParallel: 1 + data: + compression: snappy + jobs: 1 + s3Credentials: + accessKeyId: + name: dawarich-postgresql-18-recovery-secret + key: ACCESS_KEY_ID + secretAccessKey: + name: dawarich-postgresql-18-recovery-secret + key: ACCESS_SECRET_KEY + region: + name: dawarich-postgresql-18-recovery-secret + key: ACCESS_REGION diff --git a/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-public.yaml b/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-public.yaml new file mode 100644 index 000000000..f79214f04 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-public.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: dawarich-public + labels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + helm.sh/chart: dawarich-4.6.2 + annotations: + helm.sh/resource-policy: keep + namespace: dawarich +spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "5Gi" + storageClassName: "ceph-block" diff --git a/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-storage.yaml b/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-storage.yaml new file mode 100644 index 000000000..e69cd8151 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-storage.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: dawarich-storage + labels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + helm.sh/chart: dawarich-4.6.2 + annotations: + helm.sh/resource-policy: keep + namespace: dawarich +spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "5Gi" + storageClassName: "ceph-block" diff --git a/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-watched.yaml b/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-watched.yaml new file mode 100644 index 000000000..b14032ca7 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/PersistentVolumeClaim-dawarich-watched.yaml @@ -0,0 +1,19 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: dawarich-watched + labels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + helm.sh/chart: dawarich-4.6.2 + annotations: + helm.sh/resource-policy: keep + namespace: dawarich +spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: "1Gi" + storageClassName: "ceph-block" diff --git a/clusters/cl01tl/manifests/dawarich/PodMonitor-dawarich-valkey.yaml b/clusters/cl01tl/manifests/dawarich/PodMonitor-dawarich-valkey.yaml new file mode 100644 index 000000000..f484bf5f9 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/PodMonitor-dawarich-valkey.yaml @@ -0,0 +1,23 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: dawarich-valkey + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/part-of: valkey + app.kubernetes.io/component: podmonitor +spec: + podMetricsEndpoints: + - port: metrics + interval: 30s + namespaceSelector: + matchNames: + - dawarich + selector: + matchLabels: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich diff --git a/clusters/cl01tl/manifests/dawarich/PrometheusRule-dawarich-postgresql-18-alert-rules.yaml b/clusters/cl01tl/manifests/dawarich/PrometheusRule-dawarich-postgresql-18-alert-rules.yaml new file mode 100644 index 000000000..424fe2324 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/PrometheusRule-dawarich-postgresql-18-alert-rules.yaml @@ -0,0 +1,270 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: dawarich-postgresql-18-alert-rules + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm +spec: + groups: + - name: cloudnative-pg/dawarich-postgresql-18 + rules: + - alert: CNPGClusterBackendsWaitingWarning + annotations: + summary: CNPG Cluster a backend is waiting for longer than 5 minutes. + description: |- + Pod {{ $labels.pod }} + has been waiting for longer than 5 minutes + expr: | + cnpg_backends_waiting_total{namespace="dawarich"} > 300 + for: 1m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterDatabaseDeadlockConflictsWarning + annotations: + summary: CNPG Cluster has over 10 deadlock conflicts. + description: |- + There are over 10 deadlock conflicts in + {{ $labels.pod }} + expr: | + cnpg_pg_stat_database_deadlocks{namespace="dawarich"} > 10 + for: 1m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterHACritical + annotations: + summary: CNPG Cluster has no standby replicas! + description: |- + CloudNativePG Cluster "{{`{{`}} $labels.job {{`}}`}}" has no ready standby replicas. Your cluster at a severe + risk of data loss and downtime if the primary instance fails. + + The primary instance is still online and able to serve queries, although connections to the `-ro` endpoint + will fail. The `-r` endpoint os operating at reduced capacity and all traffic is being served by the main. + + This can happen during a normal fail-over or automated minor version upgrades in a cluster with 2 or less + instances. The replaced instance may need some time to catch-up with the cluster primary instance. + + This alarm will be always trigger if your cluster is configured to run with only 1 instance. In this + case you may want to silence it. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHACritical.md + expr: | + max by (job) (cnpg_pg_replication_streaming_replicas{namespace="dawarich"} - cnpg_pg_replication_is_wal_receiver_up{namespace="dawarich"}) < 1 + for: 5m + labels: + severity: critical + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterHAWarning + annotations: + summary: CNPG Cluster less than 2 standby replicas. + description: |- + CloudNativePG Cluster "{{`{{`}} $labels.job {{`}}`}}" has only {{`{{`}} $value {{`}}`}} standby replicas, putting + your cluster at risk if another instance fails. The cluster is still able to operate normally, although + the `-ro` and `-r` endpoints operate at reduced capacity. + + This can happen during a normal fail-over or automated minor version upgrades. The replaced instance may + need some time to catch-up with the cluster primary instance. + + This alarm will be constantly triggered if your cluster is configured to run with less than 3 instances. + In this case you may want to silence it. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHAWarning.md + expr: | + max by (job) (cnpg_pg_replication_streaming_replicas{namespace="dawarich"} - cnpg_pg_replication_is_wal_receiver_up{namespace="dawarich"}) < 2 + for: 5m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterHighConnectionsCritical + annotations: + summary: CNPG Instance maximum number of connections critical! + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" instance {{`{{`}} $labels.pod {{`}}`}} is using {{`{{`}} $value {{`}}`}}% of + the maximum number of connections. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHighConnectionsCritical.md + expr: | + sum by (pod) (cnpg_backends_total{namespace="dawarich", pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) / max by (pod) (cnpg_pg_settings_setting{name="max_connections", namespace="dawarich", pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) * 100 > 95 + for: 5m + labels: + severity: critical + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterHighConnectionsWarning + annotations: + summary: CNPG Instance is approaching the maximum number of connections. + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" instance {{`{{`}} $labels.pod {{`}}`}} is using {{`{{`}} $value {{`}}`}}% of + the maximum number of connections. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHighConnectionsWarning.md + expr: | + sum by (pod) (cnpg_backends_total{namespace="dawarich", pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) / max by (pod) (cnpg_pg_settings_setting{name="max_connections", namespace="dawarich", pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) * 100 > 80 + for: 5m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterHighReplicationLag + annotations: + summary: CNPG Cluster high replication lag + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" is experiencing a high replication lag of + {{`{{`}} $value {{`}}`}}ms. + + High replication lag indicates network issues, busy instances, slow queries or suboptimal configuration. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterHighReplicationLag.md + expr: | + max(cnpg_pg_replication_lag{namespace="dawarich",pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) * 1000 > 1000 + for: 5m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterInstancesOnSameNode + annotations: + summary: CNPG Cluster instances are located on the same node. + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" has {{`{{`}} $value {{`}}`}} + instances on the same node {{`{{`}} $labels.node {{`}}`}}. + + A failure or scheduled downtime of a single node will lead to a potential service disruption and/or data loss. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterInstancesOnSameNode.md + expr: | + count by (node) (kube_pod_info{namespace="dawarich", pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) > 1 + for: 5m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterLongRunningTransactionWarning + annotations: + summary: CNPG Cluster query is taking longer than 5 minutes. + description: |- + CloudNativePG Cluster Pod {{ $labels.pod }} + is taking more than 5 minutes (300 seconds) for a query. + expr: |- + cnpg_backends_max_tx_duration_seconds{namespace="dawarich"} > 300 + for: 1m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterLowDiskSpaceCritical + annotations: + summary: CNPG Instance is running out of disk space! + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" is running extremely low on disk space. Check attached PVCs! + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterLowDiskSpaceCritical.md + expr: | + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"} / kubelet_volume_stats_capacity_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"})) > 0.9 OR + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-wal"} / kubelet_volume_stats_capacity_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-wal"})) > 0.9 OR + max(sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + / + sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + * + on(namespace, persistentvolumeclaim) group_left(volume) + kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"} + ) > 0.9 + for: 5m + labels: + severity: critical + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterLowDiskSpaceWarning + annotations: + summary: CNPG Instance is running out of disk space. + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" is running low on disk space. Check attached PVCs. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterLowDiskSpaceWarning.md + expr: | + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"} / kubelet_volume_stats_capacity_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"})) > 0.7 OR + max(max by(persistentvolumeclaim) (1 - kubelet_volume_stats_available_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-wal"} / kubelet_volume_stats_capacity_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-wal"})) > 0.7 OR + max(sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_used_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + / + sum by (namespace,persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes{namespace="dawarich", persistentvolumeclaim=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$-tbs.*"}) + * + on(namespace, persistentvolumeclaim) group_left(volume) + kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"} + ) > 0.7 + for: 5m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterOffline + annotations: + summary: CNPG Cluster has no running instances! + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" has no ready instances. + + Having an offline cluster means your applications will not be able to access the database, leading to + potential service disruption and/or data loss. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterOffline.md + expr: | + (count(cnpg_collector_up{namespace="dawarich",pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"}) OR on() vector(0)) == 0 + for: 5m + labels: + severity: critical + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterPGDatabaseXidAgeWarning + annotations: + summary: CNPG Cluster has a number of transactions from the frozen XID to the current one. + description: |- + Over 300,000,000 transactions from frozen xid + on pod {{ $labels.pod }} + expr: | + cnpg_pg_database_xid_age{namespace="dawarich"} > 300000000 + for: 1m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterPGReplicationWarning + annotations: + summary: CNPG Cluster standby is lagging behind the primary. + description: |- + Standby is lagging behind by over 300 seconds (5 minutes) + expr: | + cnpg_pg_replication_lag{namespace="dawarich"} > 300 + for: 1m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterReplicaFailingReplicationWarning + annotations: + summary: CNPG Cluster has a replica is failing to replicate. + description: |- + Replica {{ $labels.pod }} + is failing to replicate + expr: | + cnpg_pg_replication_in_recovery{namespace="dawarich"} > cnpg_pg_replication_is_wal_receiver_up{namespace="dawarich"} + for: 1m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster + - alert: CNPGClusterZoneSpreadWarning + annotations: + summary: CNPG Cluster instances in the same zone. + description: |- + CloudNativePG Cluster "dawarich/dawarich-postgresql-18-cluster" has instances in the same availability zone. + + A disaster in one availability zone will lead to a potential service disruption and/or data loss. + runbook_url: https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/docs/runbooks/CNPGClusterZoneSpreadWarning.md + expr: | + 3 > count(count by (label_topology_kubernetes_io_zone) (kube_pod_info{namespace="dawarich", pod=~"dawarich-postgresql-18-cluster-([1-9][0-9]*)$"} * on(node,instance) group_left(label_topology_kubernetes_io_zone) kube_node_labels)) < 3 + for: 5m + labels: + severity: warning + namespace: dawarich + cnpg_cluster: dawarich-postgresql-18-cluster diff --git a/clusters/cl01tl/manifests/dawarich/PrometheusRule-dawarich-valkey.yaml b/clusters/cl01tl/manifests/dawarich/PrometheusRule-dawarich-valkey.yaml new file mode 100644 index 000000000..b136b469e --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/PrometheusRule-dawarich-valkey.yaml @@ -0,0 +1,47 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: dawarich-valkey + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/part-of: valkey +spec: + groups: + - name: dawarich-valkey + rules: + - alert: ValkeyDown + annotations: + description: Valkey instance {{ $labels.instance }} is down. + summary: Valkey instance {{ $labels.instance }} down + expr: | + redis_up{service="dawarich-valkey-metrics"} == 0 + for: 2m + labels: + severity: error + - alert: ValkeyMemoryHigh + annotations: + description: | + Valkey instance {{ $labels.instance }} is using {{ $value }}% of its available memory. + summary: Valkey instance {{ $labels.instance }} is using too much memory + expr: | + redis_memory_used_bytes{service="dawarich-valkey-metrics"} * 100 + / + redis_memory_max_bytes{service="dawarich-valkey-metrics"} + > 90 <= 100 + for: 2m + labels: + severity: error + - alert: ValkeyKeyEviction + annotations: + description: | + Valkey instance {{ $labels.instance }} has evicted {{ $value }} keys in the last 5 minutes. + summary: Valkey instance {{ $labels.instance }} has evicted keys + expr: | + increase(redis_evicted_keys_total{service="dawarich-valkey-metrics"}[5m]) > 0 + for: 1s + labels: + severity: error diff --git a/clusters/cl01tl/manifests/dawarich/ScheduledBackup-dawarich-postgresql-18-scheduled-backup-live-backup.yaml b/clusters/cl01tl/manifests/dawarich/ScheduledBackup-dawarich-postgresql-18-scheduled-backup-live-backup.yaml new file mode 100644 index 000000000..0b9fb70b2 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ScheduledBackup-dawarich-postgresql-18-scheduled-backup-live-backup.yaml @@ -0,0 +1,25 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: ScheduledBackup +metadata: + name: "dawarich-postgresql-18-scheduled-backup-live-backup" + namespace: dawarich + labels: + helm.sh/chart: postgres-18-cluster-7.8.0 + app.kubernetes.io/name: dawarich-postgresql-18 + app.kubernetes.io/instance: dawarich + app.kubernetes.io/part-of: dawarich + app.kubernetes.io/version: "7.8.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: "dawarich-postgresql-18-scheduled-backup-live-backup" +spec: + immediate: true + suspend: true + schedule: "0 0 0 * * *" + backupOwnerReference: self + cluster: + name: dawarich-postgresql-18-cluster + method: plugin + pluginConfiguration: + name: barman-cloud.cloudnative-pg.io + parameters: + barmanObjectName: "dawarich-postgresql-18-backup-garage-local" diff --git a/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-headless.yaml b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-headless.yaml new file mode 100644 index 000000000..21607359e --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-headless.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: dawarich-valkey-headless + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: headless +spec: + type: ClusterIP + clusterIP: None + publishNotReadyAddresses: true + ports: + - name: tcp + port: 6379 + targetPort: tcp + protocol: TCP + selector: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich diff --git a/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-metrics.yaml b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-metrics.yaml new file mode 100644 index 000000000..6116d613c --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-metrics.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: dawarich-valkey-metrics + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: metrics + app.kubernetes.io/part-of: valkey + annotations: +spec: + type: ClusterIP + ports: + - name: metrics + port: 9121 + protocol: TCP + targetPort: metrics + selector: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich diff --git a/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-read.yaml b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-read.yaml new file mode 100644 index 000000000..5a9287b67 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey-read.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: dawarich-valkey-read + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: read +spec: + type: ClusterIP + ports: + - name: tcp + port: 6379 + targetPort: tcp + protocol: TCP + selector: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich diff --git a/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey.yaml b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey.yaml new file mode 100644 index 000000000..c31d172bd --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Service-dawarich-valkey.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: dawarich-valkey + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/component: primary +spec: + type: ClusterIP + ports: + - port: 6379 + targetPort: tcp + protocol: TCP + name: tcp + selector: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + statefulset.kubernetes.io/pod-name: dawarich-valkey-0 diff --git a/clusters/cl01tl/manifests/dawarich/Service-dawarich.yaml b/clusters/cl01tl/manifests/dawarich/Service-dawarich.yaml new file mode 100644 index 000000000..37922b601 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/Service-dawarich.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Service +metadata: + name: dawarich + labels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + app.kubernetes.io/service: dawarich + helm.sh/chart: dawarich-4.6.2 + namespace: dawarich +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 3000 + protocol: TCP + name: http + - port: 9394 + targetPort: 9394 + protocol: TCP + name: metrics + selector: + app.kubernetes.io/controller: main + app.kubernetes.io/instance: dawarich + app.kubernetes.io/name: dawarich diff --git a/clusters/cl01tl/manifests/dawarich/ServiceAccount-dawarich-valkey.yaml b/clusters/cl01tl/manifests/dawarich/ServiceAccount-dawarich-valkey.yaml new file mode 100644 index 000000000..d66aa63d2 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ServiceAccount-dawarich-valkey.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: dawarich-valkey + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm +automountServiceAccountToken: false diff --git a/clusters/cl01tl/manifests/dawarich/ServiceMonitor-dawarich-valkey.yaml b/clusters/cl01tl/manifests/dawarich/ServiceMonitor-dawarich-valkey.yaml new file mode 100644 index 000000000..6cc8d0a17 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ServiceMonitor-dawarich-valkey.yaml @@ -0,0 +1,24 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: dawarich-valkey + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/part-of: valkey + app.kubernetes.io/component: service-monitor +spec: + endpoints: + - port: metrics + interval: 30s + namespaceSelector: + matchNames: + - dawarich + selector: + matchLabels: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/component: metrics diff --git a/clusters/cl01tl/manifests/dawarich/ServiceMonitor-dawarich.yaml b/clusters/cl01tl/manifests/dawarich/ServiceMonitor-dawarich.yaml new file mode 100644 index 000000000..7bfaa6111 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/ServiceMonitor-dawarich.yaml @@ -0,0 +1,24 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: dawarich + labels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: dawarich + helm.sh/chart: dawarich-4.6.2 + namespace: dawarich +spec: + jobLabel: dawarich + namespaceSelector: + matchNames: + - dawarich + selector: + matchLabels: + app.kubernetes.io/instance: dawarich + app.kubernetes.io/name: dawarich + endpoints: + - interval: 30s + path: /metrics + port: metrics + scrapeTimeout: 15s diff --git a/clusters/cl01tl/manifests/dawarich/StatefulSet-dawarich-valkey.yaml b/clusters/cl01tl/manifests/dawarich/StatefulSet-dawarich-valkey.yaml new file mode 100644 index 000000000..cadc30d77 --- /dev/null +++ b/clusters/cl01tl/manifests/dawarich/StatefulSet-dawarich-valkey.yaml @@ -0,0 +1,129 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: dawarich-valkey + labels: + helm.sh/chart: valkey-0.9.3 + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + app.kubernetes.io/version: "9.0.3" + app.kubernetes.io/managed-by: Helm +spec: + serviceName: dawarich-valkey-headless + replicas: 3 + podManagementPolicy: OrderedReady + selector: + matchLabels: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + volumeClaimTemplates: + - metadata: + name: valkey-data + spec: + accessModes: + - ReadWriteOnce + storageClassName: "ceph-block" + resources: + requests: + storage: "1Gi" + template: + metadata: + labels: + app.kubernetes.io/name: valkey + app.kubernetes.io/instance: dawarich + annotations: + checksum/initconfig: "b1e9c56c9439a06e231c05897dbd90b9" + spec: + automountServiceAccountToken: false + serviceAccountName: dawarich-valkey + securityContext: + fsGroup: 1000 + runAsGroup: 1000 + runAsUser: 1000 + initContainers: + - name: dawarich-valkey-init + image: docker.io/valkey/valkey:9.0.3 + imagePullPolicy: IfNotPresent + securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + command: ["/scripts/init.sh"] + env: + - name: POD_INDEX + valueFrom: + fieldRef: + fieldPath: metadata.labels['apps.kubernetes.io/pod-index'] + volumeMounts: + - name: valkey-data + mountPath: /data + - name: scripts + mountPath: /scripts + containers: + - name: dawarich-valkey + image: docker.io/valkey/valkey:9.0.3 + imagePullPolicy: IfNotPresent + command: ["valkey-server"] + args: ["/data/conf/valkey.conf"] + securityContext: + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + env: + - name: POD_INDEX + valueFrom: + fieldRef: + fieldPath: metadata.labels['apps.kubernetes.io/pod-index'] + - name: VALKEY_LOGLEVEL + value: "notice" + ports: + - name: tcp + containerPort: 6379 + protocol: TCP + startupProbe: + exec: + command: ["sh", "-c", "valkey-cli ping"] + livenessProbe: + exec: + command: ["sh", "-c", "valkey-cli ping"] + resources: + requests: + cpu: 10m + memory: 128Mi + volumeMounts: + - name: valkey-data + mountPath: /data + - name: metrics + image: ghcr.io/oliver006/redis_exporter:v1.81.0 + imagePullPolicy: "IfNotPresent" + ports: + - name: metrics + containerPort: 9121 + startupProbe: + tcpSocket: + port: metrics + livenessProbe: + tcpSocket: + port: metrics + readinessProbe: + httpGet: + path: / + port: metrics + resources: + requests: + cpu: 10m + memory: 64M + env: + - name: REDIS_ALIAS + value: dawarich-valkey + volumes: + - name: scripts + configMap: + name: dawarich-valkey-init-scripts + defaultMode: 0555 diff --git a/clusters/cl01tl/manifests/gatus/ConfigMap-gatus.yaml b/clusters/cl01tl/manifests/gatus/ConfigMap-gatus.yaml index 512ebc870..a06a4b6dc 100644 --- a/clusters/cl01tl/manifests/gatus/ConfigMap-gatus.yaml +++ b/clusters/cl01tl/manifests/gatus/ConfigMap-gatus.yaml @@ -150,6 +150,15 @@ data: interval: 30s name: home-assistant url: https://home-assistant.alexlebens.net + - alerts: + - type: ntfy + conditions: + - '[STATUS] == 200' + - '[CERTIFICATE_EXPIRATION] > 240h' + group: core + interval: 30s + name: dawarich + url: https://dawarich.alexlebens.net - alerts: - type: ntfy conditions: diff --git a/clusters/cl01tl/manifests/gatus/Deployment-gatus.yaml b/clusters/cl01tl/manifests/gatus/Deployment-gatus.yaml index 9703e69d4..685b06f05 100644 --- a/clusters/cl01tl/manifests/gatus/Deployment-gatus.yaml +++ b/clusters/cl01tl/manifests/gatus/Deployment-gatus.yaml @@ -26,7 +26,7 @@ spec: app.kubernetes.io/name: gatus app.kubernetes.io/instance: gatus annotations: - checksum/config: b6bbac2c9127b1fe7c571e2de2454ea30168b12460b08f1e857ae00a0e2027d6 + checksum/config: 37cc851f2a403f231439e4af7d0f920e653fe8020cb9866c1aca97ec802b5059 spec: serviceAccountName: default automountServiceAccountToken: false diff --git a/clusters/cl01tl/manifests/homepage/ConfigMap-homepage.yaml b/clusters/cl01tl/manifests/homepage/ConfigMap-homepage.yaml index 838cfdfb9..9d333f697 100644 --- a/clusters/cl01tl/manifests/homepage/ConfigMap-homepage.yaml +++ b/clusters/cl01tl/manifests/homepage/ConfigMap-homepage.yaml @@ -184,6 +184,12 @@ data: href: https://home-assistant.alexlebens.net siteMonitor: http://home-assistant-main.home-assistant:80 statusStyle: dot + - Location: + icon: sh-dawarich.webp + description: Dawarich + href: https://dawarich.alexlebens.net + siteMonitor: http://dawarich.dawarich:80 + statusStyle: dot - Budgeting: icon: sh-actual-budget.webp description: Actual diff --git a/clusters/cl01tl/manifests/homepage/Deployment-homepage.yaml b/clusters/cl01tl/manifests/homepage/Deployment-homepage.yaml index 788ba9778..f70deb474 100644 --- a/clusters/cl01tl/manifests/homepage/Deployment-homepage.yaml +++ b/clusters/cl01tl/manifests/homepage/Deployment-homepage.yaml @@ -24,7 +24,7 @@ spec: template: metadata: annotations: - checksum/configMaps: e5840e1e79ef33df5d056466857cc71fb40d97885b26f125c89c813ba1ba3e91 + checksum/configMaps: d6b3d87be5638042898e9b3e7f494bf2415fd7092ea263ad7826ae488e1b3105 checksum/secrets: d3ba83f111cd32f92c909268c55ad8bbd4f9e299b74b35b33c1a011180d8b378 labels: app.kubernetes.io/controller: main