adding k8s support with helm

This commit is contained in:
Edson Raigosa 2021-03-10 11:34:13 -05:00
parent c89a5ae029
commit 9797037660
11 changed files with 249 additions and 0 deletions

3
.gitignore vendored
View File

@ -6,3 +6,6 @@ light
plugins
config.json
*.mbtiles
#visual studio IDE
**/.vs/

View File

@ -43,6 +43,14 @@ This will download and start a ready to use container on your computer and the m
On laptop you can use [Docker Kitematic](https://kitematic.com/) and search "tileserver-gl" and run it, then drop in the 'data' folder the MBTiles.
## Using Kubernetes/helm
```bash
helm install tileserver-gl .\tileserver-gl\ -n default
```
you can now access the service (kubectl get svc) via port-forward or you can change the service type configuration to LoadBalancer or even activate the ingres/traefik routing.
## Documentation
You can read full documentation of this project at https://tileserver.readthedocs.io/.

View File

@ -0,0 +1,25 @@
# 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/
*/bin/
*/obj/

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: dev
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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.
appVersion: 1.16.0

View File

@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "dev.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 "dev.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 "dev.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@ -0,0 +1,52 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "dev.fullname" . }}
labels:
app: {{ template "dev.name" . }}
chart: {{ template "dev.chart" . }}
draft: {{ .Values.draft | default "draft-app" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "dev.name" . }}
release: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "dev.name" . }}
draft: {{ .Values.draft | default "draft-app" }}
release: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
#command: ["sh", "-c", "tail -f /dev/null"]
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: {{ .Values.volume.name }}
mountPath: {{ .Values.volume.mountPath }}
ports:
- name: http
containerPort: {{ .Values.deployment.containerPort }}
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
runAsUser: 0
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
volumes:
- name: {{ .Values.volume.name }}
persistentVolumeClaim:
claimName: {{ .Values.volume.persistentVolumeClaim.claimName }}

View File

@ -0,0 +1,18 @@
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
name: openmaptileserver
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
spec:
entryPoints:
- websecure
- web
routes:
- match: Host(`{{ .Values.ingress.dnsname }}`)
kind: Rule
services:
- name: {{ .Values.service.name }}
port: {{ .Values.service.port }}

View File

@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Values.volume.name }}
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: {{ .Values.volume.storage }}
accessModes:
- ReadWriteOnce
hostPath:
path: {{ .Values.volume.mountPath }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.volume.persistentVolumeClaim.claimName }}
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.volume.storage }}

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "dev.fullname" . }}
labels:
app: {{ template "dev.name" . }}
chart: {{ template "dev.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "dev.name" . }}
release: {{ .Release.Name }}

View File

@ -0,0 +1,44 @@
# Default values for OpenMapTiles.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: 245136312710.dkr.ecr.ca-central-1.amazonaws.com/tileserverglolameter
tag: latest
pullPolicy: Always
imagePullSecrets: []
ingress:
enabled: false
dnsname: openmaptilese.some-dns.com
annotations: {}
# kubernetes.io/tls-acme: "true"
path: /
# hosts:
# - chart-example.local
tls: {}
service:
type: ClusterIP
port: 8081
name: openmaptile-svc
volume:
name: openmaptiles-dataset
persistentVolumeClaim:
claimName: openmaptilesefs-claim
persistentVolume:
pvName: openmaptiles-pv
#This mountPath is related to the config file configuration
mountPath: /data
storage: 20Gi
storageClass:
name: openmaptilesefs
#This port is related to the activated dockerfile port
deployment:
containerPort: 8080