add helm charts

This commit is contained in:
Ybehrooz
2025-11-09 13:22:40 +03:30
parent 282c3e52d0
commit 38e4d749ad
1352 changed files with 190457 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "osrm.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "osrm.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "osrm.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "osrm.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}

View File

@@ -0,0 +1,45 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "osrm.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 "osrm.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 "osrm.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "osrm.labels" -}}
app.kubernetes.io/name: {{ include "osrm.name" . }}
helm.sh/chart: {{ include "osrm.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

View File

@@ -0,0 +1,21 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "osrm.fullname" . }}-files
labels: {{ include "osrm.labels" . | nindent 4 }}
data:
{{- range $key, $filepath := .Values.configTemplatedFiles }}
{{ $key }}: |- {{ ( tpl ($.Files.Get $filepath) $ ) | nindent 4 }}
{{- end }}
{{- if and .Values.map.enabled ( eq "http" .Values.map.source ) }}
{{- range $key, $filepath := .Values.map.http.configTemplatedFiles }}
{{ $key }}: |- {{ ( tpl ($.Files.Get $filepath) $ ) | nindent 4 }}
{{- end }}
{{- end }}
{{- if and .Values.map.enabled ( eq "gcs" .Values.map.source ) }}
{{- range $key, $filepath := .Values.map.gcs.configTemplatedFiles }}
{{ $key }}: |- {{ ( tpl ($.Files.Get $filepath) $ ) | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,43 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "osrm.fullname" . -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "osrm.labels" . | nindent 4 }}
{{- with .Values.ingress.extraLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName }}
port:
name: http
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "osrm.fullname" . }}-headless
labels:
{{ include "osrm.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
clusterIP: None
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "osrm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "osrm.fullname" . }}
labels:
{{ include "osrm.labels" . | indent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "osrm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,115 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "osrm.fullname" . }}
labels:
{{ include "osrm.labels" . | indent 4 }}
spec:
serviceName: {{ include "osrm.fullname" . }}-headless
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "osrm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "osrm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
{{- with .Values.initContainersTpl }}
{{- ( tpl . $ ) | nindent 8 }}
{{- end }}
{{- with .Values.initContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and .Values.map.enabled ( eq "http" .Values.map.source ) }}
{{- ( tpl .Values.map.http.initContainersTpl $ ) | nindent 8 }}
{{- end }}
{{- if and .Values.map.enabled ( eq "gcs" .Values.map.source ) }}
{{- ( tpl .Values.map.gcs.initContainersTpl $ ) | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- osrm-routed
- --algorithm
- mld
{{- if and .Values.map.enabled ( eq "http" .Values.map.source ) }}
- /data/maps/{{ .Values.map.http.version | default "unversioned" }}/map.osrm
{{- end }}
{{- if and .Values.map.enabled ( eq "gcs" .Values.map.source ) }}
- /data/maps/{{ .Values.map.gcs.version | default "unversioned" }}/map.osrm
{{- end }}
{{- if .Values.extraArgs }}
{{- toYaml .Values.extraArgs | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 5000
protocol: TCP
{{- with .Values.livenessProbe }}
livenessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe: {{ toYaml . | nindent 12 }}
{{- end }}
resources: {{ toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: maps
mountPath: /data/maps
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config-files
configMap:
name: {{ include "osrm.fullname" . }}-files
defaultMode: 0755
{{- if not .Values.persistence.enabled }}
- name: maps
emptyDir: {}
{{- end }}
{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.extraVolumesTpl }}
{{- ( tpl . $ ) | nindent 8 }}
{{- end }}
{{- if and .Values.map.enabled ( eq "gcs" .Values.map.source ) }}
{{- ( tpl .Values.map.gcs.extraVolumesTpl $ ) | nindent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: maps
spec:
accessModes:
{{- toYaml .Values.persistence.accessModes | nindent 10 }}
{{- if .Values.persistence.storageClassName }}
{{- if (eq "-" .Values.persistence.storageClassName) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClassName }}
{{- end }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "osrm.fullname" . }}-test-connection"
labels:
{{ include "osrm.labels" . | indent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "osrm.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never