diff --git a/README.md b/README.md index 1b4c885d0..bfa0cf40f 100644 --- a/README.md +++ b/README.md @@ -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 . diff --git a/helm/uptime-kuma/.helmignore b/helm/uptime-kuma/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/uptime-kuma/.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/helm/uptime-kuma/Chart.yaml b/helm/uptime-kuma/Chart.yaml new file mode 100644 index 000000000..44a42cbe7 --- /dev/null +++ b/helm/uptime-kuma/Chart.yaml @@ -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" diff --git a/helm/uptime-kuma/templates/_helpers.tpl b/helm/uptime-kuma/templates/_helpers.tpl new file mode 100644 index 000000000..1c0fa87e6 --- /dev/null +++ b/helm/uptime-kuma/templates/_helpers.tpl @@ -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 }} diff --git a/helm/uptime-kuma/templates/deploy.yaml b/helm/uptime-kuma/templates/deploy.yaml new file mode 100644 index 000000000..49ddab380 --- /dev/null +++ b/helm/uptime-kuma/templates/deploy.yaml @@ -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 }} diff --git a/helm/uptime-kuma/templates/ingress.yaml b/helm/uptime-kuma/templates/ingress.yaml new file mode 100644 index 000000000..9df5054e1 --- /dev/null +++ b/helm/uptime-kuma/templates/ingress.yaml @@ -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 }} \ No newline at end of file diff --git a/helm/uptime-kuma/templates/pv.yaml b/helm/uptime-kuma/templates/pv.yaml new file mode 100644 index 000000000..cefc19dee --- /dev/null +++ b/helm/uptime-kuma/templates/pv.yaml @@ -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 }} \ No newline at end of file diff --git a/helm/uptime-kuma/templates/pvc.yaml b/helm/uptime-kuma/templates/pvc.yaml new file mode 100644 index 000000000..c9f268873 --- /dev/null +++ b/helm/uptime-kuma/templates/pvc.yaml @@ -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 }} \ No newline at end of file diff --git a/helm/uptime-kuma/templates/svc.yaml b/helm/uptime-kuma/templates/svc.yaml new file mode 100644 index 000000000..c1b1919d9 --- /dev/null +++ b/helm/uptime-kuma/templates/svc.yaml @@ -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 }} \ No newline at end of file diff --git a/helm/uptime-kuma/values-test.yaml b/helm/uptime-kuma/values-test.yaml new file mode 100644 index 000000000..4b9dee1e7 --- /dev/null +++ b/helm/uptime-kuma/values-test.yaml @@ -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: ~ + +# , , +ingress: + host: example.com + ingressClassName: alb + + metadata: + labels: ~ + annotations: + alb.ingress.kubernetes.io/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: + alb.ingress.kubernetes.io/tags: Name= + + alb.ingress.kubernetes.io/certificate-arn: + 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": "", + "servicePort": 80, + "weight": 100 + } + ], + "targetGroupStickinessConfig": { + "enabled": false + } + } + } + + alb.ingress.kubernetes.io/actions.: | + { + "type": "forward", + "forwardConfig": { + "targetGroups": [ + { + "serviceName": "", + "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: ~ \ No newline at end of file diff --git a/helm/uptime-kuma/values.yaml b/helm/uptime-kuma/values.yaml new file mode 100644 index 000000000..216f188c5 --- /dev/null +++ b/helm/uptime-kuma/values.yaml @@ -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: ~ + +# , , +ingress: + host: example.com + ingressClassName: alb + + metadata: + labels: ~ + annotations: + alb.ingress.kubernetes.io/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: + alb.ingress.kubernetes.io/tags: Name= + + alb.ingress.kubernetes.io/certificate-arn: + 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": "", + "servicePort": 80, + "weight": 100 + } + ], + "targetGroupStickinessConfig": { + "enabled": false + } + } + } + + alb.ingress.kubernetes.io/actions.: | + { + "type": "forward", + "forwardConfig": { + "targetGroups": [ + { + "serviceName": "", + "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: ~ \ No newline at end of file