Skip to content

Commit abeb6a1

Browse files
committed
add persistenmce for SQLite database
1 parent a8651fa commit abeb6a1

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

helmchart/geohealthcheck/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A Helm chart for GeoHealthCheck
1717
| geohealthcheck.adminEmail | string | `"[email protected]"` | email address of administrator / contact- notification emails will come from this address |
1818
| geohealthcheck.auth.secret | string | `"changeme"` | secret key to set when enabling authentication |
1919
| geohealthcheck.basicAuthDisabled | string | `"False"` | disable Basic Authentication to access GHC webapp and APIs (default: False), |
20-
| geohealthcheck.databaseUri | string | `"sqlite:///data.db"` | database connection string for SQL-Alchemy valid examples are: SQLite: 'sqlite:///data.db' PostgreSQL: 'postgresql+psycopg2://scott:tiger@localhost:5432/mydatabase' |
20+
| geohealthcheck.databaseUri | string | `"sqlite:////data/data.db"` | database connection string for SQL-Alchemy valid examples are: SQLite: 'sqlite:///data.db' PostgreSQL: 'postgresql+psycopg2://scott:tiger@localhost:5432/mydatabase' |
2121
| geohealthcheck.largeXml | string | `"False"` | allows GeoHealthCheck to receive large XML files from the servers under test (default False). Note: setting this to True might pose a security risk |
2222
| geohealthcheck.logLevel | string | `"30"` | logging level: 10=DEBUG 20=INFO 30=WARN(ING) 40=ERROR 50=FATAL/CRITICAL (default: 30, WARNING) |
2323
| geohealthcheck.metadataCacheSecs | string | `"900"` | metadata, “Capabilities Docs”, cache expiry time, default 900 secs, -1 to disable |
@@ -56,6 +56,9 @@ A Helm chart for GeoHealthCheck
5656
| networkPolicy.egressEnabled | bool | `true` | allow/deny external connections. This should be enabled if you want to monitor resources outside of this namespace |
5757
| networkPolicy.enabled | bool | `true` | Enable/disable network policy generation |
5858
| nodeSelector | object | `{}` | |
59+
| persistence.enabled | bool | `true` | enable persistence when using an SQLite database |
60+
| persistence.size | string | `"1Gi"` | size of the data partition |
61+
| persistence.storageClassName | string | `""` | |
5962
| podAnnotations | object | `{}` | This is for setting Kubernetes Annotations to a Pod. For more information checkout: yamllint disable-line rule:line-length https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ |
6063
| podLabels | object | `{}` | This is for setting Kubernetes Labels to a Pod. For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ |
6164
| podSecurityContext | object | `{}` | |

helmchart/geohealthcheck/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ spec:
7373
mountPath: '/usr/local/share/ca-certificates'
7474
- name: 'ca-bundle'
7575
mountPath: '/etc/ssl/certs'
76+
- name: data
77+
mountPath: /data
7678
{{- with .Values.volumeMounts }}
7779
{{- toYaml . | nindent 12 }}
7880
{{- end }}
@@ -82,6 +84,9 @@ spec:
8284
name: {{ printf "%s-certificates" (include "geohealthcheck.fullname" .) | squote }}
8385
- name: ca-bundle
8486
emptyDir: {}
87+
- name: data
88+
persistentVolumeClaim:
89+
claimName: {{ include "geohealthcheck.fullname" . | squote }}
8590
{{- with .Values.volumes }}
8691
{{- toYaml . | nindent 8 }}
8792
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
{{- if .Values.persistence.enabled }}
3+
apiVersion: 'v1'
4+
kind: 'PersistentVolumeClaim'
5+
metadata:
6+
name: {{ include "geohealthcheck.fullname" . | squote }}
7+
labels:
8+
{{- include "geohealthcheck.labels" . | nindent 4 }}
9+
spec:
10+
accessModes:
11+
- 'ReadWriteOnce'
12+
resources:
13+
requests:
14+
storage: {{ .Values.persistence.size | squote }}
15+
{{- if .Values.persistence.storageClassName }}
16+
storageClassName: {{ .Values.persistence.storageClassName | squote }}
17+
{{- end }}
18+
{{- end }}

helmchart/geohealthcheck/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ geohealthcheck:
8585
# valid examples are:
8686
# SQLite: 'sqlite:///data.db'
8787
# PostgreSQL: 'postgresql+psycopg2://scott:tiger@localhost:5432/mydatabase'
88-
databaseUri: 'sqlite:///data.db'
88+
databaseUri: 'sqlite:////data/data.db'
8989
auth:
9090
# -- secret key to set when enabling authentication
9191
secret: 'changeme'
@@ -210,6 +210,14 @@ readinessProbe:
210210
path: '/'
211211
port: 'http'
212212

213+
persistence:
214+
# -- enable persistence when using an SQLite database
215+
enabled: true
216+
# -- size of the data partition
217+
size: '1Gi'
218+
# storage class name. Leave empty for the default class
219+
storageClassName: ''
220+
213221
# -- Additional volumes on the output Deployment definition.
214222
# volumes:
215223
# - name: foo

0 commit comments

Comments
 (0)