-
Story
-
Resolution: Unresolved
-
Undefined
-
None
-
None
Extract the bundled infrastructure components (PostgreSQL, Valkey, Kafka/Strimzi setup) from the cost-onprem chart into a dedicated infrastructure Helm chart for dev/demo deployments.
This follows the team consensus on PR #99 that production deployments should use BYOI exclusively, while dev/demo environments use a two-chart installation flow:
- Install infra-chart (PostgreSQL, Valkey, Kafka) -- dev/demo only
- Install cost-onprem-chart (the application)
In production, only the second chart is installed. The customer provides their own PostgreSQL, Valkey/Redis, and Kafka endpoints via BYOI configuration (database.deploy: false, valkey.deploy: false, kafka.bootstrapServers).
Task 1: Create the infrastructure Helm chart
Create a new Helm chart (e.g. cost-onprem-infra/) containing the resources currently bundled in the cost-onprem chart:
- PostgreSQL StatefulSet -- from cost-onprem/templates/infrastructure/database/ (StatefulSet, Service, init ConfigMap)
- Valkey Deployment -- from cost-onprem/templates/infrastructure/cache/ (Deployment, Service, PVC)
- Kafka/Strimzi resources -- currently managed by install-helm-chart.sh (Strimzi operator subscription, KafkaCluster CR, topic CRs). Move these into chart templates with appropriate wait/readiness logic.
The infra chart should:
- Accept a values.yaml that controls which components to deploy (e.g. postgresql.enabled, valkey.enabled, kafka.enabled)
- Expose connection details (hostnames, ports) either as output values or via a predictable naming convention that the cost-onprem chart can reference
- Create the database credentials secret (currently done by install-helm-chart.sh via create_database_credentials_secret())
- Run the PostgreSQL init scripts (database/user creation) currently in configmap-init.yaml
Task 2: Remove bundled infrastructure from cost-onprem chart
Once the infra chart exists:
- Remove the database templates (infrastructure/database/) from cost-onprem
- Remove the Valkey templates (infrastructure/cache/) from cost-onprem
- Set database.deploy and valkey.deploy defaults to false in values.yaml (BYOI becomes the default)
- Keep the BYOI configuration keys (database.server.host, valkey.host, kafka.bootstrapServers) as the primary connection mechanism
- Verify helm template and helm lint pass with default values (no bundled infra)
Task 3: Update install-helm-chart.sh
Modify the install script to orchestrate both charts:
- Install the infra chart first (into the same namespace or a dedicated infra namespace)
- Wait for infrastructure readiness (PostgreSQL accepting connections, Valkey ready, Kafka topics created)
- Derive the BYOI connection values from the infra chart's deployed services
- Pass those values to the cost-onprem chart install (via --set or a generated values overlay)
- Move the database credential creation logic from the script into the infra chart
- Move the Strimzi/Kafka deployment logic from the script into the infra chart
Task 4: Make BYOI the default CI test mode
- Update the CI test pipeline to deploy infrastructure via the infra chart (or pre-existing external services) rather than relying on bundled infrastructure
- The cost-onprem chart is installed in BYOI mode, pointing to the infra chart's services
- This validates the production-like deployment path on every PR
- Bundled-mode testing (single chart with everything) is retired from CI but can still run locally
Task 5: Update documentation
- Installation guide: Document the two-chart flow for dev/demo (install infra-chart, then cost-onprem-chart)
- Production section: Expand the BYOI section as the primary/recommended installation path
- Install script reference: Document the new script behavior (two-chart orchestration)
- Migration notes: Document how existing single-chart deployments can transition to the two-chart model
Acceptance Criteria
- A standalone infra chart deploys PostgreSQL, Valkey, and Kafka with a single helm install
- The cost-onprem chart installs successfully without any bundled infrastructure (BYOI-only by default)
- install-helm-chart.sh installs both charts end-to-end for dev/demo setups
- CI runs E2E tests in BYOI mode against infra-chart-deployed services
- Documentation clearly describes both installation paths
- No regression in application functionality compared to the current single-chart approach