Skip to content

Commit cedeab0

Browse files
robkooperywkim312
andauthored
geoserver (#5)
* geoserver helm chart --------- Co-authored-by: YONG WOOK KIM <ywkim312@users.noreply.github.com>
1 parent 33be766 commit cedeab0

14 files changed

+554
-0
lines changed

charts/geoserver/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/geoserver/Chart.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: v2
2+
type: application
3+
4+
# Information about geoserver.
5+
name: geoserver
6+
icon: https://raw.githubusercontent.com/geoserver/geoserver/master/doc/en/themes/geoserver/static/geoserver.ico
7+
home: http://geoserver.org/
8+
description: An open source server for sharing geospatial data.
9+
10+
# This is the chart version. This version number should be incremented each time you make changes
11+
# to the chart and its templates, including the app version.
12+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
13+
version: 0.1.0
14+
15+
# This is the version number of the application being deployed. This version number should be
16+
# incremented each time you make changes to the application. Versions are not expected to
17+
# follow Semantic Versioning. They should reflect the version the application is using.
18+
appVersion: 2.23.1
19+
20+
# List of people that maintain this helm chart.
21+
maintainers:
22+
- name: Rob Kooper
23+
email: kooper@illinois.edu
24+
- name: Yong Wook Kim
25+
email: ywkim@illinois.edu
26+
27+
# location of source code
28+
sources:
29+
- https://github.com/geoserver/geoserver
30+
31+
annotations:
32+
artifacthub.io/links: |
33+
- name: Docker Image
34+
url: https://docker.osgeo.org/geoserver
35+
- name: Helm Chart
36+
url: https://github.com/ncsa/charts
37+
artifacthub.io/changes: |
38+
- Initial release of helm chart

charts/geoserver/README.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# geoserver
2+
A simple Helm chart for GeoServer
3+
4+
5+
## TL;DR;
6+
7+
```bash
8+
$ helm repo add ncsa https://opensource.ncsa.illinois.edu/charts/
9+
$ helm install geoserver ncsa/geoserver
10+
```
11+
12+
## Prerequisites
13+
14+
- Kubernetes 1.16+
15+
- helm 3
16+
- PV provisioner support in the underlying infrastructure
17+
18+
## Installing the Chart
19+
20+
To install the chart with the release name `my-release`:
21+
22+
```bash
23+
$ helm install --name my-release ncsa/geoserver
24+
```
25+
26+
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.
27+
28+
> **Tip**: List all releases using `helm list`
29+
30+
## Uninstalling the Chart
31+
32+
To uninstall/delete the `my-release` deployment:
33+
34+
```bash
35+
$ helm delete my-release
36+
```
37+
38+
The command removes all the Kubernetes components associated with the chart and deletes the release.
39+
40+
## Configuration
41+
42+
Below are the supported configuration options that can be overridden or customized in `values.yaml`:
43+
44+
| Key | Description | Default Value |
45+
| --- | --- |-------------------------------|
46+
| `persistence.accessModes` | The access mode with which to mount elasticsearch data | `ReadWriteOnce` |
47+
| `persistence.storageClass` | The storage class to use to provision the elasticsearch data PVC | (empty - use cluster default) |
48+
| `persistence.capacity` | The size of the PVC to provision for elasticsearch data | `10Gi` |
49+
| `persistence.existingClaim` | An existing claim to use | None |
50+
| `image.repository` | The Docker image repo/name to run | `docker.osgeo.org/geoserver` |
51+
| `image.tag` | The Docker image tag to run, leave blank to use app version | `""` |
52+
| `image.pullPolicy` | The Docker image pullPolicy to use when running | `IfNotPresent` |
53+
| `ingress.enabled` | Whether an ingress rule should be deployed for geoserver | `false` |
54+
| `ingress.host` | The hostname to use for the ingress rule | `geoserver.local` |
55+
| `resources` | [Resource limits](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) that should be applied to elasticsearch instances | None |
56+
| `nodeSelector` | [Node selector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) that should be applied to elasticsearch instances | None |
57+
| `tolerations` | [Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) that should be applied to elasticsearch instances | None |
58+
| `affinity` | [Affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity) that should be applied to elasticsearch instances | None |
59+
60+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
61+
62+
```bash
63+
$ helm install --name my-release \
64+
--set image.tag=2.23.1 \
65+
ncsa/geoserver
66+
```
67+
68+
The above command sets the geoserver image's tag to `2.23.1`.
69+
70+
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
71+
72+
```bash
73+
$ helm install --name my-release -f values.yaml ncsa/geoserver
74+
```
75+
76+
> **Tip**: You can use the default [values.yaml](values.yaml)
77+
78+
## Persistence
79+
80+
Geoserver can use a disk storage.
81+
82+
### Existing PersistentVolumeClaims
83+
84+
1. Create the PersistentVolume
85+
1. Create the PersistentVolumeClaim
86+
1. Install the chart
87+
88+
```bash
89+
$ helm install --set persistence.existingClaim=PVC_NAME geoserver
90+
```
91+
92+
## ChangeLog
93+
94+
### 0.1.0
95+
96+
- Initial release of helm chart

charts/geoserver/secrets.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if not .Values.auth.existingSecret }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "geoserver.fullname" . }}
6+
labels:
7+
{{- include "geoserver.labels" . | nindent 4 }}
8+
data:
9+
geoserver_admin_password: {{ .Values.auth.password | b64enc | quote }}
10+
{{- endif }}

charts/geoserver/templates/NOTES.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "geoserver.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "geoserver.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "geoserver.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
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}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "geoserver.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "geoserver.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "geoserver.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "geoserver.labels" -}}
37+
helm.sh/chart: {{ include "geoserver.chart" . }}
38+
{{ include "geoserver.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "geoserver.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "geoserver.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "geoserver.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "geoserver.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "geoserver.fullname" . }}
5+
labels:
6+
{{- include "geoserver.labels" . | nindent 4 }}
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
{{- include "geoserver.selectorLabels" . | nindent 6 }}
12+
strategy:
13+
type: RollingUpdate
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "geoserver.selectorLabels" . | nindent 8 }}
22+
spec:
23+
{{- with .Values.imagePullSecrets }}
24+
imagePullSecrets:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
serviceAccountName: {{ include "geoserver.serviceAccountName" . }}
28+
securityContext:
29+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
30+
containers:
31+
- name: {{ .Chart.Name }}
32+
securityContext:
33+
{{- toYaml .Values.securityContext | nindent 12 }}
34+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
35+
imagePullPolicy: {{ .Values.image.pullPolicy }}
36+
env:
37+
- name: INSTALL_EXTENSIONS
38+
value: {{ .Values.extension.install | quote }}
39+
- name: STABLE_EXTENSIONS
40+
value: {{ .Values.extension.stableExtension | quote }}
41+
- name: CORS_ENABLED
42+
value: {{ .Values.cors.enabled | quote }}
43+
- name: SKIP_DEMO_DATA
44+
values: {{ .Values.demoData.skip | quote }}
45+
- name: GEOSERVER_CSRF_WHITELIST
46+
values: {{ .Values.geoserver.whitelist | quote }}
47+
- name: GEOSERVER_ADMIN_USER
48+
value: admin
49+
- name: GEOSERVER_ADMIN_PASSWORD
50+
valueFrom:
51+
secretKeyRef:
52+
{{- if .Values.auth.existingSecret }}
53+
name: {{ .Values.auth.existingSecret }}
54+
key: {{ .Values.auth.passwordKey | default "geoserver_admin_password" }}
55+
{{- else }}
56+
name: {{ include "geoserver.fullname" . }}
57+
key: geoserver_admin_password
58+
{{- end }}
59+
ports:
60+
- name: http
61+
containerPort: 8080
62+
protocol: TCP
63+
volumeMounts:
64+
- name: {{ include "geoserver.fullname" . }}
65+
mountPath: /opt/geoserver_data
66+
startupProbe:
67+
httpGet:
68+
path: /geoserver/web
69+
port: http
70+
failureThreshold: {{ .Values.startup.failureThreshold }}
71+
periodSeconds: {{ .Values.startup.periodSeconds }}
72+
livenessProbe:
73+
httpGet:
74+
path: /geoserver/web
75+
port: http
76+
readinessProbe:
77+
httpGet:
78+
path: /geoserver/web
79+
port: http
80+
resources:
81+
{{- toYaml .Values.resources | nindent 12 }}
82+
volumes:
83+
- name: {{ include "geoserver.fullname" . }}
84+
persistentVolumeClaim:
85+
{{- if .Values.persistence.existingClaim }}
86+
claimName: {{ .Values.persistence.existingClaim }}
87+
{{- else }}
88+
claimName: {{ include "geoserver.fullname" . }}
89+
{{- end }}
90+
{{- with .Values.nodeSelector }}
91+
nodeSelector:
92+
{{- toYaml . | nindent 8 }}
93+
{{- end }}
94+
{{- with .Values.affinity }}
95+
affinity:
96+
{{- toYaml . | nindent 8 }}
97+
{{- end }}
98+
{{- with .Values.tolerations }}
99+
tolerations:
100+
{{- toYaml . | nindent 8 }}
101+
{{- end }}
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "geoserver.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
apiVersion: networking.k8s.io/v1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
{{- include "geoserver.labels" . | nindent 4 }}
10+
{{- with .Values.ingress.annotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if .Values.ingress.tls }}
16+
tls:
17+
{{- range .Values.ingress.tls }}
18+
- hosts:
19+
{{- range .hosts }}
20+
- {{ . | quote }}
21+
{{- end }}
22+
secretName: {{ .secretName }}
23+
{{- end }}
24+
{{- end }}
25+
rules:
26+
{{- range .Values.ingress.hosts }}
27+
- host: {{ .host | quote }}
28+
http:
29+
paths:
30+
- path: /geoserver/
31+
pathType: ImplementationSpecific
32+
backend:
33+
service:
34+
name: {{ $fullName }}
35+
port:
36+
number: {{ $svcPort }}
37+
{{- end }}
38+
{{- end }}

0 commit comments

Comments
 (0)