Fix support PostgreSQL CA bundle in Helm charts with file path option
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -155,6 +155,8 @@ The following parameters **must** be configured:
|
|||||||
| `postgresql.port` | PostgreSQL port | `5432` |
|
| `postgresql.port` | PostgreSQL port | `5432` |
|
||||||
| `postgresql.database` | Database name | `probod` |
|
| `postgresql.database` | Database name | `probod` |
|
||||||
| `postgresql.username` | Database user | `probod` |
|
| `postgresql.username` | Database user | `probod` |
|
||||||
|
| `postgresql.caBundle` | PostgreSQL TLS CA certificate bundle (inline) | `""` |
|
||||||
|
| `postgresql.caBundlePath` | PostgreSQL TLS CA certificate bundle (file path) | `""` |
|
||||||
| `s3.bucket` | S3 bucket name | `probod` |
|
| `s3.bucket` | S3 bucket name | `probod` |
|
||||||
| `s3.region` | AWS region | `us-east-1` |
|
| `s3.region` | AWS region | `us-east-1` |
|
||||||
| `s3.endpoint` | S3 endpoint (for S3-compatible) | `""` |
|
| `s3.endpoint` | S3 endpoint (for S3-compatible) | `""` |
|
||||||
@@ -183,6 +185,38 @@ The chart deploys the following:
|
|||||||
|
|
||||||
Database migrations run automatically when Probo starts. No manual intervention is required.
|
Database migrations run automatically when Probo starts. No manual intervention is required.
|
||||||
|
|
||||||
|
### TLS/SSL Configuration
|
||||||
|
|
||||||
|
For secure PostgreSQL connections, you can provide a CA certificate bundle in two ways:
|
||||||
|
|
||||||
|
1. **Inline CA Bundle** (`postgresql.caBundle`): Provide the certificate content directly in values.yaml
|
||||||
|
```yaml
|
||||||
|
postgresql:
|
||||||
|
caBundle: |
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl
|
||||||
|
...
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **File Path** (`postgresql.caBundlePath`): Mount the CA bundle as a ConfigMap/Secret and reference the path
|
||||||
|
```yaml
|
||||||
|
postgresql:
|
||||||
|
caBundlePath: /etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
|
# Then mount your CA bundle using volumes/volumeMounts
|
||||||
|
volumes:
|
||||||
|
- name: ca-bundle
|
||||||
|
configMap:
|
||||||
|
name: postgres-ca-bundle
|
||||||
|
volumeMounts:
|
||||||
|
- name: ca-bundle
|
||||||
|
mountPath: /etc/ssl/certs
|
||||||
|
readOnly: true
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** Using `caBundlePath` is recommended for large CA bundles (e.g., system CA bundles) as it avoids environment variable size limitations.
|
||||||
|
|
||||||
### Backup
|
### Backup
|
||||||
|
|
||||||
Use your PostgreSQL provider's backup solution (e.g., AWS RDS automated backups, GCP Cloud SQL backups).
|
Use your PostgreSQL provider's backup solution (e.g., AWS RDS automated backups, GCP Cloud SQL backups).
|
||||||
@@ -232,6 +266,11 @@ Check the Probo logs for S3 connection errors when uploading files.
|
|||||||
postgresql:
|
postgresql:
|
||||||
host: "mydb.abc123.us-east-1.rds.amazonaws.com"
|
host: "mydb.abc123.us-east-1.rds.amazonaws.com"
|
||||||
password: "<rds-password>"
|
password: "<rds-password>"
|
||||||
|
# Optional: Add RDS CA bundle for TLS connections
|
||||||
|
# caBundle: |
|
||||||
|
# -----BEGIN CERTIFICATE-----
|
||||||
|
# ...RDS CA certificate...
|
||||||
|
# -----END CERTIFICATE-----
|
||||||
|
|
||||||
s3:
|
s3:
|
||||||
region: "us-east-1"
|
region: "us-east-1"
|
||||||
|
|||||||
@@ -85,6 +85,16 @@ spec:
|
|||||||
value: {{ include "probo.postgresql.database" . | quote }}
|
value: {{ include "probo.postgresql.database" . | quote }}
|
||||||
- name: PG_POOL_SIZE
|
- name: PG_POOL_SIZE
|
||||||
value: {{ .Values.postgresql.poolSize | default "100" | quote }}
|
value: {{ .Values.postgresql.poolSize | default "100" | quote }}
|
||||||
|
{{- if .Values.postgresql.caBundle }}
|
||||||
|
- name: PG_CA_BUNDLE
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ include "probo.fullname" . }}
|
||||||
|
key: pg-ca-bundle
|
||||||
|
{{- else if .Values.postgresql.caBundlePath }}
|
||||||
|
- name: PG_CA_BUNDLE_PATH
|
||||||
|
value: {{ .Values.postgresql.caBundlePath | quote }}
|
||||||
|
{{- end }}
|
||||||
# Authentication
|
# Authentication
|
||||||
- name: AUTH_DISABLE_SIGNUP
|
- name: AUTH_DISABLE_SIGNUP
|
||||||
value: {{ .Values.probo.auth.disableSignup | quote }}
|
value: {{ .Values.probo.auth.disableSignup | quote }}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ type: Opaque
|
|||||||
stringData:
|
stringData:
|
||||||
# Database credentials
|
# Database credentials
|
||||||
db-password: {{ if .Values.postgresql.enabled }}{{ .Values.postgresql.auth.postgresPassword | quote }}{{ else }}{{ required "postgresql.password is required when postgresql.enabled=false" .Values.postgresql.password | quote }}{{ end }}
|
db-password: {{ if .Values.postgresql.enabled }}{{ .Values.postgresql.auth.postgresPassword | quote }}{{ else }}{{ required "postgresql.password is required when postgresql.enabled=false" .Values.postgresql.password | quote }}{{ end }}
|
||||||
|
{{- if .Values.postgresql.caBundle }}
|
||||||
|
pg-ca-bundle: {{ .Values.postgresql.caBundle | quote }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
# S3 credentials
|
# S3 credentials
|
||||||
s3-access-key: {{ include "probo.s3.accessKeyId" . | quote }}
|
s3-access-key: {{ include "probo.s3.accessKeyId" . | quote }}
|
||||||
|
|||||||
@@ -297,6 +297,13 @@ postgresql:
|
|||||||
password: "" # REQUIRED when enabled=false: PostgreSQL password
|
password: "" # REQUIRED when enabled=false: PostgreSQL password
|
||||||
database: probod
|
database: probod
|
||||||
poolSize: 100
|
poolSize: 100
|
||||||
|
# PostgreSQL TLS/SSL configuration
|
||||||
|
# caBundle: |
|
||||||
|
# -----BEGIN CERTIFICATE-----
|
||||||
|
# ...certificate content...
|
||||||
|
# -----END CERTIFICATE-----
|
||||||
|
# Or use caBundlePath to mount from a ConfigMap/Secret
|
||||||
|
# caBundlePath: /etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
# S3 storage configuration
|
# S3 storage configuration
|
||||||
# For production: Use external S3 (AWS S3, GCS, etc.)
|
# For production: Use external S3 (AWS S3, GCS, etc.)
|
||||||
|
|||||||
@@ -325,6 +325,20 @@ Maximum number of database connections in the connection pool.
|
|||||||
|
|
||||||
PEM-encoded CA certificate bundle for TLS database connections. Required when connecting to databases with custom or self-signed certificates.
|
PEM-encoded CA certificate bundle for TLS database connections. Required when connecting to databases with custom or self-signed certificates.
|
||||||
|
|
||||||
|
**Environment Variable Options:**
|
||||||
|
|
||||||
|
- `PG_CA_BUNDLE`: Provide the CA bundle content directly as an environment variable (suitable for smaller bundles)
|
||||||
|
- `PG_CA_BUNDLE_PATH`: Provide a file path to the CA bundle (recommended for large CA bundles to avoid "Argument list too long" errors)
|
||||||
|
|
||||||
|
**Example using file path:**
|
||||||
|
```yaml
|
||||||
|
# docker-compose.yml or Kubernetes deployment
|
||||||
|
environment:
|
||||||
|
PG_CA_BUNDLE_PATH: /etc/ssl/certs/ca-certificates.crt
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** When using `PG_CA_BUNDLE_PATH`, the file is read during configuration generation, avoiding environment size limitations. This is the recommended approach when using system CA bundles or large certificate collections.
|
||||||
|
|
||||||
### Authentication Configuration
|
### Authentication Configuration
|
||||||
|
|
||||||
#### `auth.disable-signup` (boolean)
|
#### `auth.disable-signup` (boolean)
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ generate_saml_defaults() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to load CA bundle from file or environment variable
|
# Function to validate CA bundle path
|
||||||
load_pg_ca_bundle() {
|
validate_pg_ca_bundle_path() {
|
||||||
if [ -n "$PG_CA_BUNDLE_PATH" ]; then
|
if [ -n "$PG_CA_BUNDLE_PATH" ]; then
|
||||||
if [ -f "$PG_CA_BUNDLE_PATH" ]; then
|
if [ -f "$PG_CA_BUNDLE_PATH" ]; then
|
||||||
echo "Loading PostgreSQL CA bundle from: $PG_CA_BUNDLE_PATH"
|
echo "Loading PostgreSQL CA bundle from: $PG_CA_BUNDLE_PATH"
|
||||||
export PG_CA_BUNDLE=$(cat "$PG_CA_BUNDLE_PATH")
|
export PG_CA_BUNDLE_FILE="$PG_CA_BUNDLE_PATH"
|
||||||
else
|
else
|
||||||
echo "Warning: PG_CA_BUNDLE_PATH specified but file not found: $PG_CA_BUNDLE_PATH"
|
echo "Warning: PG_CA_BUNDLE_PATH specified but file not found: $PG_CA_BUNDLE_PATH"
|
||||||
fi
|
fi
|
||||||
@@ -48,8 +48,8 @@ else
|
|||||||
# Generate default SAML credentials if not provided
|
# Generate default SAML credentials if not provided
|
||||||
generate_saml_defaults
|
generate_saml_defaults
|
||||||
|
|
||||||
# Load PostgreSQL CA bundle if configured
|
# Validate PostgreSQL CA bundle path if configured
|
||||||
load_pg_ca_bundle
|
validate_pg_ca_bundle_path
|
||||||
|
|
||||||
# Create directory if it doesn't exist
|
# Create directory if it doesn't exist
|
||||||
mkdir -p "$(dirname "$CONFIG_FILE")"
|
mkdir -p "$(dirname "$CONFIG_FILE")"
|
||||||
@@ -85,7 +85,12 @@ probod:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Add PostgreSQL CA bundle if configured
|
# Add PostgreSQL CA bundle if configured
|
||||||
if [ -n "$PG_CA_BUNDLE" ]; then
|
if [ -n "$PG_CA_BUNDLE_FILE" ]; then
|
||||||
|
cat >> "$CONFIG_FILE" <<EOF
|
||||||
|
ca-bundle: |
|
||||||
|
$(cat "$PG_CA_BUNDLE_FILE" | sed 's/^/ /')
|
||||||
|
EOF
|
||||||
|
elif [ -n "$PG_CA_BUNDLE" ]; then
|
||||||
cat >> "$CONFIG_FILE" <<EOF
|
cat >> "$CONFIG_FILE" <<EOF
|
||||||
ca-bundle: |
|
ca-bundle: |
|
||||||
$(echo "$PG_CA_BUNDLE" | sed 's/^/ /')
|
$(echo "$PG_CA_BUNDLE" | sed 's/^/ /')
|
||||||
|
|||||||
Reference in New Issue
Block a user