diff --git a/README.md b/README.md index ed01c29..6f22ed4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ -# maptiler-server-kubernetes -Helm charts for MapTiler Server +# MapTiler Server Helm Charts + +Helm charts for [MapTiler Server](https://www.maptiler.com/server/) - self-hosting OpenStreetMap world maps and maps made with MapTiler. + +MapTiler Server uses a different license: https://www.maptiler.com/terms/server-data/ +Please [Contact sales](mailto:sales@maptiler.com) in case of larger deployments. diff --git a/charts/maptiler-server/.helmignore b/charts/maptiler-server/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/maptiler-server/.helmignore @@ -0,0 +1,23 @@ +# 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/ diff --git a/charts/maptiler-server/Chart.yaml b/charts/maptiler-server/Chart.yaml new file mode 100644 index 0000000..fec465e --- /dev/null +++ b/charts/maptiler-server/Chart.yaml @@ -0,0 +1,38 @@ +apiVersion: v2 +name: maptiler-server +description: MapTiler Server - self-hosting OpenStreetMap world maps and maps made with MapTiler +home: https://www.maptiler.com/server/ +icon: https://www.gravatar.com/avatar/b53ef88ec5f7fc1e1423b620bc3c69e2?s=160 + +# 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: 1.0.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. +# It is recommended to use it with quotes. +appVersion: "4.5.0" + +sources: + - https://github.com/maptiler/maptiler-server-kubernetes + +annotations: + artifacthub.io/links: | + - name: Docker Image + url: https://hub.docker.com/r/maptiler/server + - name: Helm Chart + url: https://labs.maptiler.com/maptiler-server-kubernetes/ + artifacthub.io/changes: | + - Initial release of the Helm Chart diff --git a/charts/maptiler-server/README.md b/charts/maptiler-server/README.md new file mode 100644 index 0000000..d3878c9 --- /dev/null +++ b/charts/maptiler-server/README.md @@ -0,0 +1,107 @@ +# MapTiler Server + +[MapTiler Server](https://www.maptiler.com/server/) - self-hosting OpenStreetMap world maps and maps made with MapTiler. + +## Requirements + +- Running Kubernetes cluster with at least 1 node. +- Running [Ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/). +- (Optional) Persistent Volume type supporting [ReadWriteMany](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes) access mode to be able to share tileset data and configuration in multi-instance deployments. + +## Usage + +[Helm](https://helm.sh) must be installed to use the chart. +Please refer to Helm's [documentation](https://helm.sh/docs/) to get started. + +### Installing the Chart + +To install the chart with the release name `maptiler-server-app`: + +```console +helm repo add maptiler https://labs.maptiler.com/maptiler-server-kubernetes/ +helm install maptiler-server-app maptiler/maptiler-server +``` + +The command deploys MapTiler Server on the Kubernetes cluster in the default configuration. The section lists the parameters that can be configured during installation. + +### Uninstalling the Chart + +To uninstall the `maptiler-server-app` deployment: + +```console +helm uninstall maptiler-server-app +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +Below are the supported configuration options that can be overridden or customized in `values.yaml`: + +| Parameter | Description | Default | +|-------------------------------------------|-----------------------------------------------|---------------------------------------------------------| +| `replicaCount` | Number of pods | `1` | +| `image.repository` | Image repository | `maptiler/server` | +| `image.tag` | Overrides the image tag whose default is the chart appVersion. | `""` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `imagePullSecrets` | Image pull secrets (can be templated) | `[]` | +| `nameOverride` | Overrides the default chart name | `""` | +| `fullnameOverride` | Overrides the default chart full name | `""` | +| `podAnnotations` | Pod annotations | `{}` | +| `podLabels` | Pod labels | `{}` | +| `podSecurityContext` | Pod securityContext | `{}` | +| `securityContext` | Deployment securityContext | `{}` | +| `service.type` | Kubernetes service type | `ClusterIP` | +| `service.port` | Kubernetes port where service is exposed | `80` | +| `ingress.enabled` | Enables Ingress | `false` | +| `ingress.className` | Ingress Class Name. MAY be required for Kubernetes versions >= 1.18 | `""` | +| `ingress.annotations` | Ingress annotations (values are templated) | `{}` | +| `ingress.hosts` | Ingress hosts (can be templated) | `{ "hosts": [{ "host": "maps.company.com", "paths": [{ "path": "/", "pathType": "ImplementationSpecific"}] }] }` | +| `ingress.tls` | Ingress TLS configuration | `[]` | +| `resources` | CPU/Memory resource requests/limits | `{}` | +| `livenessProbe` | Liveness Probe settings | `{ "httpGet": { "path": "/", "port": http } }` | +| `readinessProbe` | Readiness Probe settings | `{ "httpGet": { "path": "/", "port": http } }` | +| `autoscaling.enabled` | Enables Autoscaling | `false` | +| `autoscaling.minReplicas` | Minimal number of pods | `1` | +| `autoscaling.maxReplicas` | Maximal number of pods | `100` | +| `autoscaling.targetCPUUtilizationPercentage` | Target CPU utilization percentage | `80` | +| `autoscaling.targetMemoryUtilizationPercentage` | Target Memory utilization percentage | `nil` | +| `storage.storageClassName` | Type of persistent volume claim | `manual` | +| `storage.size` | Size of persistent volume claim | `20Gi` | +| `storage.nfs` | Whether storage is NFS | `false` | +| `volumes` | Additional volumes | `[]` | +| `volumeMounts` | Additional volume mounts | `[]` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `tolerations` | Toleration labels for pod assignment | `[]` | +| `affinity` | Affinity settings for pod assignment | `{}` | +| `maptilerServer.adminPassword` | Password for MapTiler Server Admin interface | `admin123` | +| `maptilerServer.port` | MapTiler Server Port | `3650` | +| `maptilerServer.licenseKey` | MapTiler Server License Key | `""` | +| `maptilerServer.licenseServer` | MapTiler Server License Server URL | `""` | +| `maptilerServer.rasterization` | Enables map rasterization | `true` | +| `maptilerServer.withAdmin` | Enables Admin interface | `true` | +| `maptilerServer.workDir` | MapTiler Server working directory with config and tilesets | `/data` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +helm install maptiler-server-app --set image.tag=4.4.0 maptiler/maptiler-server +``` + +The above command sets the MapTiler Server image's tag to `4.4.0`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```console +helm install maptiler-server-app -f values.yaml maptiler/maptiler-server +``` + +## Examples + +You can find configuration examples in our [Documentation Portal](https://documentation.maptiler.com/hc/en-us/categories/22658073695889-Map-Server). + +## ChangeLog + +### 1.0.0 + +- Initial release of the Helm Chart diff --git a/charts/maptiler-server/templates/NOTES.txt b/charts/maptiler-server/templates/NOTES.txt new file mode 100644 index 0000000..c2ae7af --- /dev/null +++ b/charts/maptiler-server/templates/NOTES.txt @@ -0,0 +1,22 @@ +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 }}{{ .path }} + {{- 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 "maptiler-server.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 its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "maptiler-server.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "maptiler-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + 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 "maptiler-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/charts/maptiler-server/templates/_helpers.tpl b/charts/maptiler-server/templates/_helpers.tpl new file mode 100644 index 0000000..2a9e80d --- /dev/null +++ b/charts/maptiler-server/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "maptiler-server.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 "maptiler-server.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 "maptiler-server.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "maptiler-server.labels" -}} +helm.sh/chart: {{ include "maptiler-server.chart" . }} +{{ include "maptiler-server.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "maptiler-server.selectorLabels" -}} +app.kubernetes.io/name: {{ include "maptiler-server.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/charts/maptiler-server/templates/configmap.yaml b/charts/maptiler-server/templates/configmap.yaml new file mode 100644 index 0000000..850557e --- /dev/null +++ b/charts/maptiler-server/templates/configmap.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +data: + MAPTILER_SERVER_ADMIN_PASSWORD: {{ .Values.maptilerServer.adminPassword | quote }} + {{- if .Values.maptilerServer.licenseKey }} + MAPTILER_SERVER_LICENSE: {{ .Values.maptilerServer.licenseKey | quote }} + {{- end }} + {{- if .Values.maptilerServer.licenseServer }} + MAPTILER_SERVER_LICENSE_SERVER: {{ .Values.maptilerServer.licenseServer | quote }} + {{- end }} + MAPTILER_SERVER_PORT: {{ .Values.maptilerServer.port | quote }} + MAPTILER_SERVER_RASTERIZATION: {{ .Values.maptilerServer.rasterization | quote }} + MAPTILER_SERVER_WORK_DIR: {{ .Values.maptilerServer.workDir | quote }} + MAPTILER_SERVER_WITH_ADMIN: "false" +kind: ConfigMap +metadata: + name: {{ include "maptiler-server.fullname" . }} + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} diff --git a/charts/maptiler-server/templates/deployment-admin.yaml b/charts/maptiler-server/templates/deployment-admin.yaml new file mode 100644 index 0000000..7e10a9b --- /dev/null +++ b/charts/maptiler-server/templates/deployment-admin.yaml @@ -0,0 +1,82 @@ +{{- if .Values.maptilerServer.withAdmin }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "maptiler-server.fullname" . }}-admin + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "maptiler-server.selectorLabels" . | nindent 6 }} + instance: admin + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "maptiler-server.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + instance: admin + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: [ + "--adminPassword=$(MAPTILER_SERVER_ADMIN_PASSWORD)", + "--port=$(MAPTILER_SERVER_PORT)", + "--rasterization=$(MAPTILER_SERVER_RASTERIZATION)", + "--withAdmin=$(MAPTILER_SERVER_WITH_ADMIN)", + "--workDir=$(MAPTILER_SERVER_WORK_DIR)" + ] + ports: + - name: http + containerPort: {{ .Values.maptilerServer.port }} + protocol: TCP + envFrom: + - configMapRef: + name: {{ include "maptiler-server.fullname" . }} + env: + - name: MAPTILER_SERVER_WITH_ADMIN + value: "true" + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/maptiler-server/templates/deployment.yaml b/charts/maptiler-server/templates/deployment.yaml new file mode 100644 index 0000000..a5bd9ac --- /dev/null +++ b/charts/maptiler-server/templates/deployment.yaml @@ -0,0 +1,77 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "maptiler-server.fullname" . }} + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ if .Values.maptilerServer.withAdmin }} {{ sub .Values.replicaCount 1 }} {{ else }} {{ .Values.replicaCount }} {{ end }} + {{- end }} + selector: + matchLabels: + {{- include "maptiler-server.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "maptiler-server.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: [ + "--adminPassword=$(MAPTILER_SERVER_ADMIN_PASSWORD)", + "--port=$(MAPTILER_SERVER_PORT)", + "--rasterization=$(MAPTILER_SERVER_RASTERIZATION)", + "--withAdmin=$(MAPTILER_SERVER_WITH_ADMIN)", + "--workDir=$(MAPTILER_SERVER_WORK_DIR)" + ] + ports: + - name: http + containerPort: {{ .Values.maptilerServer.port }} + protocol: TCP + envFrom: + - configMapRef: + name: {{ include "maptiler-server.fullname" . }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/maptiler-server/templates/hpa.yaml b/charts/maptiler-server/templates/hpa.yaml new file mode 100644 index 0000000..eddb4e9 --- /dev/null +++ b/charts/maptiler-server/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "maptiler-server.fullname" . }} + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "maptiler-server.fullname" . }} + minReplicas: {{ if .Values.maptilerServer.withAdmin }} {{ sub .Values.autoscaling.minReplicas 1 }} {{ else }} {{ .Values.autoscaling.minReplicas }} {{ end }} + maxReplicas: {{ if .Values.maptilerServer.withAdmin }} {{ sub .Values.autoscaling.maxReplicas 1 }} {{ else }} {{ .Values.autoscaling.maxReplicas }} {{ end }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/maptiler-server/templates/ingress.yaml b/charts/maptiler-server/templates/ingress.yaml new file mode 100644 index 0000000..c39f2ff --- /dev/null +++ b/charts/maptiler-server/templates/ingress.yaml @@ -0,0 +1,82 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "maptiler-server.fullname" . -}} +{{- $fullAdminName := printf "%s-admin" $fullName -}} +{{- $svcPort := .Values.service.port -}} +{{- $adminPaths := list "/admin" "/api/admin" "/api/v1/admin" "/_next" }} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- 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: + {{- if $.Values.maptilerServer.withAdmin }} + {{- range $path := $adminPaths }} + - path: {{ $path }} + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: Prefix + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullAdminName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullAdminName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} + + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/maptiler-server/templates/pvc.yaml b/charts/maptiler-server/templates/pvc.yaml new file mode 100644 index 0000000..d44f685 --- /dev/null +++ b/charts/maptiler-server/templates/pvc.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "maptiler-server.fullname" . }} + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} +spec: + storageClassName: {{ .Values.storage.storageClassName | quote }} + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.storage.size }} + {{- if .Values.storage.nfs }} + selector: + matchLabels: + app.kubernetes.io/storage-type: nfs + {{- end }} diff --git a/charts/maptiler-server/templates/service-admin.yaml b/charts/maptiler-server/templates/service-admin.yaml new file mode 100644 index 0000000..b68dd4e --- /dev/null +++ b/charts/maptiler-server/templates/service-admin.yaml @@ -0,0 +1,18 @@ +{{- if .Values.maptilerServer.withAdmin }} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "maptiler-server.fullname" . }}-admin + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "maptiler-server.selectorLabels" . | nindent 4 }} + instance: admin +{{- end }} diff --git a/charts/maptiler-server/templates/service.yaml b/charts/maptiler-server/templates/service.yaml new file mode 100644 index 0000000..c50475d --- /dev/null +++ b/charts/maptiler-server/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "maptiler-server.fullname" . }} + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "maptiler-server.selectorLabels" . | nindent 4 }} diff --git a/charts/maptiler-server/templates/tests/test-connection.yaml b/charts/maptiler-server/templates/tests/test-connection.yaml new file mode 100644 index 0000000..80b6a32 --- /dev/null +++ b/charts/maptiler-server/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "maptiler-server.fullname" . }}-test-connection" + labels: + {{- include "maptiler-server.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "maptiler-server.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/maptiler-server/values.yaml b/charts/maptiler-server/values.yaml new file mode 100644 index 0000000..9a0d9a5 --- /dev/null +++ b/charts/maptiler-server/values.yaml @@ -0,0 +1,111 @@ +# Default values for maptiler-server. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: maptiler/server + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: maps.company.com + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +livenessProbe: + httpGet: + path: / + port: http +readinessProbe: + httpGet: + path: / + port: http + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +storage: + storageClassName: manual + size: 20Gi + nfs: false + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +# MapTiler Server specific settings - https://documentation.maptiler.com/hc/en-us/articles/10607404114961-MapTiler-Server-CLI-command-line-interface +maptilerServer: + adminPassword: admin123 + port: 3650 + licenseKey: "" + licenseServer: "" + rasterization: true + withAdmin: true + workDir: /data