-
Notifications
You must be signed in to change notification settings - Fork 2
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
add geoserver helm chart #17
base: master
Are you sure you want to change the base?
Changes from 4 commits
4997700
c5caaa0
674f27a
0a6b84f
e19ccef
cf532ce
fbb5aa0
d3497c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would remove all these extensions and leave only the ones that apply to our project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was generated by helm, i removed some of the unused stuff.. |
||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "2.13.0" | ||
description: A Helm chart for Kubernetes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update the description, this will be visible for users who want to install the chart. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
name: geoserver | ||
version: 0.1.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why we don't start at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. switched to 0.0.1 for consistency with the other modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range .Values.ingress.hosts }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "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 svc -w {{ template "geoserver.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "geoserver.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
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={{ template "geoserver.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl port-forward $POD_NAME 8080:80 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these instructions accurate? Can I access the app if I follow these steps? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update the target port for port-forward |
||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
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). | ||
*/}} | ||
{{- define "geoserver.fullname" -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Chart.Name }} | ||
labels: | ||
app: {{ .Chart.Name }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
release: {{ .Chart.Version }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ .Chart.Name }} | ||
release: {{ .Chart.Version }} | ||
spec: | ||
initContainers: | ||
- name: init | ||
image: postgres:9.3-alpine | ||
command: ['bash', '-c', './scripts/init.sh'] | ||
env: | ||
- name: PGHOST | ||
valueFrom : | ||
secretKeyRef: | ||
name: {{ .Values.database.secret }} | ||
key: host | ||
- name: PGUSER | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.database.secret }} | ||
key: user | ||
- name: PGPASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.database.secret }} | ||
key: password | ||
- name: DB_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.application.secret }} | ||
key: geoserver-database-user | ||
- name: DB_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.application.secret }} | ||
key: geoserver-database-password | ||
- name: DB_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.application.secret }} | ||
key: geoserver-database-name | ||
volumeMounts: | ||
- mountPath: /scripts | ||
name: geoserver-init | ||
- name: {{ .Chart.Name }} | ||
mountPath: {{ .Values.application.data_mount }} | ||
{{ if .Values.provider.gcp }} | ||
- name: cloudsql-instance-credentials | ||
mountPath: /secrets/cloudsql | ||
readOnly: true | ||
{{ end }} | ||
containers: | ||
{{ if .Values.provider.gcp }} | ||
- name: cloudsql-proxy | ||
image: gcr.io/cloudsql-docker/gce-proxy:1.11 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's useful to have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is unlikely to happen for a 3rd party image, the default of |
||
command: ["/cloud_sql_proxy", | ||
"-instances={{ .Values.database.instance }}=tcp:5432", | ||
"-credential_file=/secrets/cloudsql/credentials.json"] | ||
volumeMounts: | ||
- name: cloudsql-instance-credentials | ||
mountPath: /secrets/cloudsql | ||
readOnly: true | ||
{{ end }} | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.geoserver.repository }}:{{ .Values.geoserver.tag | default .Chart.AppVersion }}" | ||
ports: | ||
- containerPort: 8080 | ||
livenessProbe: | ||
initialDelaySeconds: 120 | ||
periodSeconds: 10 | ||
httpGet: | ||
path: / | ||
port: 8080 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these port numbers should use the values defined in the values file. |
||
httpHeaders: | ||
- name: X-Kubernetes-Health-Check | ||
value: livenessProbe | ||
- name: Host | ||
value: {{ .Values.url }} | ||
readinessProbe: | ||
initialDelaySeconds: 120 | ||
periodSeconds: 10 | ||
httpGet: | ||
path: / | ||
port: 8080 | ||
httpHeaders: | ||
- name: X-Kubernetes-Health-Check | ||
value: check | ||
- name: Host | ||
value: {{ .Values.url }} | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: DEBUG | ||
value: {{ quote .Values.debug }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is inconsistent with how the other charts handle the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. adapted to other charts |
||
{{- if .Values.extra_env_vars -}} | ||
{{- range $key, $value := .Values.extra_env_vars }} | ||
- name: {{ $key }} | ||
value: {{ . | quote }} | ||
{{- end -}} | ||
{{ end }} | ||
- name: GEOSERVER_DATA_DIR | ||
value: {{ .Values.application.data_mount }} | ||
- name: PGUSER | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.application.secret }} | ||
key: geoserver-database-user | ||
- name: PGPORT | ||
value: "5432" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should come from the values file. |
||
- name: PGHOST | ||
valueFrom : | ||
secretKeyRef: | ||
name: {{ .Values.database.secret }} | ||
key: host | ||
- name: PGPASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.application.secret }} | ||
key: geoserver-database-password | ||
- name: DB_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.application.secret }} | ||
key: geoserver-database-name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this a secret? |
||
volumeMounts: | ||
- name: {{ .Chart.Name }} | ||
mountPath: {{ .Values.application.data_mount }} | ||
imagePullSecrets: | ||
- name: regsecret | ||
volumes: | ||
- name: {{ .Chart.Name }} | ||
MrPink marked this conversation as resolved.
Show resolved
Hide resolved
|
||
persistentVolumeClaim: | ||
claimName: {{ .Chart.Name }} | ||
- name: geoserver-init | ||
configMap: | ||
name: geoserver-init | ||
defaultMode: 0744 | ||
{{ if .Values.provider.gcp }} | ||
- name: cloudsql-instance-credentials | ||
secret: | ||
secretName: cloudsql-instance-credentials | ||
{{ end }} | ||
restartPolicy: Always |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- $serviceName := include "geoserver.name" . -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between |
||
{{- $servicePort := .Values.service.externalPort -}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add the indirection of a variable for a simple value? If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this is used directly the templating fails, because |
||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ template "geoserver.name" . }} | ||
labels: | ||
app: {{ template "geoserver.name" . }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
annotations: | ||
{{- range $key, $value := .Values.ingress.annotations }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
spec: | ||
tls: | ||
- hosts: | ||
{{- range .Values.ingress.hosts }} | ||
- {{ . }} | ||
{{- end }} | ||
{{ if not .Values.ingress.certsecret|empty -}} | ||
secretName: {{ .Values.ingress.certsecret -}} | ||
{{ end }} | ||
rules: | ||
{{- range $host := .Values.ingress.hosts }} | ||
- host: {{ $host }} | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: {{ $serviceName }} | ||
servicePort: {{ $servicePort }} | ||
{{- end -}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: geoserver-init | ||
data: | ||
{{- if .Values.provider.gcp }} | ||
init.sh: | | ||
#!/bin/bash | ||
apk add --no-cache ca-certificates && update-ca-certificates | ||
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O /cloud_sql_proxy | ||
chmod +x /cloud_sql_proxy | ||
echo 8.8.8.8 >>/etc/resolv.conf | ||
echo "starting proxy in background" | ||
/cloud_sql_proxy -instances={{ .Values.database.instance }}=tcp:5432 -credential_file=/secrets/cloudsql/credentials.json & | ||
PROXY_PID=$! | ||
sleep 5 | ||
|
||
psql -c "CREATE DATABASE $DB_NAME;" | ||
psql -c "CREATE USER $DB_USERNAME WITH PASSWORD '$DB_PASSWORD';" | ||
psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USERNAME;" | ||
psql -d $DB_NAME -c "CREATE EXTENSION postgis;" | ||
psql -d $DB_NAME -c "CREATE EXTENSION postgis_topology;" | ||
psql -d $DB_NAME -c "CREATE EXTENSION fuzzystrmatch;" | ||
psql -d $DB_NAME -c "CREATE EXTENSION postgis_tiger_geocoder;" | ||
|
||
echo "sql executed.." | ||
sleep 5 | ||
|
||
echo "stopping proxy" | ||
kill $PROXY_PID | ||
# Fix EFS mount permissions | ||
# chmod -R 775 /media | ||
# chown -R 1000:101 /media | ||
|
||
{{ else }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing whitespace here does not make things better but instead can give problems |
||
init.sh: | | ||
#!/bin/bash | ||
psql -c "CREATE DATABASE $DB_NAME;" | ||
psql -c "CREATE USER $DB_USERNAME WITH PASSWORD '$DB_PASSWORD';" | ||
psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USERNAME;" | ||
|
||
# Fix EFS mount permissions | ||
# chmod -R 775 /media | ||
# chown -R 1000:101 /media | ||
|
||
{{- end -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be adding charts to the index that don't exist. Please remove all the charts that are not strictly the geoserver, if we have to revert this commit we don't want to discard unrelated charts as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is regenerated every time we publish, so it is not required to track this.