commit de4d37463538eddafedb359bb4240ba4a2583ec9 Author: Mikaƫl Cluseau Date: Wed Oct 4 19:18:03 2023 +0200 first commit diff --git a/Chart.yaml b/Chart.yaml new file mode 100644 index 0000000..f5e3718 --- /dev/null +++ b/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: mini-app +type: application +version: "1.0.0" +appVersion: "1.0.0" diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000..8b1ee58 --- /dev/null +++ b/templates/_helpers.tpl @@ -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 }} diff --git a/templates/app.yaml b/templates/app.yaml new file mode 100644 index 0000000..340ac8c --- /dev/null +++ b/templates/app.yaml @@ -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 + diff --git a/templates/etcd.yaml b/templates/etcd.yaml new file mode 100644 index 0000000..78a9928 --- /dev/null +++ b/templates/etcd.yaml @@ -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 }} + diff --git a/templates/ingress.yaml b/templates/ingress.yaml new file mode 100644 index 0000000..4b85c40 --- /dev/null +++ b/templates/ingress.yaml @@ -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 + diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000..ca93232 --- /dev/null +++ b/values.yaml @@ -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 +