From cb4bd089fc518f15e6fb6bbcc8063ce158c88527 Mon Sep 17 00:00:00 2001 From: Thomas Blarre Date: Sat, 9 Nov 2024 08:04:02 +0000 Subject: [PATCH] Added uptime kuma --- uptime-kuma-argocd-apps/.helmignore | 23 +++++++ uptime-kuma-argocd-apps/Chart.yaml | 5 ++ .../templates/_helpers.tpl | 62 +++++++++++++++++++ .../uptime-kuma--postinstall-app.yaml | 30 +++++++++ .../templates/uptime-kuma-chart.yaml | 41 ++++++++++++ uptime-kuma-argocd-apps/values.yaml | 7 +++ uptime-kuma-postinstall/.helmignore | 23 +++++++ uptime-kuma-postinstall/Chart.yaml | 5 ++ .../templates/_helpers.tpl | 62 +++++++++++++++++++ .../templates/ts-monitoring-ingress.yaml | 14 +++++ uptime-kuma-postinstall/values.yaml | 2 + 11 files changed, 274 insertions(+) create mode 100644 uptime-kuma-argocd-apps/.helmignore create mode 100644 uptime-kuma-argocd-apps/Chart.yaml create mode 100644 uptime-kuma-argocd-apps/templates/_helpers.tpl create mode 100644 uptime-kuma-argocd-apps/templates/uptime-kuma--postinstall-app.yaml create mode 100644 uptime-kuma-argocd-apps/templates/uptime-kuma-chart.yaml create mode 100644 uptime-kuma-argocd-apps/values.yaml create mode 100644 uptime-kuma-postinstall/.helmignore create mode 100644 uptime-kuma-postinstall/Chart.yaml create mode 100644 uptime-kuma-postinstall/templates/_helpers.tpl create mode 100644 uptime-kuma-postinstall/templates/ts-monitoring-ingress.yaml create mode 100644 uptime-kuma-postinstall/values.yaml diff --git a/uptime-kuma-argocd-apps/.helmignore b/uptime-kuma-argocd-apps/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/uptime-kuma-argocd-apps/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/uptime-kuma-argocd-apps/Chart.yaml b/uptime-kuma-argocd-apps/Chart.yaml new file mode 100644 index 0000000..5282928 --- /dev/null +++ b/uptime-kuma-argocd-apps/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: uptime-kuma-argocd-apps +description: A Helm chart for deploying uptime kuma +type: application +version: 0.1.0 diff --git a/uptime-kuma-argocd-apps/templates/_helpers.tpl b/uptime-kuma-argocd-apps/templates/_helpers.tpl new file mode 100644 index 0000000..3497587 --- /dev/null +++ b/uptime-kuma-argocd-apps/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "uptime-kuma-argocd-apps.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "uptime-kuma-argocd-apps.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "uptime-kuma-argocd-apps.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "uptime-kuma-argocd-apps.labels" -}} +helm.sh/chart: {{ include "uptime-kuma-argocd-apps.chart" . }} +{{ include "uptime-kuma-argocd-apps.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "uptime-kuma-argocd-apps.selectorLabels" -}} +app.kubernetes.io/name: {{ include "uptime-kuma-argocd-apps.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "uptime-kuma-argocd-apps.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "uptime-kuma-argocd-apps.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/uptime-kuma-argocd-apps/templates/uptime-kuma--postinstall-app.yaml b/uptime-kuma-argocd-apps/templates/uptime-kuma--postinstall-app.yaml new file mode 100644 index 0000000..8043a6b --- /dev/null +++ b/uptime-kuma-argocd-apps/templates/uptime-kuma--postinstall-app.yaml @@ -0,0 +1,30 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: uptime-kuma-postinstall + namespace: {{ .Values.argocd.namespace }} + annotations: + argocd.argoproj.io/sync-wave: "1" + notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578" +spec: + project: {{ .Values.argocd.project }} + source: + repoURL: "https://git.blarre.net/thomas/helm-charts.git" + targetRevision: HEAD + path: uptime-kuma-postinstall + helm: + releaseName: uptime-kuma-postinstall + valuesObject: + tailscaleIngresses: + uptimeKumaHostname: {{ .Values.tailscaleIngresses.uptimeKumaHostname }} + destination: + server: {{ .Values.mainDestination }} + namespace: {{ .Values.mainNamespace }} + syncPolicy: + automated: + prune: true # Automatically remove resources no longer in the repo + selfHeal: true # Automatically self-heal when drift is detected + syncOptions: + - ApplyOutOfSyncOnly=true + - ServerSideApply=true + - CreateNamespace=true diff --git a/uptime-kuma-argocd-apps/templates/uptime-kuma-chart.yaml b/uptime-kuma-argocd-apps/templates/uptime-kuma-chart.yaml new file mode 100644 index 0000000..b5e9b07 --- /dev/null +++ b/uptime-kuma-argocd-apps/templates/uptime-kuma-chart.yaml @@ -0,0 +1,41 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: uptime-kuma + namespace: {{ .Values.argocd.namespace }} + annotations: + argocd.argoproj.io/sync-wave: "0" + notifications.argoproj.io/subscribe.on-sync-succeeded.telegram: "-1002270587578" +spec: + project: {{ .Values.argocd.project }} + source: + repoURL: "tccr.io/truecharts" + chart: uptime-kuma + targetRevision: 23.x + helm: + releaseName: monitoring + valuesObject: + persistence: + config: + enabled: true + mountPath: "/app/data" + size: 1Gi + metrics: + main: + enabled: false + destination: + server: {{ .Values.mainDestination }} + namespace: {{ .Values.mainNamespace }} + syncPolicy: + automated: + prune: true # Automatically remove resources no longer in the repo + selfHeal: true # Automatically self-heal when drift is detected + syncOptions: + - ApplyOutOfSyncOnly=true + - ServerSideApply=true + - CreateNamespace=true + ignoreDifferences: + - group: apps + kind: Deployment + jsonPointers: + - /spec/template/spec/hostUsers diff --git a/uptime-kuma-argocd-apps/values.yaml b/uptime-kuma-argocd-apps/values.yaml new file mode 100644 index 0000000..3c45b14 --- /dev/null +++ b/uptime-kuma-argocd-apps/values.yaml @@ -0,0 +1,7 @@ +argocd: + namespace: argocd + project: default +tailscaleIngresses: + uptimeKumaHostname: monitoring +mainNamespace: monitoring +mainDestination: https://kubernetes.default.svc \ No newline at end of file diff --git a/uptime-kuma-postinstall/.helmignore b/uptime-kuma-postinstall/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/uptime-kuma-postinstall/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/uptime-kuma-postinstall/Chart.yaml b/uptime-kuma-postinstall/Chart.yaml new file mode 100644 index 0000000..5b16f73 --- /dev/null +++ b/uptime-kuma-postinstall/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: uptime-kuma-postinstall +description: A Helm chart for deploying ressources after uptime kuma is deployed, mainly ingress +type: application +version: 0.1.0 \ No newline at end of file diff --git a/uptime-kuma-postinstall/templates/_helpers.tpl b/uptime-kuma-postinstall/templates/_helpers.tpl new file mode 100644 index 0000000..f3c0a7b --- /dev/null +++ b/uptime-kuma-postinstall/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "uptime-kuma-postinstall.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "uptime-kuma-postinstall.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "uptime-kuma-postinstall.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "uptime-kuma-postinstall.labels" -}} +helm.sh/chart: {{ include "uptime-kuma-postinstall.chart" . }} +{{ include "uptime-kuma-postinstall.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "uptime-kuma-postinstall.selectorLabels" -}} +app.kubernetes.io/name: {{ include "uptime-kuma-postinstall.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "uptime-kuma-postinstall.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "uptime-kuma-postinstall.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/uptime-kuma-postinstall/templates/ts-monitoring-ingress.yaml b/uptime-kuma-postinstall/templates/ts-monitoring-ingress.yaml new file mode 100644 index 0000000..2b8c1c8 --- /dev/null +++ b/uptime-kuma-postinstall/templates/ts-monitoring-ingress.yaml @@ -0,0 +1,14 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ts-monitoring +spec: + defaultBackend: + service: + name: monitoring-uptime-kuma + port: + number: 3001 + ingressClassName: tailscale + tls: + - hosts: + - {{ .Values.tailscaleIngresses.uptimeKumaHostname }} diff --git a/uptime-kuma-postinstall/values.yaml b/uptime-kuma-postinstall/values.yaml new file mode 100644 index 0000000..f54a30a --- /dev/null +++ b/uptime-kuma-postinstall/values.yaml @@ -0,0 +1,2 @@ +tailscaleIngresses: + uptimeKumaHostname: monitoring \ No newline at end of file