Skip to content

Commit a655f7d

Browse files
authored
Merge pull request #63 from opencadc/posix-mapper-postgres
feat: remove default postgresql database install and require provided…
2 parents d207c1b + 740aeca commit a655f7d

16 files changed

+213
-124
lines changed

helm/applications/posix-mapper/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# CHANGELOG for POSIX Mapper (0.4.4)
1+
# CHANGELOG for POSIX Mapper (0.5.0)
2+
3+
## 2025.07.28 (0.5.0)
4+
### 🚨 Breaking Changes
5+
- 🛑 🔥 Removed default PostgreSQL database. It is expected that deployers will run their own PostreSQL database with permanent storage.
26

37
## 2025.07.16 (0.4.4)
48
- Fix for default GID with new Users. Default GID will match new User's UID.

helm/applications/posix-mapper/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 0.4.4
18+
version: 0.5.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Deployment
2+
3+
This Helm chart deploys the POSIX Mapper application, which is designed to map POSIX file system operations to a cloud-native environment.
4+
5+
## Prerequisites
6+
7+
- Kubernetes 1.27+
8+
- Helm 3.0+
9+
- Deployed PostgreSQL database for application data storage
10+
11+
### PostgreSQL Database
12+
The POSIX Mapper requires a PostgreSQL database to store UID/GID mappings. As this is a critical component, ensure that your database is properly configured and accessible from the POSIX Mapper application. Use some persistent storage solution (like a Persistent Volume Claim) to ensure that the database data is not lost if deploying PostgreSQL in Kubernetes, or install a dedicated instance outside of the cluster.
13+
14+
#### Sample PostgreSQL Installation (in Kubernetes)
15+
You can deploy a PostgreSQL database using the following Helm chart, with a PVC to ensure data persistence (Using `skaha-system` namespace as an example):
16+
17+
##### Persistent Volume Claim (PVC)
18+
Create a Persistent Volume Claim (PVC) for PostgreSQL:
19+
```yaml
20+
apiVersion: v1
21+
kind: PersistentVolumeClaim
22+
metadata:
23+
name: posix-mapper-postgres-pvc
24+
namespace: skaha-system
25+
spec:
26+
accessModes:
27+
- ReadWriteOnce
28+
resources:
29+
requests:
30+
storage: 2Gi
31+
storageClassName: ""
32+
selector:
33+
matchLabels:
34+
storage: posix-mapper-postgres-storage
35+
```
36+
37+
This will need to match to a Persistent Volume (PV) that is available in your Kubernetes cluster. An example PV could look like this for a CephFS instance in an OpenStack Share:
38+
39+
```yaml
40+
---
41+
apiVersion: v1
42+
kind: PersistentVolume
43+
metadata:
44+
name: posix-mapper-postgres-pv
45+
labels:
46+
storage: posix-mapper-postgres-storage
47+
spec:
48+
capacity:
49+
storage: 2Gi
50+
volumeMode: Filesystem
51+
accessModes:
52+
- ReadWriteMany
53+
persistentVolumeReclaimPolicy: Delete
54+
storageClassName: ""
55+
cephfs:
56+
monitors:
57+
- 10.0.0.1:6789
58+
- 10.0.0.2:6789
59+
path: /volumes/myvolume
60+
user: posix-mapper-postgres
61+
readOnly: false
62+
secretRef:
63+
name: posix-mapper-postgres-secret
64+
namespace: skaha-system
65+
```
66+
67+
Ultimately, it will be up to the deployment to ensure that the PVC is bound to a suitable PV, and that the PV is available in the cluster.
68+
69+
##### Install PostgreSQL using Helm
70+
71+
```bash
72+
helm repo add bitnami https://charts.bitnami.com/bitnami
73+
helm repo update
74+
```
75+
76+
Use a Helm Values file to customize the installation. This will initialize the database schema and set up the required user credentials. The schema should match what the POSIX Mapper expects in its configuration.
77+
Create a file named `my-postgresql-values.yaml` with the following content:
78+
```yaml
79+
auth:
80+
username: posixmapperuser
81+
password: posixmapperpwd
82+
database: posixmapper
83+
primary:
84+
initdb:
85+
scripts:
86+
init_schema.sql: |
87+
create schema mapping;
88+
persistence:
89+
enabled: true
90+
existingClaim: posix-mapper-postgres-pvc
91+
```
92+
```bash
93+
helm install posix-mapper-postgres bitnami/postgresql \
94+
--namespace skaha-system \
95+
--values my-postgresql-values.yaml
96+
```
97+
98+
99+
## POSIX Mapper Installation
100+
To deploy the POSIX Mapper application using the Helm chart, follow these steps:
101+
102+
1. **Add the Helm Repository**
103+
```bash
104+
helm repo add science-platform-repo https://images.opencadc.org/chartrepo/platform
105+
helm repo update
106+
```
107+
108+
2. **Install the POSIX Mapper Chart**:
109+
```bash
110+
helm -n skaha-system --values <myvalues.yaml> install posix-mapper science-platform-repo/posix-mapper
111+
```
112+
113+
## Configuration
114+
The POSIX Mapper Helm chart comes with _some_ default configuration suitable for most deployments. However, you can customize the installation by providing your own `values.yaml` file. This allows you to override default settings such as resource allocations, environment variables, and other parameters, as well as set **required** parameters such as the PostgreSQL database configuration.
115+
116+
To customize the installation:
117+
118+
- **Create a `local-values.yaml` File**: Define your custom configurations in this file.
119+
- **Install the Chart with Custom Values**:
120+
```bash
121+
helm -n skaha-system upgrade --install --values local-values.yaml posix-mapper science-platform-repo/posix-mapper
122+
```
123+
124+
### Supported Configuration Options
125+
See the [values.yaml](values.yaml) file for a complete list of configuration options. Below are some of the key parameters you can configure:
126+
127+
| Parameter | Description | Default |
128+
|-----------|-------------|---------|
129+
| `kubernetesClusterDomain` | Kubernetes cluster domain used to find internal hosts | `cluster.local` |
130+
| `replicaCount` | Number of POSIX Mapper replicas to deploy | `1` |
131+
| `tolerations` | Array of tolerations to pass to Kubernetes for fine-grained Node targeting of the `posix-mapper` API | `[]` |
132+
| `deployment.hostname` | Hostname for the POSIX Mapper deployment | `""` |
133+
| `deployment.posixMapper.loggingGroups` | List of groups permitted to adjust logging levels for the POSIX Mapper service. | `[]` |
134+
| `deployment.posixMapper.image` | POSIX Mapper Docker image | `images.opencadc.org/platform/posix-mapper:<current release version>` |
135+
| `deployment.posixMapper.imagePullPolicy` | Image pull policy for the POSIX Mapper container | `IfNotPresent` |
136+
| `deployment.posixMapper.resourceID` | Resource ID (URI) for this POSIX Mapper service | `""` |
137+
| `deployment.posixMapper.oidcURI` | URI (or URL) for the OIDC service | `""` |
138+
| `deployment.posixMapper.gmsID` | Resource ID (URI) for the IVOA Group Management Service | `""` |
139+
| `deployment.posixMapper.minUID` | Minimum UID for POSIX Mapper operations. High to avoid conflicts. | `10000` |
140+
| `deployment.posixMapper.minGID` | Minimum GID for POSIX Mapper operations. High to avoid conflicts. | `900000` |
141+
| `deployment.posixMapper.registryURL` | URL for the IVOA registry containing service locations | `""` |
142+
| `deployment.posixMapper.nodeAffinity` | Kubernetes Node affinity for the POSIX Mapper API Pod | `{}` |
143+
| `deployment.posixMapper.extraPorts` | List of extra ports to expose in the POSIX Mapper service. See the `values.yaml` file for examples. | `[]` |
144+
| `deployment.posixMapper.extraVolumeMounts` | List of extra volume mounts to be mounted in the POSIX Mapper deployment. See the `values.yaml` file for examples. | `[]` |
145+
| `deployment.posixMapper.extraVolumes` | List of extra volumes to be mounted in the POSIX Mapper deployment. See the `values.yaml` file for examples. | `[]` |
146+
| `deployment.posixMapper.extraHosts` | List of extra hosts to be added to the POSIX Mapper deployment. See the `values.yaml` file for examples. | `[]` |
147+
| `deployment.posixMapper.extraEnv` | List of extra environment variables to be set in the POSIX Mapper service. See the `values.yaml` file for examples. | `[]` |
148+
| `deployment.posixMapper.resources` | Resource requests and limits for the POSIX Mapper API | `{}` |
149+
| `postgresql.maxActive` | Maximum number of active connections to the PostgreSQL database | `8` |
150+
| `postgresql.url` | Required JDBC URL for the PostgreSQL database | `""` |
151+
| `postgresql.schema` | Required Database schema to use for the POSIX Mapper | `""` |
152+
| `postgresql.auth.username` | Username for the PostgreSQL database | `""` |
153+
| `postgresql.auth.password` | Password for the PostgreSQL database | `""` |
154+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{- range $val := .Values.deployment.posixMapper.loggingGroups }}
2+
group = {{ $val }}
3+
{{- end }}

helm/applications/posix-mapper/config/catalina.properties

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ tomcat.connector.proxyName={{ .Values.deployment.hostname }}
33
tomcat.connector.proxyPort=443
44
ca.nrc.cadc.auth.PrincipalExtractor.enableClientCertHeader=true
55
ca.nrc.cadc.util.Log4jInit.messageOnly=true
6-
# (default: ca.nrc.cadc.auth.NoOpIdentityManager)
76
ca.nrc.cadc.auth.IdentityManager=org.opencadc.auth.StandardIdentityManager
87

98
# database connection pools
10-
{{- with required "PostgreSQL Database configuration is required." .Values.postgresql.auth }}
9+
{{- $postgresql := required "Missing PostgreSQL configuration at .Values.postgresql" .Values.postgresql }}
10+
{{- with $postgresql }}
1111
org.opencadc.posix.mapper.maxActive={{ .maxActive | default 8 }}
12-
org.opencadc.posix.mapper.username={{ .username }}
13-
org.opencadc.posix.mapper.password={{ .password }}
14-
{{- if .url }}
15-
org.opencadc.posix.mapper.url={{ .url }}
16-
{{- else }}
17-
org.opencadc.posix.mapper.url=jdbc:postgresql://posix-mapper-postgres.{{ $.Values.skaha.namespace }}.svc.{{ $.Values.kubernetesClusterDomain }}:5432/{{ .database }}
18-
{{- end }}
12+
org.opencadc.posix.mapper.url={{ .url | required "Missing PostgreSQL URL at .Values.postgresql.url" }}
13+
14+
{{- $postgresqlAuth := required "Missing PostgreSQL authentication configuration at .Values.postgresql.auth" .auth }}
15+
org.opencadc.posix.mapper.username={{ $postgresqlAuth.username | required "Missing PostgreSQL username at .Values.postgresql.auth.username" }}
16+
org.opencadc.posix.mapper.password={{ $postgresqlAuth.password | required "Missing PostgreSQL password at .Values.postgresql.auth.password" }}
1917
{{- end }}

helm/applications/posix-mapper/config/posix-mapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
org.opencadc.posix.mapper.resourceID={{ .Values.deployment.posixMapper.resourceID }}
33

44
# database schema
5-
org.opencadc.posix.mapper.schema={{ .Values.postgresql.auth.schema }}
5+
org.opencadc.posix.mapper.schema={{ .Values.postgresql.schema }}
66

77
# ID ranges to allow some customization where administration is necessary
88
org.opencadc.posix.mapper.uid.start={{ .Values.deployment.posixMapper.minUID }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- /*
2+
Post-install notes for POSIX Mapper.
3+
*/ -}}
4+
5+
POSIX Mapper release: {{ .Release.Name }}
6+
Namespace: {{ .Release.Namespace }}
7+
8+
PostgreSQL config:
9+
- Connecting to host: {{ .Values.postgresql.url }}
10+
- Schema: {{ .Values.postgresql.schema }}
11+
{{- /*
12+
Checking auth here to pass linting.
13+
*/ -}}
14+
{{- if .Values.postgresql.auth }}
15+
- Connecting as: {{ .Values.postgresql.auth.username }}
16+
{{- end }}
17+
18+
Quick checks:
19+
- kubectl -n {{ .Release.Namespace }} get deployment posix-mapper-tomcat

helm/applications/posix-mapper/templates/posix-mapper-configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v1
22
kind: ConfigMap
33
metadata:
44
name: posix-mapper-config
5-
namespace: {{ .Values.skaha.namespace }}
5+
namespace: {{ .Release.Namespace }}
66
data:
77
{{ tpl (.Files.Glob "config/*").AsConfig . | indent 2 }}

helm/applications/posix-mapper/templates/posix-mapper-ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1
22
kind: Ingress
33
metadata:
44
name: posix-mapper-ingress
5-
namespace: {{ .Values.skaha.namespace }}
5+
namespace: {{ .Release.Namespace }}
66
annotations:
77
spec.ingressClassName: traefik
88
spec:

helm/applications/posix-mapper/templates/posix-mapper-secrets.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: v1
44
kind: Secret
55
metadata:
66
name: {{ $secretIndex }}
7-
namespace: {{ $.Values.skaha.namespace }}
7+
namespace: {{ $.Release.Namespace }}
88
type: Opaque
99
data:
1010
{{- range $certKey, $certValue := . }}

0 commit comments

Comments
 (0)