Skip to content

Add database.external configuration to support external PostgreSQL (parity with redis.external) #549

@sayerada

Description

@sayerada

Problem

The chart currently supports external Redis via the redis.external.enabled configuration, which disables the creation of an internal Redis StatefulSet. However, there is no equivalent configuration for PostgreSQL.

When using an external PostgreSQL database (e.g., AWS Aurora, Cloud SQL), LGP custom resources created by LangSmith deployments still have spec.database.enabled: true, which causes the operator to create internal PostgreSQL StatefulSets that cannot start due to missing storage class configuration or are simply redundant.

This results in:

  • Permanently pending pods consuming scheduler resources
  • Unnecessary PVC creation attempts
  • Confusion about which database is actually being used

Current Behavior

# values.yaml - Redis has external support
redis:
  external:
    enabled: true
    existingSecretName: "my-redis-secret"
    connectionUrlSecretKey: "REDIS_URI_CUSTOM"

# No equivalent for database
# database.external does not exist

When external postgres credentials are provided via POSTGRES_URI_CUSTOM in deployment secrets, the operator still creates an internal postgres StatefulSet if the LGP CR has database.enabled: true.

Expected Behavior

The chart should provide a database.external configuration option similar to redis.external:

database:
  external:
    enabled: false  # Set to true when using external postgres
    existingSecretName: ""
    connectionUrlSecretKey: "POSTGRES_URI_CUSTOM"

When database.external.enabled: true, the chart/operator should:

  1. Not create internal PostgreSQL StatefulSets
  2. Optionally override LGP CR database.enabled settings (similar to how redis is handled)
  3. Use the external connection string from the specified secret

Proposed Solution

Add a database.external configuration section to values.yaml that mirrors the existing redis.external structure:

database:
  name: "postgres"
  containerPort: 5432
  external:
    # -- Whether to use an external PostgreSQL instance. This will disable the
    # creation of a postgres stateful-set and service.
    enabled: false
    connectionUrl: ""
    connectionUrlSecretKey: "connection_url"
    existingSecretName: ""

Use Case

We're deploying LangGraph Platform in a hybrid environment with:

  • External AWS Aurora PostgreSQL (managed separately via Terraform)
  • External AWS ElastiCache Redis (managed separately via Terraform)
  • LangSmith Cloud creating LGP deployments via API

Currently, even though we provide POSTGRES_URI_CUSTOM in our deployment secrets, we end up with stuck pods because LangSmith sets database.enabled: true in the LGP CR.

Additional Context

  • Chart version: 0.2.14
  • This would provide feature parity with the existing redis.external configuration
  • Production environments often use managed database services rather than in-cluster postgres
  • The operator.templates.db template is always available but there's no chart-level way to prevent its use

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions