Skip to content

Commit

Permalink
geoserver (#5)
Browse files Browse the repository at this point in the history
* geoserver helm chart

---------

Co-authored-by: YONG WOOK KIM <[email protected]>
  • Loading branch information
robkooper and ywkim312 authored Oct 20, 2023
1 parent 33be766 commit cedeab0
Show file tree
Hide file tree
Showing 14 changed files with 554 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/geoserver/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
38 changes: 38 additions & 0 deletions charts/geoserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: v2
type: application

# Information about geoserver.
name: geoserver
icon: https://raw.githubusercontent.com/geoserver/geoserver/master/doc/en/themes/geoserver/static/geoserver.ico
home: http://geoserver.org/
description: An open source server for sharing geospatial data.

# 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: 2.23.1

# List of people that maintain this helm chart.
maintainers:
- name: Rob Kooper
email: [email protected]
- name: Yong Wook Kim
email: [email protected]

# location of source code
sources:
- https://github.com/geoserver/geoserver

annotations:
artifacthub.io/links: |
- name: Docker Image
url: https://docker.osgeo.org/geoserver
- name: Helm Chart
url: https://github.com/ncsa/charts
artifacthub.io/changes: |
- Initial release of helm chart
96 changes: 96 additions & 0 deletions charts/geoserver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# geoserver
A simple Helm chart for GeoServer


## TL;DR;

```bash
$ helm repo add ncsa https://opensource.ncsa.illinois.edu/charts/
$ helm install geoserver ncsa/geoserver
```

## Prerequisites

- Kubernetes 1.16+
- helm 3
- PV provisioner support in the underlying infrastructure

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm install --name my-release ncsa/geoserver
```

The command deploys GeoServer on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`
## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```bash
$ helm delete my-release
```

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`:

| Key | Description | Default Value |
| --- | --- |-------------------------------|
| `persistence.accessModes` | The access mode with which to mount elasticsearch data | `ReadWriteOnce` |
| `persistence.storageClass` | The storage class to use to provision the elasticsearch data PVC | (empty - use cluster default) |
| `persistence.capacity` | The size of the PVC to provision for elasticsearch data | `10Gi` |
| `persistence.existingClaim` | An existing claim to use | None |
| `image.repository` | The Docker image repo/name to run | `docker.osgeo.org/geoserver` |
| `image.tag` | The Docker image tag to run, leave blank to use app version | `""` |
| `image.pullPolicy` | The Docker image pullPolicy to use when running | `IfNotPresent` |
| `ingress.enabled` | Whether an ingress rule should be deployed for geoserver | `false` |
| `ingress.host` | The hostname to use for the ingress rule | `geoserver.local` |
| `resources` | [Resource limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) that should be applied to elasticsearch instances | None |
| `nodeSelector` | [Node selector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) that should be applied to elasticsearch instances | None |
| `tolerations` | [Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) that should be applied to elasticsearch instances | None |
| `affinity` | [Affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) that should be applied to elasticsearch instances | None |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```bash
$ helm install --name my-release \
--set image.tag=2.23.1 \
ncsa/geoserver
```

The above command sets the geoserver image's tag to `2.23.1`.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```bash
$ helm install --name my-release -f values.yaml ncsa/geoserver
```

> **Tip**: You can use the default [values.yaml](values.yaml)
## Persistence

Geoserver can use a disk storage.

### Existing PersistentVolumeClaims

1. Create the PersistentVolume
1. Create the PersistentVolumeClaim
1. Install the chart

```bash
$ helm install --set persistence.existingClaim=PVC_NAME geoserver
```

## ChangeLog

### 0.1.0

- Initial release of helm chart
10 changes: 10 additions & 0 deletions charts/geoserver/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{- if not .Values.auth.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "geoserver.fullname" . }}
labels:
{{- include "geoserver.labels" . | nindent 4 }}
data:
geoserver_admin_password: {{ .Values.auth.password | b64enc | quote }}
{{- endif }}
22 changes: 22 additions & 0 deletions charts/geoserver/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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 "geoserver.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 "geoserver.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "geoserver.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 "geoserver.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 }}
62 changes: 62 additions & 0 deletions charts/geoserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "geoserver.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 "geoserver.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 "geoserver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "geoserver.labels" -}}
helm.sh/chart: {{ include "geoserver.chart" . }}
{{ include "geoserver.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "geoserver.selectorLabels" -}}
app.kubernetes.io/name: {{ include "geoserver.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "geoserver.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "geoserver.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
101 changes: 101 additions & 0 deletions charts/geoserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "geoserver.fullname" . }}
labels:
{{- include "geoserver.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
{{- include "geoserver.selectorLabels" . | nindent 6 }}
strategy:
type: RollingUpdate
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "geoserver.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "geoserver.serviceAccountName" . }}
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 }}
env:
- name: INSTALL_EXTENSIONS
value: {{ .Values.extension.install | quote }}
- name: STABLE_EXTENSIONS
value: {{ .Values.extension.stableExtension | quote }}
- name: CORS_ENABLED
value: {{ .Values.cors.enabled | quote }}
- name: SKIP_DEMO_DATA
values: {{ .Values.demoData.skip | quote }}
- name: GEOSERVER_CSRF_WHITELIST
values: {{ .Values.geoserver.whitelist | quote }}
- name: GEOSERVER_ADMIN_USER
value: admin
- name: GEOSERVER_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.auth.existingSecret }}
name: {{ .Values.auth.existingSecret }}
key: {{ .Values.auth.passwordKey | default "geoserver_admin_password" }}
{{- else }}
name: {{ include "geoserver.fullname" . }}
key: geoserver_admin_password
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
volumeMounts:
- name: {{ include "geoserver.fullname" . }}
mountPath: /opt/geoserver_data
startupProbe:
httpGet:
path: /geoserver/web
port: http
failureThreshold: {{ .Values.startup.failureThreshold }}
periodSeconds: {{ .Values.startup.periodSeconds }}
livenessProbe:
httpGet:
path: /geoserver/web
port: http
readinessProbe:
httpGet:
path: /geoserver/web
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: {{ include "geoserver.fullname" . }}
persistentVolumeClaim:
{{- if .Values.persistence.existingClaim }}
claimName: {{ .Values.persistence.existingClaim }}
{{- else }}
claimName: {{ include "geoserver.fullname" . }}
{{- 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 }}
38 changes: 38 additions & 0 deletions charts/geoserver/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "geoserver.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "geoserver.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- 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:
- path: /geoserver/
pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}
Loading

0 comments on commit cedeab0

Please sign in to comment.