update(app): add helm chart and cleanup repo
Some checks failed
CI Pipeline / Build and Push Docker Image (push) Failing after 2m48s

This commit is contained in:
Aleksandr Tcitlionok
2024-12-11 09:05:15 +00:00
parent c12ce697c0
commit acef6cb9a1
19 changed files with 274 additions and 777 deletions

6
helm/Chart.yaml Normal file
View File

@@ -0,0 +1,6 @@
apiVersion: v2
name: metalcheck-backend
description: A Helm chart for deploying the MetalCheck backend application.
type: application
version: 0.1.0
appVersion: "latest"

View File

@@ -0,0 +1,7 @@
{{/*
Expand common labels.
*/}}
{{- define "metalcheck-backend.labels" -}}
app: {{ .Chart.Name }}
release: {{ .Release.Name }}
{{- end }}

View File

@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
labels:
app: {{ .Chart.Name }}
data:
HETZNER_TOKEN: {{ .Values.env.HETZNER_TOKEN | quote }}

View File

@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-backend
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
release: {{ .Release.Name }}
spec:
containers:
- name: backend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 80
env:
- name: HETZNER_TOKEN
value: "{{ .Values.env.HETZNER_TOKEN }}"
resources:
{{- toYaml .Values.resources | nindent 12 }}

View File

@@ -0,0 +1,26 @@
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-ingress
annotations:
{{ toYaml .Values.ingress.annotations | indent 4 }}
spec:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: {{ $.Release.Name }}-service
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end }}

49
helm/templates/rbac.yaml Normal file
View File

@@ -0,0 +1,49 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Release.Name }}-sa
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-clusterrole
rules:
- apiGroups: [""]
resources: ["pods", "nodes", "namespaces"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-clusterrolebinding
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-sa
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}-clusterrole
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-metrics-reader
rules:
- apiGroups: ["metrics.k8s.io"]
resources: ["pods"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-metrics-reader-binding
subjects:
- kind: ServiceAccount
name: {{ .Release.Name }}-sa
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}-metrics-reader
apiGroup: rbac.authorization.k8s.io

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-service
labels:
app: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 80
selector:
app: {{ .Chart.Name }}
release: {{ .Release.Name }}

35
helm/values.yaml Normal file
View File

@@ -0,0 +1,35 @@
replicaCount: 2
image:
repository: ghcr.io/terghalin/metalcheck-backend
tag: latest
pullPolicy: IfNotPresent
service:
type: LoadBalancer
port: 80
ingress:
enabled: false
annotations: {}
hosts:
- host: metalcheck.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "250m"
memory: "256Mi"
env:
HETZNER_TOKEN: ""
nodeSelector: {}
tolerations: []
affinity: {}