first commit

Mikaël Cluseau 2023-10-04 19:18:03 +02:00
commit de4d374635
6 changed files with 196 additions and 0 deletions

5
Chart.yaml Normal file
View File

@ -0,0 +1,5 @@
apiVersion: v2
name: mini-app
type: application
version: "1.0.0"
appVersion: "1.0.0"

62
templates/_helpers.tpl Normal file
View File

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "gitea.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 "gitea.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 "gitea.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "gitea.labels" -}}
helm.sh/chart: {{ include "gitea.chart" . }}
{{ include "gitea.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "gitea.selectorLabels" -}}
app.kubernetes.io/name: {{ include "gitea.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "gitea.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "gitea.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

34
templates/app.yaml Normal file
View File

@ -0,0 +1,34 @@
---
apiVersion: v1
kind: Service
metadata:
name: app
spec:
selector:
app: app
ports:
- port: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: app
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
containers:
- name: app
command: [ "app" ]
image: "{{ .Values.app.repo }}:{{ .Values.app.tag }}"
imagePullPolicy: Always # while debugging
#imagePullPolicy: IfNotPresent

53
templates/etcd.yaml Normal file
View File

@ -0,0 +1,53 @@
---
apiVersion: v1
kind: Service
metadata:
name: etcd
spec:
selector:
app: etcd
ports:
- port: 2379
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: etcd
spec:
replicas: 1
selector:
matchLabels:
app: etcd
template:
metadata:
labels:
app: etcd
spec:
containers:
- name: etcd
image: quay.io/coreos/etcd:{{ .Values.etcd.tag }}
imagePullPolicy: IfNotPresent
command:
- etcd
- --initial-cluster-state=new
- --data-dir=/data
- --listen-client-urls=http://[::]:2379
volumeMounts:
- mountPath: /data
name: data
subPath: etcd
volumeClaimTemplates:
- metadata:
name: data
spec:
{{- with .Values.etcd.storage.class }}
storageClassName: {{ . |quote }}
{{- end }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.etcd.storage.request }}

28
templates/ingress.yaml Normal file
View File

@ -0,0 +1,28 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mini-app
labels:
{{- include "gitea.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
tls:
- hosts:
- {{ .Values.ingress.host | quote }}
secretName: app-crt
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app
port:
number: 80

14
values.yaml Normal file
View File

@ -0,0 +1,14 @@
ingress:
host: app.demos.novit.tech
app:
repo: gitea.demos.novit.tech/demo/app
tag: v0.0.1
etcd:
tag: v3.5.9
storage:
class: local
request: 1Gi