diff --git a/helmfile.d/gatus.yaml.gotmpl b/helmfile.d/gatus.yaml.gotmpl new file mode 100644 index 00000000..233a2358 --- /dev/null +++ b/helmfile.d/gatus.yaml.gotmpl @@ -0,0 +1,43 @@ +bases: + - ../envs/environments.yaml.gotmpl + +repositories: +- name: gatus + url: https://twin.github.io/helm-charts + +commonLabels: + tier: system + +releases: +- name: gatus + namespace: uptime + chart: gatus/gatus + version: 1.4.4 + condition: gatus.enabled + values: + - ../values/gatus/values/values.yaml + - ../values/gatus/values/values-{{ .Environment.Name }}.yaml + postRenderer: ../bin/kustomizer + postRendererArgs: + - ../values/gatus/kustomize/{{ .Environment.Name }} + missingFileHandler: Info +- name: manifests + namespace: gatus-system + chart: manifests + condition: gatus.enabled + missingFileHandler: Info + values: + - ../values/env.yaml + - ../values/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml + - ../values/gatus/env.yaml.gotmpl + - ../values/gatus/env-{{ requiredEnv "ARGOCD_ENV_CLUSTER_NAME" }}.yaml.gotmpl + hooks: + - events: [ prepare, cleanup ] + showlogs: true + command: ../bin/helmify + args: + - '{{`{{ if eq .Event.Name "prepare" }}build{{ else }}clean{{ end }}`}}' + - '{{`{{ .Release.Chart }}`}}' + - '{{`{{ .Environment.Name }}`}}' + - ../values/gatus/manifests + - manifests diff --git a/values/argo/manifests/sys-project.yaml b/values/argo/manifests/sys-project.yaml index 95108076..2ddc66cb 100644 --- a/values/argo/manifests/sys-project.yaml +++ b/values/argo/manifests/sys-project.yaml @@ -84,6 +84,8 @@ spec: server: https://kubernetes.default.svc - namespace: spegel server: https://kubernetes.default.svc + - namespace: uptime + server: https://kubernetes.default.svc sourceRepos: - https://argoproj.github.io/argo-helm - https://kubernetes-sigs.github.io/metrics-server/ @@ -122,3 +124,4 @@ spec: - https://operator.mariadb.com/mariadb-enterprise-operator - https://operator.mariadb.com - https://ot-container-kit.github.io/helm-charts + - https://twin.github.io/helm-charts diff --git a/values/gatus/env-hel1.yaml.gotmpl b/values/gatus/env-hel1.yaml.gotmpl new file mode 100644 index 00000000..720e7bdd --- /dev/null +++ b/values/gatus/env-hel1.yaml.gotmpl @@ -0,0 +1,2 @@ +gatus: + enabled: true diff --git a/values/gatus/env-rossby.yaml.gotmpl b/values/gatus/env-rossby.yaml.gotmpl new file mode 100644 index 00000000..ab28c94a --- /dev/null +++ b/values/gatus/env-rossby.yaml.gotmpl @@ -0,0 +1,2 @@ +gatus: + enabled: true diff --git a/values/gatus/env.yaml.gotmpl b/values/gatus/env.yaml.gotmpl new file mode 100644 index 00000000..15fb85a1 --- /dev/null +++ b/values/gatus/env.yaml.gotmpl @@ -0,0 +1,4 @@ +gatus: + enabled: false + autosync: false + env: default diff --git a/values/gatus/manifests/cluster.yaml b/values/gatus/manifests/cluster.yaml new file mode 100644 index 00000000..0234bbed --- /dev/null +++ b/values/gatus/manifests/cluster.yaml @@ -0,0 +1,14 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: prod-gatus-db + namespace: uptime +spec: + instances: 1 + imageName: ghcr.io/cloudnative-pg/postgresql:17 + storage: + resizeInUseVolumes: true + size: 15Gi + backup: + retentionPolicy: 30d + target: prefer-standby diff --git a/values/gatus/manifests/gatus.yaml b/values/gatus/manifests/gatus.yaml new file mode 100644 index 00000000..a96b7c5e --- /dev/null +++ b/values/gatus/manifests/gatus.yaml @@ -0,0 +1,38 @@ +{{- if .Values.clusterConfig.argo.enabled }} +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: gatus + namespace: argocd +spec: + destination: + namespace: uptime + server: 'https://kubernetes.default.svc' + sources: + - repoURL: {{ .Values.clusterConfig.manifests }} + targetRevision: HEAD + path: helmfile.d + plugin: + name: helmfile-cmp + env: + - name: CLUSTER_NAME + value: {{ .Values.clusterConfig.cluster }} + - name: HELMFILE_ENVIRONMENT + value: default + - name: HELMFILE_FILE_PATH + value: gatus.yaml.gotmpl + project: sys + syncPolicy: + managedNamespaceMetadata: + labels: + component: sys + syncOptions: + - CreateNamespace=true + - ApplyOutOfSyncOnly=true + - ServerSideApply=true + {{- if .Values.gatus.autosync }} + automated: + prune: true + # selfHeal: false + {{- end }} +{{- end }} diff --git a/values/gatus/manifests/ingress.yaml b/values/gatus/manifests/ingress.yaml new file mode 100644 index 00000000..d760236f --- /dev/null +++ b/values/gatus/manifests/ingress.yaml @@ -0,0 +1,31 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt-production + nginx.ingress.kubernetes.io/backend-protocol: HTTP + nginx.ingress.kubernetes.io/cors-allow-headers: Content-Type, x-gatus-cache + nginx.ingress.kubernetes.io/enable-cors: "true" + nginx.ingress.kubernetes.io/proxy-buffer-size: 128k + nginx.ingress.kubernetes.io/ssl-redirect: "true" + labels: + app.kubernetes.io/name: gatus + name: gatus + namespace: uptime +spec: + ingressClassName: nginx + rules: + - host: uptime.srv.oceanbox.io + http: + paths: + - backend: + service: + name: gatus + port: + number: 80 + path: / + pathType: ImplementationSpecific + tls: + - hosts: + - uptime.srv.oceanbox.io + secretName: gatus-tls diff --git a/values/gatus/manifests/secret.yaml b/values/gatus/manifests/secret.yaml new file mode 100644 index 00000000..c1e0e87c --- /dev/null +++ b/values/gatus/manifests/secret.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +stringData: + DB_PASS: "test" +metadata: + name: gatus + namespace: uptime +type: Opaque diff --git a/values/gatus/values/values.yaml b/values/gatus/values/values.yaml new file mode 100644 index 00000000..47052478 --- /dev/null +++ b/values/gatus/values/values.yaml @@ -0,0 +1,88 @@ +image: + repository: twinproduction/gatus + tag: v5.26.0 + +# Does envFrom secret named gatus +secrets: true + +serviceMonitor: + enabled: true + +config: + web: + address: "[::]" + metrics: true + + storage: + type: postgres + path: "postgres://app:${DB_PASS}@prod-gatus-db:5432/app" + + ui: + title: Oceanbox + header: Oceanbox Monitoring + #logo: https://zarak.fr/resources/cyril-avatar.jpg + link: https://oceanbox.io + + .defaults: &defaults + interval: 30s + + .https-endpoint: &https-endpoint + <<: *defaults + conditions: + - "[STATUS] == 200" + - "[RESPONSE_TIME] <= 1000" + - "[CERTIFICATE_EXPIRATION] > 168h" # 7 days + + .tls-endpoint: &tls-endpoint + <<: *defaults + conditions: + - "[CONNECTED] == true" + - "[RESPONSE_TIME] <= 1000" + - "[CERTIFICATE_EXPIRATION] > 168h" # 7 days + + .tcp-endpoint: &tcp-endpoint + <<: *defaults + conditions: + - "[CONNECTED] == true" + - "[RESPONSE_TIME] <= 1000" + + endpoints: + - name: Atlantis + <<: *https-endpoint + group: "Primary Services" + url: https://maps.oceanbox.io/healthz + + - name: Sorcerer + <<: *https-endpoint + group: "Primary Services" + url: https://sorcerer.data.oceanbox.io/healthz + + - name: Plume + <<: *https-endpoint + group: "Secondary Services" + url: https://plume.data.oceanbox.io/healthz + + - name: Homepage + <<: *https-endpoint + group: "Secondary Services" + url: https://oceanbox.io + + - name: Homepage + <<: *https-endpoint + group: "Experimental Services" + url: https://oceanbox.io + + - name: Atlantis Beta + <<: *https-endpoint + group: "Experimental Services" + url: https://atlantis.beta.oceanbox.io/healthz + + - name: Sorcerer Beta + <<: *https-endpoint + group: "Experimental Services" + url: https://sorcerer.ekman.oceanbox.io/healthz + + - name: Plume Beta + <<: *https-endpoint + group: "Experimental Services" + url: https://plume.ekman.oceanbox.io/healthz