Skip to content

Commit

Permalink
Merge pull request #10 from jordanopensource/feature/uptime-kuma-chart
Browse files Browse the repository at this point in the history
Add Uptime-Kuma helm chart
  • Loading branch information
wissamataleh authored Aug 22, 2021
2 parents 78795c0 + 154dcbc commit d9b2dfa
Show file tree
Hide file tree
Showing 14 changed files with 593 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/uptime-kuma/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
17 changes: 17 additions & 0 deletions charts/uptime-kuma/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v2
name: uptime-kuma
appVersion: 1.3.2
description: A fancy self-hosted monitoring tool.
home: https://github.com/louislam/uptime-kuma
maintainers:
- email: admin@josa.ngo
name: Jordan Open Source Association
version: 1.0.0
keywords:
- monitoring
- uptime
- uptime-kuma
- healthcheck
icon: https://github.com/louislam/uptime-kuma/blob/master/public/icon.png
sources:
- https://github.com/louislam/uptime-kuma
123 changes: 123 additions & 0 deletions charts/uptime-kuma/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Uptime-Kuma

A fancy self-hosted monitoring tool.

Chart version : 1.0.0

Default Uptime-Kuma image [here](https://github.com/louislam/uptime-kuma)

Current Uptime-Kuma image version: [1.3.2](https://github.com/louislam/uptime-kuma/releases/tag/1.3.2)


## Prerequisites
- Kubernetes 1.20
- Helm 3+


## Installing the Chart

Add JOSA's chart repository to Helm:

```console
$ helm repo add josa https://charts.josa.ngo
$ helm repo update
```

Install the chart with the release name `my-release`:

```console
$ helm install my-release josa/uptime-kuma
```

These commands deploy Uptime-Kuma on the Kubernetes cluster in the default configuration. The [Values](#values) section lists the parameters that can be configured during installation.


## Uninstalling the Chart

To uninstall/delete the `my-release` release:

```console
$ helm delete my-release
```

## Enviroment Variables

See `values.yaml` for available enviroment variables.


## Values

The following tables lists the configurable parameters of the Uptime-Kuma chart and their default values per section/component:


### Deployment values

| Parameter | Description | Default |
|-----------------------|-----------------------------------------------------------|---------------------------------------------------|
| `imagePullSecrets` | Docker registry secret names as an array | `[]` |
| `nameOverride` | String to partially override uptime-kuma.fullname | `nil` |
| `fullnameOverride` | String to fully override uptime-kuma.fullname | `nil` |
| `image.repository` | Uptime-Kuma image | `louislam/uptime-kuma` |
| `image.tag` | Uptime-Kuma image tag | `""` (defaults to chart appVersion if empty) |
| `image.pullPolicy` | Uptime-Kuma image pull policy | `IfNotPresent` |
| `replicaCount` | Number of Uptime-Kuma replicas to deploy | `1` |
| `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) |
| `nodeSelector` | Node labels for pod assignment | `{}` (evaluated as a template) |
| `tolerations` | Tolerations for pod assignment | `[]` (evaluated as a template) |
| `podAnnotations` | Annotations for Uptime-Kuma pods | `{}` (evaluated as a template) |
| `podSecurityContext` | Uptime-Kuma pods' Security Context | `{}` (evaluated as a template) |
| `securityContext` | Uptime-Kuma containers' Security Context | `{}` (evaluated as a template) |
| `resources` | The resources for the Uptime-Kuma container | `{}` (evaluated as a template) |
| `env` | Environment variables to configure Uptime-Kuma container | `{}` (evaluated as a configMap) |
| `secretNamesForEnv` | Array of secrets names contaning extra env vars | `[]` |


### Exposure values

| Parameter | Description | Default |
|---------------------------------------|--------------------------------------------------|------------------------------- |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.port` | Service HTTP port | `80` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.annotations` | Ingress annotations | `{}` (evaluated as a template) |
| `ingress.className` | Ingress className | `""` |
| `ingress.hosts` | Hosts array for the ingress resource | `[]` |
| `ingress.hosts[0].host` | Host for the ingress resource | `[]` |
| `ingress.hosts[0].paths` | paths array for the ingress resource host | `[]` |
| `ingress.hosts[0].paths[0].path` | Ingress path | `/` |
| `ingress.hosts[0].paths[0].pathType` | Ingress path type | `ImplementationSpecific` |
| `ingress.tls` | TLS configuration for the hosts | `[]` |
| `ingress.tls[0].hosts` | Hosts to be covered with the TLS configuration | `nil` |
| `ingress.tls[0].secretName` | TLS configuration secret name | `nil` |


### Persistence values

| Name | Description | Default |
| --------------------------------|-----------------------------------------------------------------------------------------------------------|-------------------|
| `persistence.enabled` | Enable persistence | `true` |
| `persistence.accessMode` | Access mode to the PV | `[ReadWriteOnce]` |
| `persistence.storageClass` | Storage class to use with the PVC | `"-"` |
| `persistence.existingClaim` | If you want to reuse an existing claim, you can pass the name of the PVC using the existingClaim variable | `""` |
| `persistence.size` | Size for the PV | `4Gi` |
| `persistence.annotations` | Annotations for Uptime-Kuma PVC | `{}` |


### RBAC values

| Parameter | Description | Default |
|-------------------------------|---------------------------------------------------------------|-----------------------------------------------------|
| `serviceAccount.create` | Enable the creation of a ServiceAccount for Uptime-Kuma pods | `true` |
| `serviceAccount.name` | Name of the created ServiceAccount | Generated using the `uptime-kuma.fullname` template |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` (evaluated as a template) |


### Other values

| Parameter | Description | Default |
|-------------------------------------------------|-----------------------------------------|------------|
| `autoscaling.enabled` | Enable autoscaling for Uptime-Kuma | `false` |
| `autoscaling.minReplicas` | Minimum number of Uptime-Kuma replicas | `1` |
| `autoscaling.maxReplicas` | Maximum number of Uptime-Kuma replicas | `100` |
| `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage | `80` |
| `autoscaling.targetMemoryUtilizationPercentage` | Target Memory utilization percentage | `80` |
22 changes: 22 additions & 0 deletions charts/uptime-kuma/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "uptime-kuma.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "uptime-kuma.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "uptime-kuma.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "uptime-kuma.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/uptime-kuma/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "uptime-kuma.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.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.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "uptime-kuma.labels" -}}
helm.sh/chart: {{ include "uptime-kuma.chart" . }}
{{ include "uptime-kuma.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.selectorLabels" -}}
app.kubernetes.io/name: {{ include "uptime-kuma.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "uptime-kuma.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "uptime-kuma.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/uptime-kuma/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.env }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "uptime-kuma.fullname" . }}-config
labels:
{{- include "uptime-kuma.labels" . | nindent 4 }}
data:
{{- range $envKey, $envVal := .Values.env }}
{{ $envKey | upper }}: {{ $envVal | quote }}
{{- end }}
{{- end }}
82 changes: 82 additions & 0 deletions charts/uptime-kuma/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "uptime-kuma.fullname" . }}
labels:
{{- include "uptime-kuma.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "uptime-kuma.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "uptime-kuma.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "uptime-kuma.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
{{- if .Values.env }}
- configMapRef:
name: {{ include "uptime-kuma.fullname" . }}-config
{{- end }}
{{- range .Values.secretNamesForEnv }}
- secretRef:
name: {{ . }}
{{- end }}
ports:
- name: http
containerPort: 3001
protocol: TCP
livenessProbe:
exec:
command:
- node
- extra/healthcheck.js
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /app/data
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "uptime-kuma.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
28 changes: 28 additions & 0 deletions charts/uptime-kuma/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "uptime-kuma.fullname" . }}
labels:
{{- include "uptime-kuma.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "uptime-kuma.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
Loading

0 comments on commit d9b2dfa

Please sign in to comment.