Skip to content

Commit

Permalink
Merge pull request #6 from at88mph/posix-mapper-pg-optional
Browse files Browse the repository at this point in the history
fix: make postgres install optional
  • Loading branch information
at88mph authored Dec 19, 2024
2 parents 6cc8ee6 + 320865a commit d227cde
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 14 deletions.
5 changes: 4 additions & 1 deletion helm/applications/posix-mapper/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# CHANGELOG for POSIX Mapper (Chart 0.2.0)
# CHANGELOG for POSIX Mapper (Chart 0.2.1)

## 2024.12.19 (0.2.1)
- Make postgresql configurable for external databases

## 2024.12.11 (0.2.0)
- Added support for `securityContext`
Expand Down
15 changes: 11 additions & 4 deletions helm/applications/posix-mapper/config/catalina.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ ca.nrc.cadc.util.Log4jInit.messageOnly=true
# (default: ca.nrc.cadc.auth.NoOpIdentityManager)
ca.nrc.cadc.auth.IdentityManager=org.opencadc.auth.StandardIdentityManager

org.opencadc.posix.mapper.maxActive={{ .Values.postgresql.maxActive | default 8 }}
org.opencadc.posix.mapper.username={{ .Values.postgresql.auth.username }}
org.opencadc.posix.mapper.password={{ .Values.postgresql.auth.password }}
org.opencadc.posix.mapper.url=jdbc:postgresql://posix-mapper-postgres.{{ .Values.skaha.namespace }}.svc.{{ .Values.kubernetesClusterDomain }}:5432/{{ .Values.postgresql.auth.database }}
# database connection pools
{{- with required "PostgreSQL Database configuration is required." .Values.postgresql.auth }}
org.opencadc.posix.mapper.maxActive={{ .maxActive | default 8 }}
org.opencadc.posix.mapper.username={{ .username }}
org.opencadc.posix.mapper.password={{ .password }}
{{- if .url }}
org.opencadc.posix.mapper.url={{ .url }}
{{- else }}
org.opencadc.posix.mapper.url=jdbc:postgresql://posix-mapper-postgres.{{ $.Values.skaha.namespace }}.svc.{{ $.Values.kubernetesClusterDomain }}:5432/{{ .database }}
{{- end }}
{{- end }}
15 changes: 9 additions & 6 deletions helm/applications/posix-mapper/templates/postgres-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
{{- with required "PostgreSQL Database configuration is required." .Values.postgresql }}
{{- if .install }}
apiVersion: v1
kind: ConfigMap
metadata:
name: posix-mapper-postgres-config
namespace: {{ .Values.skaha.namespace }}
namespace: {{ $.Values.skaha.namespace }}
labels:
app: posix-mapper-postgres
data:
POSTGRES_DB: {{ .Values.postgresql.auth.database }}
POSTGRES_USER: {{ .Values.postgresql.auth.username }}
POSTGRES_PASSWORD: {{ .Values.postgresql.auth.password }}
POSTGRES_DB: {{ .auth.database }}
POSTGRES_USER: {{ .auth.username }}
POSTGRES_PASSWORD: {{ .auth.password }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: posix-mapper-postgres-init
namespace: {{ .Values.skaha.namespace }}
namespace: {{ $.Values.skaha.namespace }}
labels:
app: posix-mapper-postgres
data:
init_schema.sql: |
create schema {{ .Values.postgresql.auth.schema }};
create schema {{ .auth.schema }};
{{- end }}
7 changes: 5 additions & 2 deletions helm/applications/posix-mapper/templates/postgres-deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{{- with required "PostgreSQL Database configuration is required." .Values.postgresql }}
{{- if .install }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: posix-mapper-postgres
namespace: {{ .Values.skaha.namespace }}
namespace: {{ $.Values.skaha.namespace }}
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -34,7 +36,8 @@ spec:
allowPrivilegeEscalation: false
volumes:
- name: postgresdb
{{- toYaml .Values.postgresql.storage.spec | nindent 10 }}
{{- toYaml .storage.spec | nindent 10 }}
- name: postgresinit
configMap:
name: posix-mapper-postgres-init
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.postgresql.install }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -9,4 +10,5 @@ spec:
ports:
- port: 5432
selector:
app: posix-mapper-postgres
app: posix-mapper-postgres
{{- end }}
1 change: 1 addition & 0 deletions helm/applications/posix-mapper/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ secrets:
# These values are preset in the catalina.properties, and this default database only exists beside this service.
# It's usually safe to leave these as-is, but make sure they match the values in catalina.properties.
postgresql:
install: true
maxActive: 8
auth:
username: posixmapper
Expand Down

0 comments on commit d227cde

Please sign in to comment.