Skip to content

feat: Make Vector PostgreSQL schema configurable via POSTGRES_SCHEMA - #84

Merged
ricardozanini merged 1 commit into
mainfrom
feat/vector-schema-configurable
Sep 28, 2026
Merged

ricardozanini merged 1 commit into
mainfrom
feat/vector-schema-configurable

Conversation

@ricardozanini

@ricardozanini ricardozanini commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Vector and Flyway migrations both interact with PostgreSQL tables, but lacked a mechanism to ensure they use the same schema. This PR makes PostgreSQL schema explicitly configurable across Vector, Flyway, and DataIndex services, ensuring consistent table resolution and migration creation.

Addresses #83

Technical Details

The Fix

Vector PostgreSQL sink now uses the search_path connection parameter:

endpoint: "postgres://...?options=-c%20search_path%3D${POSTGRES_SCHEMA}"

DataIndex JDBC datasource (Flyway + JPA) now includes schema via currentSchema:

jdbc:postgresql://...?currentSchema=${POSTGRES_SCHEMA}

Flyway migrations target the configured schema:

QUARKUS_FLYWAY_SCHEMAS=${POSTGRES_SCHEMA}

This ensures all components consistently target the same schema:

  1. Flyway creates tables in the specified schema
  2. Vector inserts into the same schema
  3. DataIndex JPA queries the same schema

Schema Configuration

  • Default: logicapps (for testing and production use cases)
  • Configurable: Via Helm postgresql.schema value
  • Propagation:
    • Vector DaemonSet: POSTGRES_SCHEMA environment variable
    • DataIndex/Ingestion: JDBC URL parameter via currentSchema
    • Flyway: Target schema via QUARKUS_FLYWAY_SCHEMAS environment variable
    • E2E verification: Schema-aware table and trigger checks

Usage in logic-operator

When logic-operator deploys DataIndex with a custom schema:

helm install data-index ... --set postgresql.schema=logicflow

All components automatically use the same schema:

  • Flyway creates tables in logicflow schema
  • Vector targets logicflow schema for inserts
  • DataIndex queries logicflow schema
  • E2E verification checks logicflow schema for tables

Changes

  • Vector endpoint: Add options=-c%20search_path%3D${POSTGRES_SCHEMA} to PostgreSQL sink
  • DataIndex JDBC: Add currentSchema parameter to connection string helper
  • DataIndex: Add QUARKUS_FLYWAY_SCHEMAS environment variable
  • Vector DaemonSet: Add POSTGRES_SCHEMA environment variable
  • Helm values: Set postgresql.schema default to logicapps
  • E2E test scripts: Pass POSTGRES_SCHEMA=logicapps to verification
  • E2E verification: Make schema checks dynamic (use POSTGRES_SCHEMA env var)
  • Vector config validation: Update test to use POSTGRES_SCHEMA=logicapps
  • CI MODE 2: Fix build command to use Maven reactor with -am flag
  • Documentation: Update vector-config.adoc with schema configuration examples

Verification

Unit Tests ✅

  • 2 Vector Config Validation Tests — PASS (validates endpoint with logicapps schema)

E2E Tests ✅

  • MODE 1 KIND E2E Test — PASS
    • PostgreSQL accepts connections
    • Flyway creates tables in logicapps schema
    • Vector DaemonSet running and configured
    • DataIndex service healthy
    • Schema verification detects 4 tables + triggers in logicapps schema

Implementation Notes

  • The PostgreSQL schema must exist before Vector connects
  • Default logicapps supports the operator use case while remaining configurable
  • E2E verification script uses ${POSTGRES_SCHEMA:-public} fallback for backward compatibility
  • When using custom schemas, ensure all three components (Vector, Flyway, DataIndex) are configured consistently
  • This makes deployments fully schema-aware, critical for multi-tenant or production scenarios

Copilot AI lite review requested due to automatic review settings September 28, 2026 17:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical issues remain with the sink connection syntax and propagation of the selected schema to migrations and application datasources.

Review effort: Lite
Findings: 3 High severity · 2 Low severity

Open (5)
What changed in this PR

This PR makes Vector’s PostgreSQL schema configurable through Helm and environment variables.

Changes:

  • Adds POSTGRES_SCHEMA to Vector sink configuration.
  • Exposes postgresql.schema through Helm.
  • Updates Vector deployment wiring and validation configuration.
File Summary
data-index/​helm/​data-index/​values.yaml Adds the PostgreSQL schema value.
data-index/​helm/​data-index/​templates/​vector-daemonset.yaml Injects the schema into Vector.
data-index/​collectors/​vector/​mode1-postgresql/​vector.yaml Adds schema-aware sink configuration and documentation.
data-index/​collectors/​src/​test/​java/​org/​kubesmarts/​logic/​apps/​dataindex/​collectors/​VectorConfigValidationIT.java Supplies the schema during validation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread data-index/collectors/vector/mode1-postgresql/vector.yaml Outdated
Comment thread data-index/helm/data-index/templates/vector-daemonset.yaml Outdated
Comment thread data-index/helm/data-index/values.yaml Outdated
Comment thread data-index/collectors/vector/mode1-postgresql/vector.yaml Outdated
@ricardozanini
ricardozanini force-pushed the feat/vector-schema-configurable branch 2 times, most recently from 2d59023 to f4df360 Compare September 28, 2026 17:24
@ricardozanini
ricardozanini requested a lite review from Copilot September 28, 2026 17:26

This comment was marked as outdated.

@ricardozanini
ricardozanini force-pushed the feat/vector-schema-configurable branch 3 times, most recently from 9aab81d to 4de9747 Compare September 28, 2026 17:38
@ricardozanini
ricardozanini requested a lite review from Copilot September 28, 2026 17:39

This comment was marked as outdated.

This comment was marked as outdated.

…DataIndex

Configure schema for Vector's search_path, Flyway migrations, and DataIndex JDBC connection.
Allows operator to deploy with custom schemas (e.g., 'logicflow' in production).

Changes:
- Vector endpoint: Add search_path parameter via PostgreSQL connection option
- DataIndex JDBC: Add currentSchema parameter to connection string
- Flyway: Configure target schema via QUARKUS_FLYWAY_SCHEMAS
- DaemonSet: Add POSTGRES_SCHEMA environment variable for Vector
- Helm values: Set default schema to logicapps for testing
- E2E tests: Pass POSTGRES_SCHEMA to verification script
- Documentation: Update vector-config.adoc with schema configuration examples
- Unit tests: Validate Vector config with logicapps schema
- CI fix: Update MODE 2 build command to use Maven reactor with -am flag

Verified: KIND E2E MODE 1 test passes with custom schema
@ricardozanini
ricardozanini force-pushed the feat/vector-schema-configurable branch from 5de1234 to 6ea12dc Compare September 28, 2026 18:53
@ricardozanini ricardozanini linked an issue Sep 28, 2026 that may be closed by this pull request
3 tasks
@ricardozanini
ricardozanini merged commit aa71c7d into main Sep 28, 2026
5 checks passed
@ricardozanini
ricardozanini deleted the feat/vector-schema-configurable branch September 28, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector: Make PostgreSQL schema configurable via environment variable

2 participants