chore(craft): improve Kubernetes startup, image cleanup, and local debugging

Merged
RO
7h ago
+3096-895

Description

Craft development required repeated image builds, copied cluster settings, and editor-specific Telepresence commands. Startup could report success before services were usable.

  • Share configuration resolution and launch commands between Make and VS Code. Read deployed ConfigMaps and Secrets in memory, with personal .env.k8s overrides.
  • Add separate infrastructure and application readiness checks, craft-doctor, and shared Telepresence connection/intercept handling.
  • Reuse images, detect source changes, and provide checkout-scoped cleanup previews. Add pause/resume and migration commands with database-target checks.
  • Default Kubernetes sandbox callbacks to the internal API Service. Preserve explicit ONYX_SERVER_URL overrides and bump the Helm chart to 0.9.20.
  • Update the local Kubernetes guide, Craft development skill, and feature map.
  • Give Helm chart CI a 100 GB runner disk. The previous runner exhausted disk while unpacking OpenSearch.
  • Upgrade the Storybook package family to 10.6.2 to fix the critical audit finding GHSA-f2ph-cmg5-wxc8.

Existing .env.k8s files remain untouched; old service entries continue to override chart settings. Image refresh updates the PodTemplate for future sandboxes; existing sandbox pods retain their images.

Review guide

Read or download the Markdown review guide.

How Has This Been Tested?

  • Live kind and Telepresence: startup, intercept reuse, doctor, API and worker hot reload, readiness success/failure, and migration status/upgrade.
  • Three real Craft smoke tests: sandbox provisioning, file upload/readback, and web app preview through the frontend. No real LLM calls were exercised.
  • 76 Craft Helm tests and 27 development-tool regression tests passed.
  • Pre-commit checks, explicit development-tool type checking, frontend type coverage, and skill validation passed.
  • The local web audit passes its critical-severity gate without suppressions. The Storybook production build passes.
  • Removed the disposable test cluster, local processes, and temporary files.

Additional Options

  • [Optional] Please cherry-pick this PR to the latest release version.

Summary by cubic

Harden local Craft Kubernetes development by sharing configuration and launch logic between Make and VS Code, and by checking service readiness before startup reports success.

What’s included

  • Resolve deployed ConfigMaps, Secrets, and container env in memory through a shared launcher; personal .env.k8s values take precedence, and resolved secrets never touch disk or terminal output.
  • Add shared lifecycle commands (craft-doctor, staged infrastructure/application readiness, Telepresence connect and intercept, pause, resume, migration, cleanup previews) used by both Make and VS Code.
  • Reuse built images when source is unchanged, force a rebuild with --rebuild-sandbox-image, and keep probe and command invocations bounded while preserving actionable errors.
  • Default sandbox callbacks to the internal API Service, preserving explicit ONYX_SERVER_URL overrides; drop the now-unneeded validation and bump the Helm chart to 0.9.20.
  • Give the Helm CI runner a 100 GB disk, since Docker and kind each store images and OpenSearch exhausted the default disk. Bump Storybook tooling to 10.6.2 to patch a development server vulnerability.
  • Update the local Kubernetes guide, Craft development skill, feature map, and add a downloadable PR review guide.

Validation

  • Passed 76 Craft Helm tests, 27 development-tool regression tests, and new unit tests for the shared runtime and lifecycle CLI.
  • Tested startup, readiness, Telepresence, hot reload, migrations, and three Craft smoke tests against kind; no real LLM calls were exercised.

Summary by CodeRabbit

  • New Features

    • Added a unified local Kubernetes workflow for Craft, including API and worker launching, connectivity, readiness checks, migrations, pause/resume, diagnostics, cleanup, and disk management.
    • Added sandbox image reuse, rebuilding, loading, and configurable image selection.
    • Sandbox callbacks now default to the internal API service URL, with support for explicit overrides.
  • Documentation

    • Added guidance for local Kubernetes setup, configuration, lifecycle management, troubleshooting, and verification.
  • Bug Fixes

    • Improved readiness validation and stopped sensitive generated credentials from being printed.