feat : uptime-kuma helm chart

This commit is contained in:
unchaptered 2024-11-07 15:57:49 +09:00
parent 13ea190298
commit 0dcaf787cb
11 changed files with 564 additions and 1 deletions

View file

@ -40,7 +40,6 @@ It is a temporary live demo, all data will be deleted after 10 minutes. Sponsore
### 🐳 Docker
```bash
docker run -d --restart=always -p 3001:3001 -v uptime-kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
```
Uptime Kuma is now running on <http://0.0.0.0:3001>.

View file

@ -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/

View file

@ -0,0 +1,16 @@
apiVersion: v2
name: uptime-kuma
namespace: uptime-kuma
description: A Helm chart for Kubernetes
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View file

@ -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 }}

View file

@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep-{{ default .Chart.Name .Values.nameOverride }}
namespace: {{ default .Chart.Name .Values.namespaceOverride }}
spec:
replicas: {{ .Values.deployment.spec.replicas }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
selector:
matchLabels:
app: {{ default .Chart.Name .Values.nameOverride }}
template:
metadata:
labels:
app: {{ default .Chart.Name .Values.nameOverride }}
spec:
containers:
- name: {{ default .Chart.Name .Values.nameOverride }}
image: {{ .Values.deployment.image }}
imagePullPolicy: Always
ports:
- containerPort: {{ default "3001" .Values.deployment.port }}
volumeMounts:
- name: app_data
mountPath: /app/data
readinessProbe: # Pod Container, 연결성 테스트 (트래픽 라우트 조건)
tcpSocket:
port: {{ default "3001" .Values.deployment.port }}
initialDelaySeconds: {{ default 60 .Values.deployment.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ default 60 .Values.deployment.readinessProbe.periodSeconds }}
livenessProbe: # Pod Container, 연결성 테스트 (재시작 조건)
httpGet:
path: {{ default "/" .Values.deployment.livenessProbe.path }}
port: {{ default "3001" .Values.deployment.port }}
initialDelaySeconds: {{ default 60 .Values.deployment.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ default 60 .Values.deployment.livenessProbe.periodSeconds }}
startupProbe: # Pod 실행 전, 연결성 테스트
httpGet:
path: {{ default "/" .Values.deployment.startupProbe.path }}
port: {{ default "3001" .Values.deployment.port }}
initialDelaySeconds: {{ default 60 .Values.deployment.startupProbe.initialDelaySeconds }}
periodSeconds: {{ default 60 .Values.deployment.startupProbe.periodSeconds }}
resources:
requests:
memory: "{{ default "256Mi" .Values.deployment.request.memory }}"
cpu: "{{ default "150m" .Values.deployment.request.cpu }}"
volumes:
- name: pvc-{{ default .Chart.Name .Values.nameOverride }}
persistentVolumeClaim:
claimName: pvc-{{ default .Chart.Name .Values.nameOverride }}

View file

@ -0,0 +1,45 @@
{{- if .Values.isEnableIngress }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ing-{{ default .Chart.Name .Values.nameOverride }}
namespace: {{ default .Chart.Name .Values.namespaceOverride }}
{{- with .Values.ingress.metadata.labels}}
labels:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end}}
{{- end }}
{{- with .Values.ingress.metadata.annotations }}
annotations:
{{- range $key, $value := .}}
{{ $key }}: {{ $value | quote }}
{{- end}}
{{- end }}
spec:
selector:
app: svc-{{ default .Chart.Name .Values.nameOverride }}
{{- with .Values.ingress.spec.selector }}
{{- range $key, $value := .}}
{{ $key }}: {{ $value | quote }}
{{- end}}
{{- end }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: carrieverse-abc-cms-api-dev
port:
number: 80
serviceName: svc-{{ default .Chart.Name .Values.nameOverride }}
{{- end }}

View file

@ -0,0 +1,17 @@
{{- if .Values.isEnablePersistVolume }}
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-{{ default .Chart.Name .Values.nameOverride }}
spec:
capacity:
storage: {{ .Values.persistVolume.size }}
volumeMode: {{ .Values.persistVolume.volumemode }}
accessModes: {{ .Values.persistVolume.accessmode }}
persistentVolumeReclaimPolicy: {{ .Values.persistVolume.persistentvolumereclaimpolicy }}
storageClassName: {{ .Values.persistVolume.storageClass }}
csi:
driver: {{ .Values.persistVolume.csi.driver }}
volumeHandle: {{ .Values.persistVolume.csi.handle }}
{{- end }}

View file

@ -0,0 +1,15 @@
{{- if .Values.isEnablePersistVolume }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-{{ default .Chart.Name .Values.nameOverride }}
namespace: {{ default .Chart.Name .Values.namespaceOverride }}
annotations:
volume.beta.kubernetes.io/storage-class: {{ .Values.persistVolume.storageClass }}
spec:
accessModes: {{ .Values.persistVolume.accessmode }}
storageClassName: {{ .Values.persistVolume.storageClass }}
resources:
requests:
storage: {{ .Values.persistVolume.size }}
{{- end }}

View file

@ -0,0 +1,54 @@
{{- if .Values.isEnableService }}
kind: Service
apiVersion: v1
metadata:
name: svc-{{ default .Chart.Name .Values.nameOverride }}
namespace: {{ default .Chart.Name .Values.namespaceOverride }}
{{- with .Values.service.metadata.labels}}
labels:
{{- range $key, $value := . }}
{{ $key }}: {{ $value | quote }}
{{- end}}
{{- end }}
{{- with .Values.service.metadata.annotations }}
annotations:
{{- range $key, $value := .}}
{{ $key }}: {{ $value | quote }}
{{- end}}
{{- end }}
spec:
annotations:
app: dep-{{ default .Chart.Name .Values.nameOverride }}
{{- with .Values.service.spec.selector }}
{{- range $key, $value := .}}
{{ $key }}: {{ $value | quote }}
{{- end}}
{{- end }}
ports:
- name: http
port: 80
protocol: TCP
targetPort: {{ .Values.deployment.port }}
- name: https
port: 443
protocol: TCP
targetPort: {{ .Values.deployment.port }}
type: {{ .Values.service.spec.type }}
{{- with .Values.service.spec.sessionAffinity }}
sessionAffinity: {{ . }}
{{- end}}
{{- with .Values.service.spec.externalIPs }}
externalIPs: {{ . }}
{{- end}}
{{- if or (eq .Values.service.spec.type "LoadBalacner" ) (eq .Values.service.spec.type "NodPort")}}
externalTrafficPolicy: {{ .Values.service.spec.externalTrafficPolicy }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,142 @@
nameOverride:
namespaceOverride:
# serviceAccountName: ~
# serviceAccount:
# create: false
# annotations: {}
isEnableConfigmap: false
isEnableIngress: true
isEnableService: true
isEnablePersistVolume: true
configmap:
dataMap:
SAMPLE_KEY_1: SAMPLE_VALUE_1
SAMPLE_KEY_2: 1
deployment:
image: louislam/uptime-kuma:1
port: 3001
spec:
replicas: 1
# imgae is referenced by https://hub.docker.com/r/louislam/uptime-kuma
request:
cpu: ~
memory: ~
readinessProbe:
initialDelaySeconds: ~
periodSeconds: ~
livenessProbe:
path: /
initialDelaySeconds: ~
periodSeconds: ~
startupProbe:
path: /
initialDelaySeconds: ~
periodSeconds: ~
service:
metadata:
labels: ~
annotations: ~
spec:
type: NodePort
sessionAffinity: ~
selectors: ~
externalTrafficPolicy: ~
externalIPs: ~
# <vpc-id>, <lb-name>, <arn-id>
ingress:
host: example.com
ingressClassName: alb
metadata:
labels: ~
annotations:
alb.ingress.kubernetes.io/vpc-id: <vpc-id>
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'
alb.ingress.kubernetes.io/load-balancer-name: <lb-name>
alb.ingress.kubernetes.io/tags: Name=<lb-name>
alb.ingress.kubernetes.io/certificate-arn: <arn-id>
alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-2016-08
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
alb.ingress.kubernetes.io/success-codes: '200'
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
alb.ingress.kubernetes.io/backend-protocol: HTTP
alb.ingress.kubernetes.io/target-type: instance
alb.ingress.kubernetes.io/ip-address-type: ipv4
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/actions.ssl-redirect: |
{
"Type": "redirect",
"RedirectConfig": {
"Protocol": "HTTPS",
"Port": "443",
"StatusCode": "HTTP_301"
}}
}
alb.ingress.kubernetes.io/actions.default: |
{
"type": "forward",
"forwardConfig": {
"targetGroups": [
{
"serviceName": "<lb-name>",
"servicePort": 80,
"weight": 100
}
],
"targetGroupStickinessConfig": {
"enabled": false
}
}
}
alb.ingress.kubernetes.io/actions.<lb-name>: |
{
"type": "forward",
"forwardConfig": {
"targetGroups": [
{
"serviceName": "<lb-name>",
"servicePort": 80,
"weight": 100
}
],
"targetGroupStickinessConfig": {
"enabled": false
}
}
}
spec:
selector: ~
persistVolume:
size: 1Gi
volumemode: FileSystem
accessmode: ReadWriteMany
persistentvolumereclaimpolicy: Retain
storageClass: efs-sc
csi:
driver: efs.csi.aws.com
handle: ~

View file

@ -0,0 +1,131 @@
nameOverride:
namespaceOverride:
isEnableIngress: false
isEnableService: false
isEnablePersistVolume: false
deployment:
image: louislam/uptime-kuma:1
port: 3001
spec:
replicas: 1
# imgae is referenced by https://hub.docker.com/r/louislam/uptime-kuma
request:
cpu: ~
memory: ~
readinessProbe:
initialDelaySeconds: ~
periodSeconds: ~
livenessProbe:
path: /
initialDelaySeconds: ~
periodSeconds: ~
startupProbe:
path: /
initialDelaySeconds: ~
periodSeconds: ~
service:
metadata:
labels: ~
annotations: ~
spec:
type: NodePort
sessionAffinity: ~
selectors: ~
externalTrafficPolicy: ~
externalIPs: ~
# <vpc-id>, <lb-name>, <arn-id>
ingress:
host: example.com
ingressClassName: alb
metadata:
labels: ~
annotations:
alb.ingress.kubernetes.io/vpc-id: <vpc-id>
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]'
alb.ingress.kubernetes.io/load-balancer-name: <lb-name>
alb.ingress.kubernetes.io/tags: Name=<lb-name>
alb.ingress.kubernetes.io/certificate-arn: <arn-id>
alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-2016-08
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
alb.ingress.kubernetes.io/healthcheck-port: traffic-port
alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
alb.ingress.kubernetes.io/success-codes: '200'
alb.ingress.kubernetes.io/healthy-threshold-count: '2'
alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'
alb.ingress.kubernetes.io/backend-protocol: HTTP
alb.ingress.kubernetes.io/target-type: instance
alb.ingress.kubernetes.io/ip-address-type: ipv4
alb.ingress.kubernetes.io/ssl-redirect: '443'
alb.ingress.kubernetes.io/actions.ssl-redirect: |
{
"Type": "redirect",
"RedirectConfig": {
"Protocol": "HTTPS",
"Port": "443",
"StatusCode": "HTTP_301"
}}
}
alb.ingress.kubernetes.io/actions.default: |
{
"type": "forward",
"forwardConfig": {
"targetGroups": [
{
"serviceName": "<lb-name>",
"servicePort": 80,
"weight": 100
}
],
"targetGroupStickinessConfig": {
"enabled": false
}
}
}
alb.ingress.kubernetes.io/actions.<lb-name>: |
{
"type": "forward",
"forwardConfig": {
"targetGroups": [
{
"serviceName": "<lb-name>",
"servicePort": 80,
"weight": 100
}
],
"targetGroupStickinessConfig": {
"enabled": false
}
}
}
spec:
selector: ~
persistVolume:
size: 1Gi
volumemode: FileSystem
accessmode: ReadWriteMany
persistentvolumereclaimpolicy: Retain
storageClass: efs-sc
csi:
driver: efs.csi.aws.com
handle: ~