Skip to content

Migrate to Helm-based deployment and consolidate E2E tests - #65

Open
ricardozanini wants to merge 11 commits into
mainfrom
feat/helm-e2e-testing
Open

Migrate to Helm-based deployment and consolidate E2E tests#65
ricardozanini wants to merge 11 commits into
mainfrom
feat/helm-e2e-testing

Conversation

@ricardozanini

Copy link
Copy Markdown
Contributor

Summary

This PR completes the migration from script-based deployment to production Helm charts and consolidates the E2E test infrastructure across all 3 deployment modes.

Changes

🎯 Helm-based Deployment

  • Added production Helm chart: data-index/helm/data-index/
  • Single chart supports all 3 modes with conditional templating
  • Mode-specific values files: values-mode1.yaml, values-mode2.yaml, values-mode3.yaml
  • Templates for: FluentBit, Vector, Kafka, PostgreSQL, Elasticsearch, Data Index Service, Ingestion Service, Workflow Test App

🧪 Consolidated E2E Tests

  • Before: 4 separate test classes (BaseE2ETest + 3 mode-specific classes)
  • After: 1 consolidated test class (DataIndexE2ETest.java)
  • Same 4 tests run for all modes:
    • testGraphQLSchemaIntrospection
    • testQueryWorkflowInstances
    • testQueryTaskExecutions
    • testWorkflowLifecycle
  • Mode selection via system property: -De2e.mode=mode1|mode2|mode3
  • Reduction: 75% fewer test classes, zero duplication

📜 E2E Test Scripts

  • New Helm-based scripts in scripts/e2e/:
    • full-test-mode1.sh - Complete MODE 1 E2E
    • full-test-mode2.sh - Complete MODE 2 E2E
    • full-test-mode3.sh - Complete MODE 3 E2E
    • common-setup.sh - Shared cluster setup
  • All scripts use Helm for deployment consistency

⚙️ GitHub Actions

  • Updated .github/workflows/data-index-integration-tests.yml
  • Changed from manual build/deploy steps to Helm-based approach
  • Matrix strategy for parallel MODE testing
  • Reduction: ~190 lines → ~50 lines (74% reduction)

🔧 Configuration

  • Split application properties by profile
  • New application-kafka.properties for MODE 3 clarity
  • Fixed MODE 2 timestamp format (epoch-millis) to prevent Elasticsearch errors

🧹 Cleanup (16 files deleted)

Removed obsolete scripts/kind/ directory and redundant test scripts:

  • Old deployment scripts: deploy-*.sh, install-dependencies.sh, setup-cluster.sh
  • Old E2E scripts: test-mode*-e2e.sh
  • Manual testing utilities: test-graphql.sh, test-vector-mode2.sh
  • Obsolete configs: kind-config.yaml, elasticsearch-statefulset.yaml
  • README with outdated instructions

Testing

All 3 modes verified end-to-end with Helm-based deployment:

✅ MODE 1 (PostgreSQL + FluentBit + Triggers)

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

✅ MODE 2 (Elasticsearch + Vector + Transforms)

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

✅ MODE 3 (Kafka + CloudEvents + Processors)

Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

Benefits

  1. Single deployment method: Helm charts for dev, test, and production
  2. Consistent environments: Same deployment mechanism across all modes
  3. Less duplication: 75% reduction in E2E test classes, 74% reduction in CI workflow
  4. Easier maintenance: One chart to maintain vs. dozens of shell scripts
  5. Production-ready: Helm charts align with Kubernetes best practices

Migration Notes

Before (script-based):

bash scripts/kind/test-mode1-e2e.sh

After (Helm-based):

bash scripts/e2e/full-test-mode1.sh

Related Issues

Part of the effort to modernize deployment infrastructure and align with production Kubernetes patterns.

This commit completes the migration from script-based deployment to
production Helm charts and consolidates the E2E test infrastructure.

**Helm-based Deployment:**
- Added production Helm chart: `data-index/helm/data-index/`
- Values files for all 3 modes: values-mode1.yaml, values-mode2.yaml, values-mode3.yaml
- Single chart supports all deployment modes with conditional templating
- FluentBit, Vector, Kafka, PostgreSQL, Elasticsearch templates

**Consolidated E2E Tests:**
- Single test class (DataIndexE2ETest.java) replaces 4 separate classes
- Same 4 tests run for all modes: schema, workflows, tasks, lifecycle
- Mode selection via system property: -De2e.mode=mode1|mode2|mode3
- Reduced duplication from 4 classes to 1 (75% reduction)

**E2E Test Scripts:**
- New Helm-based scripts: scripts/e2e/full-test-mode*.sh
- Shared setup: scripts/e2e/common-setup.sh
- All scripts use Helm for deployment consistency

**GitHub Actions:**
- Updated pipeline to use Helm-based approach
- Matrix strategy for parallel MODE testing
- Simplified from ~190 lines to ~50 lines (74% reduction)

**Configuration:**
- Split application properties by profile
- New application-kafka.properties for MODE 3
- Timestamp format fix for MODE 2 (epoch-millis)

**Cleanup (16 files deleted):**
- Removed entire scripts/kind/ directory (15 files)
  - Old deployment scripts (deploy-*.sh, install-dependencies.sh)
  - Old E2E scripts (test-mode*-e2e.sh)
  - Manual testing utilities (test-graphql.sh, test-vector-mode2.sh)
  - Obsolete configs (kind-config.yaml, elasticsearch-statefulset.yaml)

**Verification:**
- ✅ MODE 1: 4/4 tests passing
- ✅ MODE 2: 4/4 tests passing
- ✅ MODE 3: 4/4 tests passing

All modes verified end-to-end with Helm-based deployment.
Copilot AI lite review requested due to automatic review settings September 8, 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.

🟡 Changes recommended

There are verified Helm/CI correctness issues (e.g., missing Elasticsearch replicas value defaulting, MODE 3 workflow-test-app config precedence, and CI KIND provisioning assumptions) that can break deployments/tests.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR migrates Data Index’s E2E deployment/testing from ad-hoc KIND shell scripts to a unified Helm chart that can deploy all three modes (PostgreSQL/FluentBit, Elasticsearch/Vector, Kafka/Ingestion), and introduces a consolidated Java E2E test module meant to run the same test suite across modes.

Changes:

  • Added a new data-index Helm chart with mode-specific values files and templates for all required components (MODE 1/2/3).
  • Replaced the old scripts/kind/ E2E tooling with Helm-based E2E scripts under scripts/e2e/ plus a top-level Makefile for common targets.
  • Added a new data-index-e2e-tests Maven module with a consolidated DataIndexE2ETest test suite and updated CI workflow wiring.
File summaries
File Description
pom.xml Adds commons-logging test dependency version management for test modules.
data-index/pom.xml Registers the new data-index-e2e-tests module in the build.
data-index/workflow-test-app/src/main/resources/application.properties Refactors workflow-test-app common config and removes kafka-specific blocks (moved to profile file).
data-index/workflow-test-app/src/main/resources/application-kafka.properties Adds dedicated MODE 3 (Kafka) profile configuration for workflow-test-app.
data-index/workflow-test-app/src/main/java/org/kubesmarts/logic/dataindex/test/WorkflowTestResource.java Adjusts hello-world endpoint response shape to include workflow instance id.
data-index/scripts/kind/test-vector-mode2.sh Removes obsolete script-based MODE 2 Vector testing script.
data-index/scripts/kind/test-mode1-e2e.sh Removes obsolete script-based MODE 1 E2E script.
data-index/scripts/kind/test-graphql.sh Removes obsolete manual GraphQL smoke-test script.
data-index/scripts/kind/setup-cluster.sh Removes obsolete KIND cluster bootstrap script.
data-index/scripts/kind/kind-config.yaml Removes obsolete KIND cluster config file (replaced by Helm chart’s config).
data-index/scripts/kind/install-dependencies.sh Removes obsolete dependency installation script (replaced by Helm-based flow).
data-index/scripts/kind/init-database-schema.sh Removes obsolete DB schema init script (replaced by Flyway-at-start + Helm).
data-index/scripts/kind/elasticsearch-statefulset.yaml Removes obsolete Elasticsearch manifest (replaced by Helm template).
data-index/scripts/kind/deploy-workflow-app.sh Removes obsolete workflow test app deploy script (replaced by Helm template).
data-index/scripts/kind/deploy-vector-mode2.sh Removes obsolete Vector deploy script (replaced by Helm template).
data-index/scripts/kind/deploy-kafka-ingestion.sh Removes obsolete MODE 3 ingestion deploy script (replaced by Helm template).
data-index/scripts/e2e/common-setup.sh Adds shared KIND + image build/load setup for Helm-based E2E runs.
data-index/scripts/e2e/full-test-mode1.sh Adds full Helm-based MODE 1 E2E script (cluster recreate → deploy → run tests).
data-index/scripts/e2e/full-test-mode2.sh Adds full Helm-based MODE 2 E2E script (cluster recreate → deploy → run tests).
data-index/scripts/e2e/full-test-mode3.sh Adds full Helm-based MODE 3 E2E script (cluster recreate → deploy → run tests).
data-index/Makefile Adds a unified entry point for setup/deploy/test targets across modes.
data-index/helm/data-index/Chart.yaml Introduces the new Helm chart metadata.
data-index/helm/data-index/.helmignore Adds Helm ignore patterns for packaging.
data-index/helm/data-index/README.md Documents chart usage, modes, local KIND testing, and troubleshooting.
data-index/helm/data-index/kind-cluster.yaml Adds the KIND cluster config used by E2E scripts (NodePort mappings).
data-index/helm/data-index/values.yaml Adds common Helm values for all modes (images, services, resources).
data-index/helm/data-index/values-mode1.yaml Adds MODE 1 overrides (PostgreSQL + FluentBit).
data-index/helm/data-index/values-mode2.yaml Adds MODE 2 overrides (Elasticsearch + Vector).
data-index/helm/data-index/values-mode3.yaml Adds MODE 3 overrides (Kafka + ingestion + PostgreSQL).
data-index/helm/data-index/templates/_helpers.tpl Adds Helm helper functions (namespace, connection strings, labels).
data-index/helm/data-index/templates/namespace.yaml Creates per-component namespaces used by the chart (logging/workflows/backend).
data-index/helm/data-index/templates/postgresql.yaml Adds a PostgreSQL StatefulSet/Service for MODE 1 and MODE 3.
data-index/helm/data-index/templates/elasticsearch.yaml Adds an Elasticsearch StatefulSet/Service for MODE 2.
data-index/helm/data-index/templates/kafka.yaml Adds a single-broker Kafka StatefulSet/Service for MODE 3 (testing-oriented).
data-index/helm/data-index/templates/fluentbit-configmap.yaml Embeds FluentBit config files into a ConfigMap for MODE 1.
data-index/helm/data-index/templates/fluentbit-daemonset.yaml Adds FluentBit DaemonSet + RBAC for MODE 1 log shipping to PostgreSQL.
data-index/helm/data-index/templates/vector-configmap.yaml Embeds Vector config into a ConfigMap for MODE 2.
data-index/helm/data-index/templates/vector-daemonset.yaml Adds Vector DaemonSet + RBAC for MODE 2 log shipping to Elasticsearch.
data-index/helm/data-index/templates/data-index-service.yaml Adds the Data Index service Deployment/Service with mode-aware backend configuration.
data-index/helm/data-index/templates/data-index-ingestion.yaml Adds MODE 3 ingestion Deployment/Service (Kafka → PostgreSQL).
data-index/helm/data-index/templates/workflow-test-app.yaml Adds workflow-test-app Deployment/Service, mode-aware env wiring.
data-index/helm/data-index/configs/vector/vector.yaml Adds Vector configuration used by the Helm chart (MODE 2).
data-index/helm/data-index/configs/fluentbit/README.md Documents the FluentBit config provenance within the chart.
data-index/helm/data-index/configs/fluentbit/parsers.conf Adds FluentBit parsers for CRI/JSON.
data-index/helm/data-index/configs/fluentbit/fluent-bit.conf Adds FluentBit pipeline configuration for MODE 1.
data-index/helm/data-index/configs/fluentbit/flatten-event.lua Adds Lua transform script to normalize Quarkus Flow event fields.
data-index/data-index-e2e-tests/pom.xml Adds a dedicated Maven module for Helm-deployment E2E tests.
data-index/data-index-e2e-tests/README.md Adds documentation for the new E2E test module (needs updating to match consolidation).
data-index/data-index-e2e-tests/src/test/java/org/kubesmarts/logic/dataindex/e2e/DataIndexE2ETest.java Introduces consolidated E2E tests that run across modes via -De2e.mode.
data-index/CLAUDE.md Adds local “graphify” guidance for codebase navigation.
.github/workflows/data-index-integration-tests.yml Updates CI to run Helm-based E2E scripts via a matrix strategy.
.github/renovate.json5 Adds Renovate grouping rules and regex managers for Helm-based Docker image tags (Vector/ES/Kafka).
Review details
  • Files reviewed: 56/56 changed files
  • Comments generated: 7
  • Review effort level: Lite

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

Comment thread .github/workflows/data-index-integration-tests.yml
Comment thread data-index/helm/data-index/templates/elasticsearch.yaml
Comment thread data-index/helm/data-index/values.yaml
Comment thread data-index/helm/data-index/templates/workflow-test-app.yaml Outdated
Comment thread data-index/data-index-e2e-tests/README.md Outdated
Comment thread data-index/scripts/e2e/common-setup.sh
The previous approach of building from subdirectories caused Maven to
search for dependencies in remote repositories instead of the reactor.

Changes:
- Build from data-index/ reactor root instead of subdirectories
- Use -pl (project list) to specify which modules to build
- Use -am (also-make) to include required dependencies
- Consolidate workflow-test-app build with service builds

This ensures Maven resolves data-index-service-postgresql and
data-index-storage-postgresql from the reactor build, not from
Apache snapshots repository.

Fixes MODE 1, MODE 2, and MODE 3 CI builds.
…rovements

This commit fixes multiple issues preventing CI builds from succeeding:

**Compilation Fixes:**
- Add objectRemovedListener() method to AbstractJPAStorageFetcher
  Required by StorageFetcher interface for read-only query service
- Add @mapping ignore annotations to WorkflowInstanceEntityMapper
  Suppress warnings for unmapped fields: workflow, eventTimestamp, createdAt, updatedAt
- Add @mapping ignore annotations to TaskInstanceEntityMapper
  Suppress warnings for unmapped fields: eventTimestamp, compositeId, createdAt, updatedAt

**E2E Test Conditional Execution:**
- Add @EnabledIfSystemProperty annotation to DataIndexE2ETest
  Tests only run when e2e.mode system property is set
- Remove default e2e.mode value from pom.xml
  Prevents tests from running during regular Maven builds
- Change e2e.skip default from false to true
  Tests are skipped by default, explicitly enabled via -De2e.skip=false
- Update all E2E test scripts to pass -De2e.skip=false
  Ensures tests run in E2E test scripts but not in regular builds
- Add assertion for workflow instance ID with helpful error message
  Improves test failure diagnostics

**CI/CD Improvements:**
- Add KIND installation step to GitHub Actions workflow
  Ensures KIND is available before running E2E tests
- Install KIND with install_only: true flag
  Allows scripts to create clusters with custom config

**Helm Chart Improvements:**
- Add default value for Elasticsearch replicas
  Prevents errors when replicas not specified in values
- Remove QUARKUS_FLOW_STRUCTURED_LOGGING_ENABLED env var
  Already configured in application.properties, no override needed

**Build Verification:**
- All modules compile successfully (21/21)
- No MapStruct warnings
- E2E tests properly conditional (skipped by default)

Fixes compilation failures in CI builds.
Previous commit had wrong return type for objectRemovedListener().
The StorageFetcher interface requires Multi<K> (reactive stream of keys),
not Consumer<V>.

Changes:
- Change return type: Consumer<V> → Multi<K>
- Change import: java.util.function.Consumer → io.smallrye.mutiny.Multi
- Change return value: null → Multi.createFrom().empty()

This matches the StorageFetcher interface signature expected by CI.

Apologies for not verifying the exact interface signature in the
persistence-commons-api dependency before the previous commit.
The build scripts were using -Ppostgresql and -Pelasticsearch flags,
but these Maven profiles don't exist in the project.

These were Quarkus runtime profiles (used with -Dquarkus.profile=),
not Maven build profiles, causing warnings:
[WARNING] The requested profile "postgresql" could not be activated because it does not exist.
[WARNING] The requested profile "elasticsearch" could not be activated because it does not exist.

Changes:
- Remove -Ppostgresql from MODE 1 builds
- Remove -Pelasticsearch from MODE 2 builds
- Keep -Pkafka for MODE 3 (this profile exists in workflow-test-app)
- Remove redundant -Dquarkus.container-image.name flag

The modules will build correctly based on their artifact IDs:
- data-index-service-postgresql → kubesmarts/data-index-service-postgresql
- data-index-service-elasticsearch → kubesmarts/data-index-service-elasticsearch
- workflow-test-app → kubesmarts/workflow-test-app

This should fix MODE 2 build failures where workflow-test-app image
was not being created.
The testTaskTransformProducesCorrectFields test was failing in CI
with a timing issue - the task execution was not being found after
the transform ran.

Changes:
- Increase wait time from 5s to 10s after indexing task event
- Add explicit transform trigger (matching workflow test pattern)
- Add comment explaining the extended wait time for CI environments

The test manually recreates transforms and needs more time in CI
environments where resources may be constrained.

All E2E tests are passing, indicating the transforms work correctly
in real deployments. This is just a test timing issue.
…tency

MODE 2 E2E test was timing out after 30 seconds waiting for workflow
instance to appear. This is due to the additional latency in MODE 2's
architecture compared to MODE 1 and MODE 3:

MODE 2 data flow:
1. Workflow app logs event to /tmp/quarkus-flow-events.log
2. Vector tails file and sends to Elasticsearch (file tail delay)
3. Elasticsearch transform runs (1s frequency + processing time)
4. Data becomes available via GraphQL

In CI environments with resource constraints, this can take longer
than the local environment where 30s was sufficient.

Changes:
- Increase timeout to 60s for MODE 2 (mode2)
- Keep 30s timeout for MODE 1 and MODE 3 (faster architectures)
- Add mode and timeout to log message for debugging

MODE 1 (triggers) and MODE 3 (Kafka) have lower latency and don't
need the extended timeout.
…vements

This commit addresses multiple PR review comments:

**1. E2E Tests README - Updated Documentation**
- Fixed outdated test structure documentation
- Removed references to deleted classes (BaseE2ETest, Mode*Test)
- Updated to reflect consolidated DataIndexE2ETest.java
- Corrected e2e.mode (required, no default) and e2e.skip (default: true)
- Updated development examples for current single-class pattern

**2. Common Setup Script - Fixed Broken Commands**
- Fixed "Next steps" output referencing non-existent scripts
- Changed: test-helm-mode*.sh → full-test-mode*.sh (correct paths)
- Scripts now point to files that actually exist in the repo

**3. Helm Chart Security - Kubernetes Secrets for Credentials**
Added support for Kubernetes Secrets instead of plaintext passwords:

- New template: postgresql-secret.yaml
  Creates Secret only if existingSecret not provided

- Updated values.yaml:
  Added existingSecret field for external Secret reference
  Added security warnings against committing passwords
  Changed password to clearly insecure test-only value
  Documented 3 secure alternatives for production

- Updated all PostgreSQL credential references:
  templates/postgresql.yaml - use secretKeyRef instead of direct values
  templates/data-index-service.yaml - use secretKeyRef
  templates/data-index-ingestion.yaml - use secretKeyRef

Security improvements:
- No default production password in values.yaml
- Support for pre-created Kubernetes Secrets (existingSecret)
- Credentials referenced from Secrets, not rendered as plaintext in manifests
- Clear documentation of secure deployment patterns

**4. Logging Dependency - Replace commons-logging with jcl-over-slf4j**
- Replaced commons-logging:1.3.4 with jcl-over-slf4j:2.0.18 (SLF4J bridge)
- Aligns with project SLF4J baseline
- Redirects Apache HTTP Client's commons-logging calls to SLF4J
- Unified logging framework throughout project
- Smaller footprint: 18 KB vs 62 KB (71% reduction)

All changes verified with successful builds and tests.
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
…uilt in CI

The E2E CI builds were failing because they built from the data-index
reactor, which doesn't include persistence-commons-api. When the
StorageFetcher interface was updated (removing objectRemovedListener
and objectUpdatedListener methods), the CI used a cached old version
of persistence-commons-api, causing compilation failures.

Changes:
- Updated all mvn build commands in common-setup.sh to run from
  PROJECT_ROOT instead of PROJECT_ROOT/data-index
- Updated -pl paths to include data-index/ prefix
- Added comments explaining the root reactor requirement
- Affects MODE 1, MODE 2, and MODE 3 builds

This ensures persistence-commons-api is always rebuilt with the
latest interface changes.

@mcruzdev mcruzdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Add comprehensive infrastructure validation before running E2E tests
to fail fast if any component is broken. Infrastructure checks are now
separated from test execution.

Changes:
- New script: verify-infrastructure.sh
  * MODE 1: Checks Data Index ready, PostgreSQL connected, schema
    initialized (4 tables), triggers created
  * MODE 2: Checks Data Index ready, Elasticsearch healthy, index
    templates created, transforms running
  * MODE 3: Checks Data Index ready, Ingestion service ready,
    PostgreSQL connected, schema initialized (2 tables), Kafka reachable
  * Uses bash-native wait_for() function (works on Linux + macOS)

- Updated all E2E scripts (mode1, mode2, mode3):
  * Added Step 6: Verify Infrastructure Ready
  * Tests only run AFTER infrastructure validation passes
  * Fail fast with clear error messages

- Simplified test class structure:
  * Removed DataIndexMode2E2ETest.java (no longer needed)
  * DataIndexE2ETest.java runs for all modes (mode[123])
  * Tests assume infrastructure is ready (validated by scripts)
  * Tests focus on data flow, not infrastructure checks

- Updated Makefile:
  * Added -De2e.skip=false to e2e-mode* targets
  * Improved help section with categorized commands
  * Clear guidance on what to run (test-mode1/2/3)

Benefits:
- Fail fast: Detects broken infrastructure in < 2 minutes
- Clear errors: "Transform not running" vs "timeout waiting"
- Separation of concerns: Setup validates, tests test
- Cross-platform: Works on both Linux and macOS
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.

3 participants