Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding k8s support with helm #525

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ light
plugins
config.json
*.mbtiles

#visual studio IDE
**/.vs/
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
25 changes: 25 additions & 0 deletions charts/tileserver-gl/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
23 changes: 23 additions & 0 deletions charts/tileserver-gl/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions charts/tileserver-gl/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 -}}
52 changes: 52 additions & 0 deletions charts/tileserver-gl/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

18 changes: 18 additions & 0 deletions charts/tileserver-gl/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
14 changes: 14 additions & 0 deletions charts/tileserver-gl/templates/pv.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 11 additions & 0 deletions charts/tileserver-gl/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 19 additions & 0 deletions charts/tileserver-gl/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
44 changes: 44 additions & 0 deletions charts/tileserver-gl/values.yaml
Original file line number Diff line number Diff line change
@@ -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