Skip to content

Deploy via helm - #8

Merged
HardMax71 merged 17 commits into
mainfrom
deploy_via_helm
Dec 18, 2025
Merged

Deploy via helm#8
HardMax71 merged 17 commits into
mainfrom
deploy_via_helm

Conversation

@HardMax71

@HardMax71 HardMax71 commented Dec 18, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Release Notes

  • New Features

    • Added deployment automation script supporting local development, testing, and production Kubernetes deployments
    • Implemented default user seeding with configurable admin and user credentials
    • Introduced comprehensive Helm chart for production Kubernetes deployments
  • Chores

    • Upgraded GitHub Actions checkout versions across all workflows
    • Enhanced Docker build pipeline with multi-stage base image optimization and vulnerability scanning
    • Improved backend health checks with retry logic
  • Documentation

    • Added deployment guide covering local and production scenarios
    • Updated CI/CD pipeline documentation with new build workflow details

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 18, 2025

Copy link
Copy Markdown

Walkthrough

This pull request restructures CI/CD pipelines, introduces comprehensive Kubernetes/Helm deployment infrastructure, refactors Docker build processes with multi-stage caching, updates application configuration scripts, implements template-based nginx configuration, and significantly expands deployment and operations documentation across the codebase.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Upgrades
.github/workflows/docs.yml, .github/workflows/mypy.yml, .github/workflows/ruff.yml, .github/workflows/security.yml
Bump actions/checkout from v4 to v6 across multiple linting and testing workflows.
Docker Build CI Redesign
.github/workflows/docker.yml
Restructure monolithic Docker workflow into separate jobs (Build Base, Build Backend, Build Frontend, Scan Backend, Scan Frontend, Summary) with explicit dependencies, multi-stage caching via build-contexts, Trivy vulnerability scanning, and updated trigger logic (main branch + v* tags only).
CI Test Workflow Updates
.github/workflows/tests.yml
Bump checkout to v6, simplify Docker Compose startup flow, remove verbose health-check logging, introduce generic /api/v1/health/live endpoint polling, and remove unnecessary volume mounts for backend-dependent services.
Dockerfile & Image Configuration
backend/Dockerfile.base, frontend/Dockerfile.prod, frontend/nginx.conf.template
Migrate uv source from ghcr.io to Docker Hub mirror; switch frontend nginx to template-based configuration using ${BACKEND_URL} environment variable substitution; add writable directory setup for read-only root filesystem.
Backend Application Scripts
backend/scripts/create_topics.py, backend/scripts/seed_users.py
Delete legacy admin-user creation script; enhance topic creation with topic prefix support; add new idempotent user-seeding script with bcrypt password hashing and MongoDB upsert logic.
Backend Service Configuration
backend/app/services/coordinator/coordinator.py
Introduce dynamic settings retrieval in Kafka consumer setup; add fine-grained consumer config parameters (max_poll_interval_ms, max_poll_records, fetch_max_wait_ms, fetch_min_bytes).
Deployment Orchestration
deploy.sh
New comprehensive Bash deployment script providing local dev (dev, down, logs, status), quality checks (check), testing (test), and Kubernetes/Helm production deployment (prod) modes with integrated image building, namespace management, and health verification.
Docker Compose & User Seeding
docker-compose.yaml
Add user-seed service that runs post-base-image-build to seed default admin/user credentials into MongoDB with password environment variables.
Helm Chart Scaffolding
helm/integr8scode/.helmignore, helm/integr8scode/Chart.yaml, helm/integr8scode/charts/.gitkeep
Introduce foundational Helm chart structure with metadata, dependencies (Redis, MongoDB), and Bitnami sub-chart integration; include exclusion rules and gitkeep for dependency management.
Helm Template Helpers & Shared Configuration
helm/integr8scode/templates/_helpers.tpl, helm/integr8scode/templates/secrets/env-secret.yaml
Define reusable naming, labeling, image, and service-discovery helpers; centralize environment variable templates for Redis, MongoDB, Kafka, Jaeger, and application settings.
Helm Backend & Frontend Deployments
helm/integr8scode/templates/app/backend-deployment.yaml, helm/integr8scode/templates/app/backend-service.yaml, helm/integr8scode/templates/app/frontend-deployment.yaml, helm/integr8scode/templates/app/frontend-service.yaml
Define Kubernetes Deployments and Services for backend (HTTPS on 443, metrics on 9090) and frontend (configurable backend URL via environment, health checks on root path) with resource controls, probes, and optional SSL/kubeconfig mounts.
Helm Infrastructure Components
helm/integr8scode/templates/infrastructure/kafka.yaml, helm/integr8scode/templates/infrastructure/schema-registry.yaml, helm/integr8scode/templates/infrastructure/zookeeper.yaml, helm/integr8scode/templates/infrastructure/jaeger.yaml, helm/integr8scode/templates/configmaps/zookeeper-config.yaml
Add Deployments and Services for Kafka (with JAAS secret mounting), Schema Registry, Zookeeper, and optional Jaeger tracing infrastructure with health probes, resource constraints, and JAAS/configuration management.
Helm Job Templates
helm/integr8scode/templates/jobs/kafka-init.yaml, helm/integr8scode/templates/jobs/user-seed.yaml
Define post-install/post-upgrade Jobs to initialize Kafka topics (with schema registry readiness checks) and seed MongoDB users with configurable passwords via environment.
Helm Worker Deployments
helm/integr8scode/templates/workers/_worker.tpl, helm/integr8scode/templates/workers/coordinator.yaml, helm/integr8scode/templates/workers/k8s-worker.yaml, helm/integr8scode/templates/workers/pod-monitor.yaml, helm/integr8scode/templates/workers/result-processor.yaml, helm/integr8scode/templates/workers/saga-orchestrator.yaml, helm/integr8scode/templates/workers/dlq-processor.yaml, helm/integr8scode/templates/workers/event-replay.yaml
Add parameterized worker deployment template and render individual worker Deployments (coordinator, k8s-worker, pod-monitor, result-processor, saga-orchestrator, dlq-processor, event-replay) with configurable replicas, Kafka consumer groups, tracing service names, and optional kubeconfig mounts.
Helm RBAC & Secrets
helm/integr8scode/templates/rbac/serviceaccount.yaml, helm/integr8scode/templates/rbac/role.yaml, helm/integr8scode/templates/rbac/rolebinding.yaml, helm/integr8scode/templates/secrets/kubeconfig-secret.yaml, helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml
Provision ServiceAccount, Role, and RoleBinding for pod execution and Kubernetes API access; define Secrets for kubeconfig (supporting in-cluster or external CA) and Kafka JAAS authentication with configurable credentials.
Helm Configuration & Values
helm/integr8scode/templates/NOTES.txt, helm/integr8scode/values.yaml, helm/integr8scode/values-prod.yaml
Add post-install NOTES with access instructions and troubleshooting; define comprehensive default values for images, replicas, resources, infrastructure components, and Redis/MongoDB settings; provide production-optimized overrides with GHCR image sources and resource scaling.
Build Output Ignores
.gitignore
Add Helm build patterns (helm/*/charts/*.tgz, helm/*/Chart.lock) to exclude packaged charts and lock files.
Documentation Updates
docs/operations/cicd.md, docs/operations/deployment.md, docs/operations/nginx-configuration.md, docs/security/policies.md, mkdocs.yml
Overhaul CI/CD narrative to emphasize multi-job Docker build with Trivy scanning and build-context optimization; introduce comprehensive deployment guide covering local/production flows via deploy.sh; document template-based nginx configuration with environment substitution; update security policies to reflect pod-builder enforced model; add deployment navigation entry to docs.

Sequence Diagram

sequenceDiagram
    actor User
    participant GHA as GitHub Actions
    participant Registry as GHCR
    participant Build as Docker Buildx

    User->>GHA: Push to main / tag v*
    activate GHA
    
    rect rgb(200, 220, 255)
    Note over GHA,Build: Build Base Image
    GHA->>Build: Checkout + Setup Buildx
    GHA->>Registry: Login to GHCR
    GHA->>Build: Build & push base image<br/>(cache layer)
    Build-->>Registry: base:latest
    end
    
    rect rgb(220, 200, 255)
    Note over GHA,Build: Build Backend & Frontend (parallel)
    par Backend Build
        GHA->>Build: Build backend with<br/>build-context: base
        Build->>Registry: Fetch cached base
        Build-->>Registry: backend:tag
    and Frontend Build
        GHA->>Build: Build frontend with<br/>build-context: base
        Build->>Registry: Fetch cached base
        Build-->>Registry: frontend:tag
    end
    end
    
    rect rgb(200, 255, 220)
    Note over GHA,Registry: Security Scanning (parallel)
    par Backend Scan
        GHA->>Registry: Trivy scan backend image
        Registry-->>GHA: SARIF report
    and Frontend Scan
        GHA->>Registry: Trivy scan frontend image
        Registry-->>GHA: SARIF report
    end
    end
    
    rect rgb(255, 240, 200)
    Note over GHA: Summary
    GHA->>GHA: Emit published images log
    end
    
    deactivate GHA
    GHA-->>User: Workflow complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45–75 minutes

Areas requiring additional attention:

  • Helm chart structure & templating (helm/integr8scode/templates/*): Extensive use of conditional rendering, nested helpers, and service discovery logic across 30+ files; verify consistency of naming conventions, label propagation, and environment variable wiring across all worker/infrastructure components.
  • Docker workflow multi-job orchestration (.github/workflows/docker.yml): Complex dependency graph, build-context propagation, and tag logic; ensure caching behavior is optimized and image references are correct across jobs.
  • Kafka consumer configuration changes (backend/app/services/coordinator/coordinator.py): New flow-control parameters (max_poll_interval_ms, max_poll_records, etc.) require validation that they don't introduce consumer lag or rebalance issues in production.
  • Deployment script logic (deploy.sh): Conditional branching for local/prod/test modes, image building/importing, and Helm interactions; test all code paths (dev, test, prod with --local, --prod, --set overrides).
  • nginx template substitution (frontend/nginx.conf.template, frontend/Dockerfile.prod): Verify that ${BACKEND_URL} environment variable is correctly set in all deployment modes (docker-compose, Kubernetes) and that fallback/default behavior is appropriate.

Possibly related PRs

  • HardMax71/Integr8sCode#7: Overlapping changes to Docker CI workflow, base image uv source migration, and docker-compose build context wiring indicate related build/deployment refactoring efforts.

Poem

🐰 Hop, hop, hooray! The infrastructure takes flight,
With Helm charts spun and Docker builds done just right!
From base to backend, from frontend so fine,
Kafka and workers in orchestrated line—
Deploy.sh script hops, and production's in sight!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.84% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Deploy via helm' is vague and generic, failing to convey meaningful information about the substantial changes in this PR. Consider a more descriptive title that reflects the primary scope, such as 'Add Helm chart and Docker Build/Scan workflow overhaul' or 'Introduce Helm deployment infrastructure and CI/CD enhancements'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch deploy_via_helm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter

codecov-commenter commented Dec 18, 2025

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/services/coordinator/coordinator.py 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Flag Coverage Δ
backend 80.00% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/app/services/coordinator/coordinator.py 41.57% <0.00%> (-0.16%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-advanced-security

Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@HardMax71
HardMax71 marked this pull request as ready for review December 18, 2025 15:20

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 11

🧹 Nitpick comments (24)
docs/security/policies.md (1)

49-52: CNI and production deployment notes are valuable; consider expanding with actionable guidance.

The notes correctly highlight CNI requirements (Flannel doesn't support network policies). For operators deploying to production, consider adding:

  • Link to the Helm values or deployment guide that specifies CNI plugin recommendations.
  • Whether the Helm chart includes instructions or hooks for installing a policy-capable CNI (e.g., Calico init container, or pre-deployment checklist).
  • Whether NetworkPolicy is optional in dev/test environments or mandatory.
backend/app/services/coordinator/coordinator.py (1)

127-138: LGTM! Good addition of Kafka consumer flow control parameters.

The new consumer configuration parameters (max_poll_interval_ms, max_poll_records, fetch_max_wait_ms, fetch_min_bytes) are sensible tuning values for flow control and low-latency message consumption.

Minor observation: get_settings() is called again here (line 127) despite being called in __init__ (line 73). If you prefer consistency, you could store self._settings = settings in __init__ and reuse it here. However, this is a very minor point since get_settings() is typically cached via lru_cache or similar.

helm/integr8scode/templates/rbac/serviceaccount.yaml (1)

13-13: Consider setting automountServiceAccountToken: false for better security posture.

Unless the pods explicitly need to interact with the Kubernetes API, setting automountServiceAccountToken: false reduces the attack surface by preventing automatic mounting of service account tokens.

🔎 Apply this diff if pods don't require API access:
-automountServiceAccountToken: true
+automountServiceAccountToken: false
helm/integr8scode/templates/app/backend-service.yaml (1)

15-17: Consider aligning targetPort with the configurable service port.

The service port is configurable via .Values.backend.service.port, but the targetPort is hardcoded to 443. If the service port is overridden, traffic may not reach the pods correctly. Consider making the targetPort configurable or using the same value.

🔎 Apply this diff to align the ports:
   - name: https
     port: {{ .Values.backend.service.port | default 443 }}
-    targetPort: 443
+    targetPort: {{ .Values.backend.service.targetPort | default 443 }}

Or if the backend container always listens on 443:

   - name: https
-    port: {{ .Values.backend.service.port | default 443 }}
+    port: 443
     targetPort: 443
helm/integr8scode/templates/configmaps/zookeeper-config.yaml (1)

21-21: Restrict four-letter-word commands whitelist for better security.

Setting 4lw.commands.whitelist=* allows unrestricted access to all Zookeeper administrative commands. Consider whitelisting only the necessary commands (e.g., ruok,stat,conf) to reduce the attack surface in production environments.

🔎 Apply this diff to restrict commands:
-    4lw.commands.whitelist=*
+    4lw.commands.whitelist=ruok,stat,conf
backend/Dockerfile.base (1)

15-16: Pin the uv version for build reproducibility.

Using the :latest tag leads to non-reproducible builds. It's best practice to pin to a specific uv version, e.g., with: COPY --from=astral/uv:0.9.18 /uv /uvx /bin/ Consider using a stable release instead of :latest to ensure consistent builds across environments.

helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml (1)

11-12: Consider external secret management for production deployments.

The JAAS configuration file containing credentials (user_super="admin-secret", password="kafka-secret") is embedded in the Helm chart, which works for development but embeds secrets in version control. For production, integrate with external secret management solutions like Sealed Secrets, External Secrets Operator, or cloud provider secret managers to centralize credential management and prevent accidental exposure.

helm/integr8scode/templates/infrastructure/jaeger.yaml (1)

21-51: Consider adding securityContext for container hardening.

The deployment correctly sets automountServiceAccountToken: false, but adding a securityContext would further harden the container by running as non-root and dropping capabilities.

🔎 Suggested addition after line 22:
     spec:
       automountServiceAccountToken: false
+      securityContext:
+        runAsNonRoot: true
+        seccompProfile:
+          type: RuntimeDefault
       containers:
       - name: jaeger
         image: {{ .Values.infrastructure.jaeger.image }}
         imagePullPolicy: {{ .Values.global.imagePullPolicy | default "IfNotPresent" }}
+        securityContext:
+          allowPrivilegeEscalation: false
+          readOnlyRootFilesystem: true
+          capabilities:
+            drop:
+              - ALL
helm/integr8scode/templates/workers/_worker.tpl (1)

33-56: Consider adding health probes for worker containers.

Worker deployments lack readiness and liveness probes, which are important for Kubernetes to properly manage pod lifecycle and traffic routing. This could lead to traffic being sent to unhealthy workers or delayed detection of stuck processes.

🔎 Suggested addition after resources block:
        {{- if $config.healthCheck }}
        livenessProbe:
          {{- toYaml $config.healthCheck.livenessProbe | nindent 10 }}
        readinessProbe:
          {{- toYaml $config.healthCheck.readinessProbe | nindent 10 }}
        {{- end }}

Then define health checks per worker in values.yaml as needed.

docs/operations/deployment.md (2)

42-48: Consider using markdown link syntax for URLs in the table.

Per markdown lint (MD034), bare URLs should be wrapped in angle brackets or markdown link syntax for consistent rendering across all markdown processors.

🔎 Apply this diff:
 | Service            | URL                    |
 |--------------------|------------------------|
-| Frontend           | https://localhost:5001 |
-| Backend API        | https://localhost:443  |
-| Kafdrop (Kafka UI) | http://localhost:9000  |
-| Jaeger (Tracing)   | http://localhost:16686 |
-| Grafana            | http://localhost:3000  |
+| Frontend           | <https://localhost:5001> |
+| Backend API        | <https://localhost:443>  |
+| Kafdrop (Kafka UI) | <http://localhost:9000>  |
+| Jaeger (Tracing)   | <http://localhost:16686> |
+| Grafana            | <http://localhost:3000>  |

106-123: Add language specifier to fenced code block.

The directory tree structure should have a language specifier for consistent rendering. Use text or plaintext for non-code content.

🔎 Apply this diff:
-```
+```text
 helm/integr8scode/
 ├── Chart.yaml              # Chart metadata and dependencies
helm/integr8scode/templates/jobs/user-seed.yaml (2)

57-63: Consider using a Secret for sensitive credentials.

Passwords are passed as plain environment variables rendered directly into the Job manifest. For improved security posture, consider creating a Secret and referencing it via secretKeyRef. This prevents credentials from appearing in kubectl describe job output.


34-46: Init container lacks a timeout for MongoDB readiness check.

The until loop will poll indefinitely if MongoDB never becomes ready. Consider adding a maximum retry count or timeout to fail fast and allow the Job's backoffLimit to handle retries properly.

🔎 Example with retry limit:
        command:
        - sh
        - -c
        - |
          echo "Waiting for MongoDB to be ready..."
          RETRIES=60
          until nc -z {{ include "integr8scode.fullname" . }}-mongodb 27017; do
            RETRIES=$((RETRIES - 1))
            if [ $RETRIES -le 0 ]; then
              echo "MongoDB not ready after timeout, failing..."
              exit 1
            fi
            echo "MongoDB not ready, waiting 5 seconds... ($RETRIES retries left)"
            sleep 5
          done
          echo "MongoDB is ready!"
helm/integr8scode/templates/workers/event-replay.yaml (1)

45-45: restartPolicy: Always is redundant for Deployments.

For Deployments, restartPolicy must be Always (the default), so this line is redundant. It can be removed for cleaner templates, though keeping it explicit is not harmful.

helm/integr8scode/templates/workers/coordinator.yaml (1)

1-46: Coordinator template is well-structured and consistent.

The template follows the same patterns as other worker deployments (event-replay, etc.) with proper conditional rendering, config checksum annotations, and resource fallback logic. The consistency across worker templates aids maintainability.

Same optional note as other workers: restartPolicy: Always on line 45 is redundant for Deployments.

helm/integr8scode/templates/infrastructure/kafka.yaml (1)

11-11: Consider making replicas configurable for production.

The Kafka deployment is hard-coded to a single replica. For production environments, you may want to support multiple replicas for high availability.

🔎 Consider this enhancement:
-  replicas: 1
+  replicas: {{ .Values.infrastructure.kafka.replicas | default 1 }}

Then add to values.yaml:

infrastructure:
  kafka:
    replicas: 1  # Single for dev, increase for production
helm/integr8scode/templates/infrastructure/zookeeper.yaml (1)

49-50: Four-letter word commands are fully open.

Setting ZOOKEEPER_4LW_COMMANDS_WHITELIST to * allows all Zookeeper administrative commands. While convenient for development, production environments should restrict this to only necessary commands (e.g., "ruok,stat,srvr").

🔎 Consider making this configurable:
-        - name: ZOOKEEPER_4LW_COMMANDS_WHITELIST
-          value: "*"
+        - name: ZOOKEEPER_4LW_COMMANDS_WHITELIST
+          value: {{ .Values.infrastructure.zookeeper.fourLetterWordWhitelist | default "*" | quote }}

Add to values-prod.yaml:

infrastructure:
  zookeeper:
    fourLetterWordWhitelist: "ruok,stat,srvr"  # Restrict to needed commands
backend/scripts/seed_users.py (1)

64-99: Consider password strength validation for production.

While the script correctly documents that passwords should be set via environment variables, there's no validation of password strength. For production deployments, consider adding checks to ensure strong passwords are provided.

🔎 Example validation:
+def validate_password(password: str, username: str) -> None:
+    """Ensure password meets minimum security requirements."""
+    if len(password) < 8:
+        raise ValueError(f"Password for {username} must be at least 8 characters")
+    if password == username:
+        raise ValueError(f"Password for {username} cannot equal the username")
+    # Add more checks as needed (uppercase, numbers, special chars, etc.)
+
 async def seed_users() -> None:
     mongodb_url = os.getenv("MONGODB_URL", "mongodb://mongo:27017/integr8scode")
     print("Connecting to MongoDB...")
 
     client: AsyncIOMotorClient = AsyncIOMotorClient(mongodb_url)
     db_name = mongodb_url.rstrip("/").split("/")[-1].split("?")[0] or "integr8scode"
     db = client[db_name]
 
+    default_password = os.getenv("DEFAULT_USER_PASSWORD", "user123")
+    admin_password = os.getenv("ADMIN_USER_PASSWORD", "admin123")
+    
+    validate_password(default_password, "user")
+    validate_password(admin_password, "admin")
+
     # Default user
     await upsert_user(
         db,
         username="user",
         email="user@integr8scode.com",
-        password=os.getenv("DEFAULT_USER_PASSWORD", "user123"),
+        password=default_password,
         role="user",
         is_superuser=False
     )
helm/integr8scode/templates/jobs/kafka-init.yaml (2)

27-40: Consider adding a timeout mechanism to the wait loop.

The init container uses an infinite loop to wait for Kafka. If Kafka fails to start, this container will retry indefinitely until the Job's backoffLimit is reached. Consider adding a maximum retry count or overall timeout within the loop for faster failure detection.

🔎 Apply this diff to add a timeout:
       - sh
       - -c
       - |
         echo "Waiting for Kafka to be ready at {{ include "integr8scode.fullname" . }}-kafka:29092..."
+        max_attempts=60
+        attempt=0
-        until nc -z {{ include "integr8scode.fullname" . }}-kafka 29092; do
+        until nc -z {{ include "integr8scode.fullname" . }}-kafka 29092 || [ $attempt -ge $max_attempts ]; do
           echo "Kafka not ready, waiting 5 seconds..."
           sleep 5
+          attempt=$((attempt + 1))
         done
+        if [ $attempt -ge $max_attempts ]; then
+          echo "Timeout waiting for Kafka after $((max_attempts * 5)) seconds"
+          exit 1
+        fi
         echo "Kafka is ready!"

42-53: Consider adding a timeout mechanism to the wait loop.

Similar to the Kafka wait loop, this init container could benefit from a maximum retry count or timeout to fail faster if Schema Registry doesn't start.

helm/integr8scode/templates/app/backend-deployment.yaml (2)

41-48: Consider sourcing SECRET_KEY from a Kubernetes Secret instead of Helm values.

Storing SECRET_KEY in .Values.backend.extraEnv means it may end up in version-controlled values.yaml files. For production, consider referencing a Kubernetes Secret:

🔎 Suggested approach using secretKeyRef
         {{- if .Values.backend.extraEnv.SECRET_KEY }}
         - name: SECRET_KEY
-          value: {{ .Values.backend.extraEnv.SECRET_KEY | quote }}
+          valueFrom:
+            secretKeyRef:
+              name: {{ include "integr8scode.fullname" . }}-secrets
+              key: secret-key
         {{- end }}

This keeps the secret out of Helm values files while still allowing configuration through --set during deployment.


63-80: Health probe port is hardcoded while scheme is configurable.

The port: 443 is hardcoded in both probes, but scheme is configurable. If the port needs to change (e.g., for non-privileged containers), you'd need to edit the template directly.

🔎 Consider making the port configurable
         livenessProbe:
           httpGet:
             path: {{ .Values.backend.healthProbe.path | default "/api/v1/health/live" }}
-            port: 443
+            port: {{ .Values.backend.healthProbe.port | default 443 }}
             scheme: {{ .Values.backend.healthProbe.scheme | default "HTTPS" }}
deploy.sh (1)

303-309: Quote variables in Helm command to prevent word splitting issues.

While the current approach works when variables are empty or contain simple values, unquoted variables can cause issues with values containing spaces or special characters.

🔎 Safer variable handling
     print_info "Deploying with Helm..."
-    helm upgrade --install "$RELEASE_NAME" "$CHART_PATH" \
-        --namespace "$NAMESPACE" \
-        --values "$CHART_PATH/$VALUES_FILE" \
-        --wait \
-        --timeout 10m \
-        $DRY_RUN \
-        $EXTRA_ARGS
+    local -a helm_args=(
+        upgrade --install "$RELEASE_NAME" "$CHART_PATH"
+        --namespace "$NAMESPACE"
+        --values "$CHART_PATH/$VALUES_FILE"
+        --wait
+        --timeout 10m
+    )
+    [[ -n "$DRY_RUN" ]] && helm_args+=("$DRY_RUN")
+    # shellcheck disable=SC2086
+    helm "${helm_args[@]}" $EXTRA_ARGS

Alternatively, keep the current approach but add a shellcheck directive comment to acknowledge the intentional word splitting for $EXTRA_ARGS.

docs/operations/cicd.md (1)

119-121: Minor grammar fix: hyphenate compound adjective.

🔎 Suggested fix
-After each image builds, [Trivy](https://trivy.dev/) scans it for known vulnerabilities in OS packages and Python
-dependencies. The scan fails if it finds any critical or high severity issues with available fixes. Results upload to
+After each image builds, [Trivy](https://trivy.dev/) scans it for known vulnerabilities in OS packages and Python
+dependencies. The scan fails if it finds any critical or high-severity issues with available fixes. Results upload to
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 917bcdd and 534a2b0.

📒 Files selected for processing (54)
  • .github/workflows/docker.yml (1 hunks)
  • .github/workflows/docs.yml (1 hunks)
  • .github/workflows/mypy.yml (1 hunks)
  • .github/workflows/ruff.yml (1 hunks)
  • .github/workflows/security.yml (1 hunks)
  • .github/workflows/tests.yml (3 hunks)
  • .gitignore (1 hunks)
  • backend/Dockerfile.base (1 hunks)
  • backend/app/services/coordinator/coordinator.py (1 hunks)
  • backend/scripts/create_admin_user.py (0 hunks)
  • backend/scripts/create_topics.py (1 hunks)
  • backend/scripts/seed_users.py (1 hunks)
  • deploy.sh (1 hunks)
  • docker-compose.yaml (1 hunks)
  • docs/operations/cicd.md (5 hunks)
  • docs/operations/deployment.md (1 hunks)
  • docs/operations/nginx-configuration.md (2 hunks)
  • docs/security/policies.md (1 hunks)
  • frontend/Dockerfile.prod (1 hunks)
  • frontend/nginx.conf.template (1 hunks)
  • helm/integr8scode/.helmignore (1 hunks)
  • helm/integr8scode/Chart.yaml (1 hunks)
  • helm/integr8scode/charts/.gitkeep (1 hunks)
  • helm/integr8scode/files/kafka_jaas.conf (1 hunks)
  • helm/integr8scode/templates/NOTES.txt (1 hunks)
  • helm/integr8scode/templates/_helpers.tpl (1 hunks)
  • helm/integr8scode/templates/app/backend-deployment.yaml (1 hunks)
  • helm/integr8scode/templates/app/backend-service.yaml (1 hunks)
  • helm/integr8scode/templates/app/frontend-deployment.yaml (1 hunks)
  • helm/integr8scode/templates/app/frontend-service.yaml (1 hunks)
  • helm/integr8scode/templates/configmaps/env-configmap.yaml (1 hunks)
  • helm/integr8scode/templates/configmaps/zookeeper-config.yaml (1 hunks)
  • helm/integr8scode/templates/infrastructure/jaeger.yaml (1 hunks)
  • helm/integr8scode/templates/infrastructure/kafka.yaml (1 hunks)
  • helm/integr8scode/templates/infrastructure/schema-registry.yaml (1 hunks)
  • helm/integr8scode/templates/infrastructure/zookeeper.yaml (1 hunks)
  • helm/integr8scode/templates/jobs/kafka-init.yaml (1 hunks)
  • helm/integr8scode/templates/jobs/user-seed.yaml (1 hunks)
  • helm/integr8scode/templates/rbac/role.yaml (1 hunks)
  • helm/integr8scode/templates/rbac/rolebinding.yaml (1 hunks)
  • helm/integr8scode/templates/rbac/serviceaccount.yaml (1 hunks)
  • helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml (1 hunks)
  • helm/integr8scode/templates/secrets/kubeconfig-secret.yaml (1 hunks)
  • helm/integr8scode/templates/workers/_worker.tpl (1 hunks)
  • helm/integr8scode/templates/workers/coordinator.yaml (1 hunks)
  • helm/integr8scode/templates/workers/dlq-processor.yaml (1 hunks)
  • helm/integr8scode/templates/workers/event-replay.yaml (1 hunks)
  • helm/integr8scode/templates/workers/k8s-worker.yaml (1 hunks)
  • helm/integr8scode/templates/workers/pod-monitor.yaml (1 hunks)
  • helm/integr8scode/templates/workers/result-processor.yaml (1 hunks)
  • helm/integr8scode/templates/workers/saga-orchestrator.yaml (1 hunks)
  • helm/integr8scode/values-prod.yaml (1 hunks)
  • helm/integr8scode/values.yaml (1 hunks)
  • mkdocs.yml (1 hunks)
💤 Files with no reviewable changes (1)
  • backend/scripts/create_admin_user.py
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/docker.yml

29-29: shellcheck reported issue in this script: SC2086:info:1:66: Double quote to prevent globbing and word splitting

(shellcheck)


56-56: shellcheck reported issue in this script: SC2086:info:2:47: Double quote to prevent globbing and word splitting

(shellcheck)


56-56: shellcheck reported issue in this script: SC2086:info:4:24: Double quote to prevent globbing and word splitting

(shellcheck)


89-89: shellcheck reported issue in this script: SC2086:info:1:66: Double quote to prevent globbing and word splitting

(shellcheck)


116-116: shellcheck reported issue in this script: SC2086:info:2:99: Double quote to prevent globbing and word splitting

(shellcheck)


116-116: shellcheck reported issue in this script: SC2086:info:4:76: Double quote to prevent globbing and word splitting

(shellcheck)


151-151: shellcheck reported issue in this script: SC2086:info:1:66: Double quote to prevent globbing and word splitting

(shellcheck)


178-178: shellcheck reported issue in this script: SC2086:info:2:100: Double quote to prevent globbing and word splitting

(shellcheck)


178-178: shellcheck reported issue in this script: SC2086:info:4:77: Double quote to prevent globbing and word splitting

(shellcheck)


261-261: shellcheck reported issue in this script: SC2086:info:1:66: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:10:36: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:11:37: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:1:38: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:3:36: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:4:36: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:5:94: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:6:100: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:7:102: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:8:12: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2086:info:9:28: Double quote to prevent globbing and word splitting

(shellcheck)


264-264: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

🪛 LanguageTool
docs/operations/deployment.md

[style] ~269-~269: Consider using “arise” to strengthen your wording.
Context: ...licy. ## Troubleshooting A few issues come up regularly during deployment. ### Kafka...

(QUESTIONS_COME_UP)


[uncategorized] ~380-~380: The official name of this software platform is spelled with a capital “H”.
Context: ...gration The GitHub Actions workflow in .github/workflows/docker.yml handles image bui...

(GITHUB)

docs/operations/cicd.md

[grammar] ~120-~120: Use a hyphen to join words.
Context: ...n fails if it finds any critical or high severity issues with available fixes. Re...

(QB_NEW_EN_HYPHEN)

🪛 markdownlint-cli2 (0.18.1)
docs/operations/deployment.md

44-44: Bare URL used

(MD034, no-bare-urls)


45-45: Bare URL used

(MD034, no-bare-urls)


46-46: Bare URL used

(MD034, no-bare-urls)


47-47: Bare URL used

(MD034, no-bare-urls)


48-48: Bare URL used

(MD034, no-bare-urls)


106-106: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 YAMLlint (1.37.1)
helm/integr8scode/templates/infrastructure/kafka.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/event-replay.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/result-processor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/rbac/role.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/secrets/kubeconfig-secret.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/jobs/user-seed.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/jobs/kafka-init.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/app/frontend-service.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/app/frontend-deployment.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/configmaps/zookeeper-config.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/app/backend-deployment.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/app/backend-service.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/infrastructure/zookeeper.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/dlq-processor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/configmaps/env-configmap.yaml

[error] 4-4: syntax error: expected , but found ''

(syntax)

helm/integr8scode/templates/rbac/serviceaccount.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/infrastructure/jaeger.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/k8s-worker.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/saga-orchestrator.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/pod-monitor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/rbac/rolebinding.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/coordinator.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/infrastructure/schema-registry.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

🔇 Additional comments (54)
.gitignore (1)

94-96: Helm build artifacts properly ignored.

The additions appropriately exclude generated Helm artifacts: *.tgz package files and Chart.lock files. This follows the existing pattern organization and correctly prevents build outputs from being committed.

helm/integr8scode/charts/.gitkeep (1)

1-2: LGTM!

Standard .gitkeep placeholder with clear inline documentation of the directory's role in the Helm workflow (populated by helm dependency update with gitignored sub-chart artifacts). The comments will be helpful for future developers maintaining the Helm chart structure.

docs/security/policies.md (1)

5-35: Security controls are clearly and accurately documented.

The container security context (non-root, read-only filesystem, dropped capabilities, seccomp profile) and NetworkPolicy deny-all pattern are well-defined and align with best practices for executor pod hardening. The use of pod builder-enforced labels for policy matching is a clean architectural pattern.

.github/workflows/mypy.yml (1)

15-15: LGTM!

The upgrade to actions/checkout@v6 is valid - v6.0.1 is the latest version. Note that v6 requires a minimum Actions Runner version of v2.327.1, which should be satisfied by GitHub-hosted ubuntu-latest runners.

.github/workflows/security.yml (1)

15-15: LGTM!

Consistent upgrade to actions/checkout@v6 aligning with other workflows in this PR.

.github/workflows/docs.yml (1)

32-32: LGTM!

Consistent upgrade to actions/checkout@v6.

.github/workflows/ruff.yml (1)

15-15: LGTM!

Consistent upgrade to actions/checkout@v6.

helm/integr8scode/.helmignore (1)

1-39: LGTM!

Well-organized .helmignore with appropriate patterns. The negation for templates/NOTES.txt correctly preserves the Helm notes file despite the *.md exclusion pattern.

frontend/nginx.conf.template (1)

16-16: Good refactoring to make the backend URL configurable.

The change from hardcoded https://backend:443 to ${BACKEND_URL} enables environment-specific deployments.

Note that using variables in proxy_pass requires a dedicated resolver directive to resolve paths. Additionally, ensure:

  • BACKEND_URL includes the protocol (e.g., https://backend:443) and is properly set via environment variable
  • proxy_redirect is explicitly configured since location header adjustment is disabled when using variables in proxy_pass
frontend/Dockerfile.prod (1)

18-25: LGTM! Good security practices for read-only root filesystem.

The template-based nginx configuration approach enables environment-driven configuration at container startup, and the writable directory setup correctly supports running nginx with a read-only root filesystem. The ownership settings are appropriate for the nginx user.

backend/scripts/create_topics.py (1)

38-46: LGTM! Topic prefixing implemented correctly.

The topic prefix is consistently applied to all topic names, and the logging provides good visibility into the prefixed topics being created. This approach supports multi-tenancy and environment separation effectively.

mkdocs.yml (1)

123-123: LGTM! Documentation navigation updated correctly.

The new Deployment entry is properly placed under the Operations section and follows the existing navigation structure pattern.

helm/integr8scode/templates/rbac/rolebinding.yaml (1)

1-17: LGTM!

The RoleBinding template is well-structured with proper conditional rendering, consistent naming via Helm helpers, and correct references to the Role and ServiceAccount. The static analysis hint about syntax error is a false positive—{{- is valid Helm/Go template syntax.

helm/integr8scode/templates/NOTES.txt (1)

1-111: LGTM!

Comprehensive and well-structured post-install notes with proper conditional handling for optional components (Jaeger, Kafka), helpful troubleshooting guidance, and correctly templated commands for various service types.

helm/integr8scode/templates/infrastructure/jaeger.yaml (1)

52-75: LGTM!

The Service configuration correctly exposes all required Jaeger ports including UDP for Thrift protocol and matches the Deployment's container ports.

helm/integr8scode/templates/rbac/role.yaml (1)

1-72: LGTM!

The Role template follows least-privilege principles well: secrets have read-only access, pod/configmap permissions support the code execution use case, and each rule block is clearly documented. The static analysis hint is a false positive—Helm template syntax is valid.

helm/integr8scode/templates/workers/_worker.tpl (1)

29-30: Good practice: config checksum annotation.

The checksum annotation ensures pods are restarted when the environment ConfigMap changes, providing automatic configuration reload without manual intervention.

helm/integr8scode/templates/app/frontend-deployment.yaml (1)

1-51: LGTM!

Well-structured frontend deployment with proper conditional rendering, health probes, and security consideration (automountServiceAccountToken: false). The inline comments explaining the difference between BACKEND_URL and VITE_BACKEND_URL are helpful for maintainability. The static analysis hint is a false positive—Helm template syntax is valid.

docs/operations/deployment.md (1)

1-10: Excellent deployment documentation.

This documentation is well-structured, covering both local development and production Kubernetes deployments comprehensively. The troubleshooting section and configuration examples are particularly valuable.

helm/integr8scode/templates/infrastructure/schema-registry.yaml (2)

12-20: Selector and pod labels are consistent but could align with Kubernetes label conventions.

The app label is used for selector matching, which works correctly. Consider whether using app.kubernetes.io/name for selectors would align better with the Kubernetes recommended labels already included via integr8scode.labels. This is optional since the current approach is functional.


27-33: Good use of the SCHEMA_REGISTRY_PORT workaround.

This correctly addresses the Confluent/Kubernetes environment variable conflict documented in the deployment guide. The command override to unset the port variable before running is the appropriate solution.

helm/integr8scode/templates/workers/event-replay.yaml (1)

21-22: Good use of config checksum annotation.

The checksum annotation on the env-configmap ensures pods restart when configuration changes. This is a best practice for managing ConfigMap updates.

helm/integr8scode/templates/workers/pod-monitor.yaml (1)

1-57: LGTM! Well-structured Kubernetes deployment.

The pod-monitor deployment follows Kubernetes best practices with:

  • Proper conditional rendering
  • ConfigMap-based environment configuration with env overrides
  • Resource fallback pattern
  • Secure secret mounting for kubeconfig

The YAMLlint syntax error is a false positive—the template uses valid Go templating syntax.

helm/integr8scode/templates/app/frontend-service.yaml (1)

1-18: LGTM! Clean Service definition.

The frontend Service is minimal and properly configured with sensible defaults. The selector correctly targets the frontend Deployment.

helm/integr8scode/templates/infrastructure/kafka.yaml (2)

27-35: Good documentation of critical workaround.

The inline comment clearly explains why unsetting KAFKA_PORT is necessary to avoid conflicts with Confluent's internal port detection. This is a known issue with Kubernetes environment variable injection and Confluent images.


61-61: Verify auto-create topics setting aligns with operational practices.

Auto-creating topics is enabled by default, which can lead to unintended topic creation from misconfigurations or typos. Consider whether your operational practices require explicit topic creation.

helm/integr8scode/templates/infrastructure/zookeeper.yaml (1)

27-34: Good documentation of critical workaround.

The inline comment clearly explains the ZOOKEEPER_PORT conflict with Kubernetes environment variable injection, mirroring the Kafka workaround.

helm/integr8scode/templates/secrets/kubeconfig-secret.yaml (1)

34-39: Token file path requires service account mount.

Similar to the CA certificate, tokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token only works inside pods with service account tokens mounted. Ensure your pod-monitor and k8s-worker deployments have automountServiceAccountToken: true (or explicitly mount the token).

Verify that worker deployments mounting this kubeconfig also have service account tokens available.

helm/integr8scode/values-prod.yaml (1)

183-189: Good security practice: external password management.

Requiring passwords to be set via --set or external secrets management prevents accidental use of default credentials in production. The inline comments clearly guide operators.

.github/workflows/tests.yml (3)

15-15: Good: Actions version upgrade.

Upgrading to actions/checkout@v6 ensures you're using the latest features and security fixes.


91-96: Good: Removing volume mounts prevents CI permission conflicts.

Removing the ./backend:/app volume mounts avoids .venv permission issues and is appropriate for CI where hot-reload isn't needed. The comment clearly explains the rationale.


142-151: Health endpoint /api/v1/health/live is implemented and correctly referenced.

The endpoint exists at backend/app/api/routes/health.py and is properly registered with the /api/v1 prefix via app.include_router(health.router, prefix=settings.API_V1_STR). The health check curl command uses appropriate retry logic (60 retries, 5-second delay, -f flag for failure detection).

Regarding logging: the "Collect logs" step at line 206 remains in place with if: always(), so container logs are still collected on failure for debugging. No regression on diagnostics.

backend/scripts/seed_users.py (2)

26-61: Good: Idempotent upsert pattern.

The function correctly handles both creation and update scenarios, making it safe to run multiple times. The logging clearly distinguishes between create and update operations.


50-60: Consolidate redundant ID fields in user document.

Lines 51-52 create both _id (MongoDB ObjectId) and user_id (string representation of a different ObjectId). This generates two distinct IDs where typically one suffices. Either:

  1. Use only _id (let MongoDB manage it) and access the string representation via str(user._id) when needed for APIs/clients, or
  2. Use a single ObjectId field without the separate string copy.

Verify your application schema actually requires both fields for distinct purposes (e.g., external integrations requiring string format) before keeping both.

helm/integr8scode/templates/jobs/kafka-init.yaml (1)

54-73: LGTM!

The main container configuration properly uses image fallback, environment templating, and resource definitions. The command structure is consistent with the docker-compose approach.

docs/operations/nginx-configuration.md (1)

195-226: LGTM!

The documentation clearly explains the template-based nginx configuration approach, including environment variable substitution, deployment mechanics, and rebuild procedures. The additions align well with the implementation changes in this PR.

helm/integr8scode/templates/workers/result-processor.yaml (1)

1-46: LGTM!

The result-processor deployment follows the established worker pattern with proper resource fallback, environment configuration, and checksum annotations for config change detection.

helm/integr8scode/templates/workers/saga-orchestrator.yaml (1)

1-46: LGTM!

The saga-orchestrator deployment follows the consistent worker pattern established across the Helm chart with proper configuration and resource management.

helm/integr8scode/values.yaml (1)

167-264: LGTM!

The workers configuration is well-structured with consistent patterns across all worker types. The common resources with per-worker overrides provides good flexibility while maintaining reasonable defaults.

helm/integr8scode/templates/configmaps/env-configmap.yaml (1)

1-64: LGTM!

The environment ConfigMap is well-structured with clear comments explaining the rationale for explicit port settings. The use of template helpers and defaults ensures consistent configuration across all components.

helm/integr8scode/templates/workers/k8s-worker.yaml (1)

47-56: LGTM!

The kubeconfig volume mount is properly configured with read-only access and uses subPath to mount the specific file. This follows Kubernetes security best practices.

docker-compose.yaml (1)

371-391: LGTM, but note the security concern with default passwords.

The user-seed service is properly configured as a one-shot initialization job with appropriate dependencies. However, the default passwords (user123, admin123) used here match the weak defaults in the Helm values file. While acceptable for local development, ensure these are overridden in production deployments.

The default passwords used in this service match those flagged in the Helm values file review. Ensure production deployments use strong, randomly generated passwords by setting DEFAULT_USER_PASSWORD and ADMIN_USER_PASSWORD environment variables.

helm/integr8scode/templates/workers/dlq-processor.yaml (1)

1-46: LGTM - Well-structured Helm template for DLQ processor.

The template correctly implements:

  • Conditional deployment via .Values.workers.dlqProcessor.enabled
  • Config checksum annotation for automatic rollouts on ConfigMap changes
  • Resource fallback pattern from specific to common defaults
  • Proper use of helper templates for consistency

Note: The YAMLlint syntax error is a false positive—this is valid Helm/Go template syntax, not plain YAML.

deploy.sh (1)

211-234: LGTM - Image build and K3s import logic is sound.

The function correctly:

  • Builds base, backend, and frontend images in order
  • Handles both Dockerfile.prod and Dockerfile for frontend
  • Gracefully skips K3s import when not available
  • Uses docker save | sudo k3s ctr images import which is the standard pattern for K3s
docs/operations/cicd.md (1)

74-122: Well-documented Docker build and scan workflow.

The new documentation clearly explains:

  • Job dependencies with the Mermaid diagram
  • Purpose of each job in the pipeline table
  • Base image rationale and build contexts feature
  • Security scanning integration with GitHub Security

This will help maintainers understand the multi-stage build process.

.github/workflows/docker.yml (4)

253-275: LGTM - Summary job logic is correct.

The hardcoded "✅ Passed" indicators are valid because:

  • The summary job depends on both scan-backend and scan-frontend (line 256)
  • If either scan fails, the summary job won't execute
  • Therefore, reaching the summary means both scans passed

The if: github.event_name != 'pull_request' correctly avoids publishing summary for PR builds.


28-29: Shellcheck warnings are informational and acceptable here.

The SC2086 warnings flag ${GITHUB_REPOSITORY_OWNER,,} for potential word splitting. In this GitHub Actions context:

  • Repository owners don't contain spaces
  • The ,, lowercase conversion is intentional bash syntax
  • Quoting would break the parameter expansion

These warnings can be safely ignored for this use case.


26-26: The workflow correctly uses actions/checkout@v6, which is the latest stable release (v6.0.1). This requires a minimum Actions Runner version of v2.327.1 and is well-documented in the official GitHub Marketplace.


204-224: No actionable concern here. The repository has no .trivyignore files—neither backend/.trivyignore nor frontend/.trivyignore exists. The trivyignores: 'backend/.trivyignore' parameter in the Trivy action is a configuration that simply points to a non-existent path, which Trivy tolerates. The actions/checkout@v6 step in scan-backend is therefore not needed for that file, and the absence of checkout in scan-frontend is consistent with this setup.

helm/integr8scode/templates/_helpers.tpl (5)

1-52: LGTM! Standard Helm helpers follow best practices.

These naming and labeling helpers implement standard Helm chart conventions correctly, including proper truncation for DNS compatibility and recommended Kubernetes label standards.


54-77: LGTM! Service account and image helpers are well-structured.

The service account helper correctly handles RBAC configuration, and image reference helpers follow standard patterns for constructing image tags.


79-99: LGTM! Host resolution helpers handle both internal and external services correctly.

The Redis and MongoDB host helpers appropriately distinguish between Bitnami subchart deployments and external service configurations.


116-135: LGTM! Service endpoint helpers use consistent naming conventions.

The Kafka, Schema Registry, and Jaeger helpers construct predictable service endpoints with standard ports, enabling reliable service discovery within the cluster.


137-152: LGTM! Worker label helpers enable component-specific labeling.

These helpers correctly use the .root and .name parameter pattern to generate component-specific labels and selectors for different worker types, facilitating proper pod organization and selection.

Comment thread docs/security/policies.md Outdated
Comment thread helm/integr8scode/Chart.yaml Outdated
Comment thread helm/integr8scode/files/kafka_jaas.conf Outdated
Comment thread helm/integr8scode/templates/_helpers.tpl
Comment thread helm/integr8scode/templates/infrastructure/zookeeper.yaml
Comment thread helm/integr8scode/templates/jobs/user-seed.yaml Outdated
Comment thread helm/integr8scode/templates/secrets/kubeconfig-secret.yaml
Comment thread helm/integr8scode/values-prod.yaml
Comment thread helm/integr8scode/values.yaml
Comment thread helm/integr8scode/values.yaml
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
helm/integr8scode/values.yaml (1)

293-307: Use empty default Kafka JAAS credentials to force explicit configuration.

Similar to the concerns raised for Redis/MongoDB auth and user seed passwords, the Kafka JAAS authentication credentials have hardcoded default values (admin-secret, kafka-secret). These could accidentally be deployed to production.

🔎 Apply this diff to use empty default credentials:
   # JAAS authentication credentials for Zookeeper communication
-  # Override these in production via --set or values-prod.yaml
+  # MUST be set via --set or values-prod.yaml
   jaas:
-    superPassword: "admin-secret"
-    kafkaPassword: "kafka-secret"
+    superPassword: ""  # Required - set via --set or values-prod.yaml
+    kafkaPassword: ""  # Required - set via --set or values-prod.yaml

Consider adding validation in the Kafka template to fail deployment if these credentials are empty in production.

helm/integr8scode/templates/app/backend-deployment.yaml (1)

37-49: Consider iterating over all extraEnv variables for extensibility.

The current implementation only handles SECRET_KEY and WEB_CONCURRENCY explicitly. If more environment variables are needed in the future, each would require a template change.

🔎 Apply this diff for a more flexible approach:
        env:
        - name: KUBECONFIG
          value: "/app/kubeconfig.yaml"
-       {{- if .Values.backend.extraEnv }}
-       {{- if .Values.backend.extraEnv.SECRET_KEY }}
-       - name: SECRET_KEY
-         value: {{ .Values.backend.extraEnv.SECRET_KEY | quote }}
-       {{- end }}
-       {{- if .Values.backend.extraEnv.WEB_CONCURRENCY }}
-       - name: WEB_CONCURRENCY
-         value: {{ .Values.backend.extraEnv.WEB_CONCURRENCY | quote }}
-       {{- end }}
-       {{- end }}
+       {{- range $key, $value := .Values.backend.extraEnv }}
+       - name: {{ $key }}
+         value: {{ $value | quote }}
+       {{- end }}

This pattern is more maintainable and allows adding new environment variables without modifying the template.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 534a2b0 and 2124437.

📒 Files selected for processing (17)
  • docs/security/policies.md (1 hunks)
  • helm/integr8scode/Chart.yaml (1 hunks)
  • helm/integr8scode/templates/_helpers.tpl (1 hunks)
  • helm/integr8scode/templates/app/backend-deployment.yaml (1 hunks)
  • helm/integr8scode/templates/jobs/user-seed.yaml (1 hunks)
  • helm/integr8scode/templates/secrets/env-secret.yaml (1 hunks)
  • helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml (1 hunks)
  • helm/integr8scode/templates/workers/_worker.tpl (1 hunks)
  • helm/integr8scode/templates/workers/coordinator.yaml (1 hunks)
  • helm/integr8scode/templates/workers/dlq-processor.yaml (1 hunks)
  • helm/integr8scode/templates/workers/event-replay.yaml (1 hunks)
  • helm/integr8scode/templates/workers/k8s-worker.yaml (1 hunks)
  • helm/integr8scode/templates/workers/pod-monitor.yaml (1 hunks)
  • helm/integr8scode/templates/workers/result-processor.yaml (1 hunks)
  • helm/integr8scode/templates/workers/saga-orchestrator.yaml (1 hunks)
  • helm/integr8scode/values-prod.yaml (1 hunks)
  • helm/integr8scode/values.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/security/policies.md
  • helm/integr8scode/templates/workers/_worker.tpl
  • helm/integr8scode/templates/_helpers.tpl
🧰 Additional context used
🪛 YAMLlint (1.37.1)
helm/integr8scode/templates/app/backend-deployment.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/k8s-worker.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/secrets/env-secret.yaml

[error] 4-4: syntax error: expected , but found ''

(syntax)

helm/integr8scode/templates/workers/pod-monitor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/result-processor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/jobs/user-seed.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/coordinator.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/dlq-processor.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/event-replay.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

helm/integr8scode/templates/workers/saga-orchestrator.yaml

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Backend Tests
🔇 Additional comments (18)
helm/integr8scode/templates/workers/event-replay.yaml (1)

1-46: LGTM! Well-structured worker deployment.

The event-replay worker follows consistent patterns with other worker deployments:

  • Proper gating with enabled flag
  • Checksum annotation for config change detection
  • Fallback resource allocation (worker-specific → common)
  • Environment configuration via secrets
helm/integr8scode/templates/jobs/user-seed.yaml (1)

28-40: Init container readiness check is appropriate.

The init container pattern using netcat to poll MongoDB readiness is straightforward and effective for this use case. The pinned busybox version (1.36) is good for reproducibility.

helm/integr8scode/values-prod.yaml (2)

29-31: Tracing enabled in production—verify performance impact.

Tracing is enabled with a 10% sampling rate. While this is reasonable, ensure you have appropriate storage and analysis infrastructure (Jaeger) configured to handle production trace volumes.


121-122: LGTM! Proper password placeholder pattern.

The empty password fields with clear comments to set via --set follow security best practices by requiring explicit production credentials rather than shipping with defaults.

helm/integr8scode/templates/workers/coordinator.yaml (1)

1-46: LGTM! Coordinator worker follows established patterns.

The deployment template is consistent with other workers and includes proper configuration management via checksums and secrets. The tracing service name "execution-coordinator" differs from the deployment name but this appears intentional for clearer tracing identification.

helm/integr8scode/templates/workers/saga-orchestrator.yaml (1)

1-46: LGTM! Saga orchestrator maintains template consistency.

This worker deployment maintains excellent consistency with the coordinator and event-replay workers, using the same patterns for configuration management, resource allocation, and environment setup.

helm/integr8scode/templates/secrets/env-secret.yaml (1)

37-38: Port 443 configuration is correct and intentional.

The backend is configured to terminate TLS directly at the application level, not at the ingress layer. This is evident from:

  • Backend configuration with SSL certificates (server.key, server.crt)
  • Gunicorn binding to 0.0.0.0:443 with --keyfile and --certfile flags
  • Kubernetes Service correctly mapping port 443 to targetPort 443

This architectural choice of backend-level TLS termination is consistent throughout the entire deployment stack and requires no changes.

helm/integr8scode/templates/workers/result-processor.yaml (1)

1-46: LGTM!

The result-processor deployment template is well-structured and follows the established patterns for worker deployments. The template correctly:

  • Uses conditional rendering based on .Values.workers.resultProcessor.enabled
  • Includes checksum annotation for automatic pod restarts on secret changes
  • Falls back to common resources when specific resources are not defined
  • Correctly omits kubeconfig volume mount since this worker doesn't require Kubernetes API access

The YAMLlint syntax error is a false positive—{{- is valid Helm/Go template syntax.

helm/integr8scode/templates/workers/pod-monitor.yaml (1)

1-57: LGTM!

The pod-monitor deployment template is correctly configured for a worker that requires Kubernetes API access:

  • Properly mounts the kubeconfig secret with read-only permissions
  • Sets the KUBECONFIG environment variable to the mount path
  • Follows consistent patterns with other worker templates

The YAMLlint syntax error is a false positive for Helm template syntax.

helm/integr8scode/values.yaml (2)

1-104: LGTM - Well-organized values structure.

The global settings, image configuration, RBAC, kubeconfig, and shared environment variables are well-documented and logically organized with clear section headers. The defaults are sensible for local development.


105-264: LGTM - Backend, frontend, and workers configurations.

The backend, frontend, and workers sections are well-structured with appropriate resource limits, health probe configurations, and worker-specific settings. The requiresKubeconfig flags clearly document which workers need Kubernetes API access.

helm/integr8scode/templates/app/backend-deployment.yaml (1)

63-80: LGTM - Health probes are well-configured.

The liveness and readiness probes are correctly configured with:

  • Appropriate paths for health endpoints
  • HTTPS scheme for secure communication
  • Reasonable timing parameters (initialDelaySeconds, periodSeconds, failureThreshold)

The comment about fixing 405 errors is helpful context.

helm/integr8scode/templates/workers/k8s-worker.yaml (1)

1-57: LGTM!

The k8s-worker deployment template is correctly configured for a worker that creates executor pods:

  • Properly mounts the kubeconfig secret for Kubernetes API access
  • Follows consistent patterns with other worker templates
  • Resource fallback logic is correctly implemented

The YAMLlint syntax error is a false positive for Helm template syntax.

helm/integr8scode/templates/workers/dlq-processor.yaml (5)

1-9: LGTM! Standard Helm deployment structure.

The conditional rendering and metadata follow Kubernetes and Helm best practices. The component label properly identifies the DLQ processor worker.


15-22: Excellent use of checksum annotation for config drift detection.

The checksum annotation ensures pods are automatically restarted when the environment secret changes, preventing configuration drift.

Note: The AI summary mentions "configMapRef to the -env ConfigMap" but the actual implementation uses secretRef (lines 31-33), which is more appropriate for sensitive configuration data.


23-38: LGTM! Well-structured environment configuration.

The combination of envFrom for shared configuration and specific env entries for worker-specific settings (consumer group ID, tracing service name) follows best practices. Making the consumer group ID configurable is especially important for Kafka consumer coordination.


39-44: Excellent resource management pattern.

The fallback from worker-specific to common resources enables flexible resource allocation while maintaining sensible defaults. This reduces configuration duplication and allows easy per-worker customization when needed.


10-14: The default replica count of 1 is intentional and appropriate. The production values explicitly document this as "Low traffic service," reflecting that DLQs handle only error cases and require minimal processing capacity. No changes needed.

Comment on lines +22 to +33
dependencies:
# Redis using Bitnami chart
- name: redis
version: "20.6.3"
repository: "https://charts.bitnami.com/bitnami"
condition: redis.enabled

# MongoDB using Bitnami chart
- name: mongodb
version: "16.4.3"
repository: "https://charts.bitnami.com/bitnami"
condition: mongodb.enabled

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update Bitnami chart dependencies to latest versions.

Redis Helm chart is at version 20.6.3 but latest is 24.0.8. MongoDB Helm chart is at version 16.4.3 but latest is 18.1.17. Upgrading is required to receive security patches and bug fixes. Note that breaking changes exist between versions (e.g., Redis parameter renaming from "slave" to "replica"), so test upgrades carefully.

🤖 Prompt for AI Agents
In helm/integr8scode/Chart.yaml around lines 22 to 33, the Bitnami dependency
versions for redis and mongodb are out of date; update redis version to 24.0.8
and mongodb version to 18.1.17 in the dependencies block, run helm repo update
and helm dependency update to refresh lockfile, and then run your upgrade tests
(including checking values keys that changed such as redis "slave" -> "replica")
to catch any breaking parameter renames and adjust values.yaml accordingly
before merging.

Comment on lines +2 to +3
{{- $superPassword := .Values.infrastructure.kafka.jaas.superPassword | default "admin-secret" }}
{{- $kafkaPassword := .Values.infrastructure.kafka.jaas.kafkaPassword | default "kafka-secret" }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Weak default passwords require production override.

The default passwords "admin-secret" and "kafka-secret" are insecure for production. These should be explicitly set via values or external secret management.

Consider documenting in values-prod.yaml or adding a validation check similar to the user-seed template to require these in production:

🔎 Example validation pattern
 {{- if .Values.infrastructure.kafka.enabled }}
+{{- if and (eq (.Values.infrastructure.kafka.jaas.superPassword | default "admin-secret") "admin-secret") (eq (.Values.infrastructure.kafka.jaas.kafkaPassword | default "kafka-secret") "kafka-secret") }}
+  {{- fail "Production deployment requires secure Kafka JAAS passwords. Set via --set infrastructure.kafka.jaas.superPassword=xxx --set infrastructure.kafka.jaas.kafkaPassword=xxx" }}
+{{- end }}
 {{- $superPassword := .Values.infrastructure.kafka.jaas.superPassword | default "admin-secret" }}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In helm/integr8scode/templates/secrets/kafka-jaas-secret.yaml around lines 2-3
the template uses weak hardcoded defaults ("admin-secret" and "kafka-secret")
for superPassword and kafkaPassword; replace this by requiring explicit values
in production and removing insecure defaults: update the template to not provide
insecure defaults (fail rendering or emit a clear error when values are missing
in non-dev profiles), document these values in values-prod.yaml and/or add a
pre-install validation (or a Helm chart helper) that enforces
.Values.infrastructure.kafka.jaas.superPassword and
.Values.infrastructure.kafka.jaas.kafkaPassword are set or sourced from external
secret manager before deploy.

@HardMax71
HardMax71 merged commit 42a0a0f into main Dec 18, 2025
15 of 16 checks passed
@HardMax71
HardMax71 deleted the deploy_via_helm branch December 18, 2025 19:10
This was referenced Dec 22, 2025
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