8000 feat(tools): add local KinD environment bootstrap and deployment to dev_env.py by VLukiantsev · Pull Request #559 · google/xmc · GitHub
[go: up one dir, main page]

Skip to content

feat(tools): add local KinD environment bootstrap and deployment to dev_env.py - #559

Merged
VLukiantsev merged 1 commit into
feat/tools-dev-env-helm-deployerfrom
feat/tools-local-kind-deployment
Sep 3, 2026
Merged

VLukiantsev merged 1 commit into
feat/tools-dev-env-helm-deployerfrom
feat/tools-local-kind-deployment

Conversation

@VLukiantsev
@VLukiantsev VLukiantsev commented Aug 24, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

Implements minimal local KinD environment bootstrap and deployment orchestration in dev_env.py (dev_env.py up, down), integrating Spanner provisioning, KinD clustering, OCI image builds, and Helm chart deployment.

Motivation & Context

Delivers the core happy-path bootstrap command (dev_env up) by generating dynamic values connecting pods to local Dex, Redis, and Spanner and executing Helm deployment.

Key Changes

  • Created tools/dev_env/helm_deployer.py with core HelmDeployer:
    • generate_values_file(): dynamic values.yaml connecting pods to local Dex OIDC, Redis, and Cloud Spanner.
    • deploy(): executes helm upgrade --install and waits for rollout confirmation.
  • Created tools/dev_env/local_runner.py with core LocalRunner:
    • Orchestrates complete happy-path up and down lifecycle workflows with status banner.
  • Wired up and down subcommands in dev_env.py.
  • Added unit tests in tools/dev_env/helm_deployer_test.py and tools/dev_env/local_runner_test.py (272 test lines).

PR Sizing & Vertical Slicing Rationale

  • Diff Size: 620 total insertions across 16 files (348 production code + 272 test code).
  • Approved Sizing: Strictly $\le 400$ production lines (348 prod lines).
  • Rationale: Core bootstrap orchestration slice, with advanced cloud resource pruning and failure diagnostics decoupled into the next layer.

Verification & Testing

  • Commands Executed: bazel test //tools/... //test/e2e/... (54/54 tests passing)
  • Linters & Static Analysis: Pre-commit hooks passed cleanly (ruff, mypy, buildifier, addlicense).

Related Issues / Bugs

Part of Stacked PR sequence for Local KinD developer environment support.

TAG=agy
CONV=4adc92f3-5e2b-459f-bf97-73230c96ba0e

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a fully automated local Kubernetes in Docker (KinD) development environment and a headless end-to-end (E2E) integration testing suite using Playwright. It adds a modular orchestration library to manage local KinD clusters, Cloud Spanner databases, OIDC authentication via Dex, and parallel container image compilation with Bazel. Feedback on the changes highlights a missing mapping in local_runner.py for several services (such as log_monitor, health_service, and dashboard_service) which will cause reload failures, as well as dead code in kind_manager.py involving if False conditional statements that should be removed.

Comment thread tools/dev_env/local_runner.py Resolved
Comment thread tools/dev_env/kind_manager.py Resolved
Comment thread tools/dev_env/kind_manager.py Resolved
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from f7cb6df to 4f00d0c Compare August 24, 2026 12:14
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from f4b2bfd to 390c2be Compare August 24, 2026 13:14
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 79eacac to b6704f3 Compare August 24, 2026 14:46
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from b6704f3 to a3e6615 Compare August 24, 2026 15:14
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from a3e6615 to 4073f5e Compare August 24, 2026 15:42
@VLukiantsev
VLukiantsev changed the base branch from feat/tools-configurable-dev-env-config to feat/tools-dev-env-image-builder August 24, 2026 15:42
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 4073f5e to 2c1a599 Compare August 24, 2026 15:57
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-d 8000 eployment branch from 2c1a599 to 97d06f0 Compare August 24, 2026 16:23
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 97d06f0 to b40aaf9 Compare August 25, 2026 10:32
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from b40aaf9 to 2450fa4 Compare August 25, 2026 10:37
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 2450fa4 to 3e6397a Compare August 25, 2026 10:48
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 32d9e73 to cfc7cd1 Compare August 26, 2026 20:13
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from cfc7cd1 to 33fff52 Compare August 26, 2026 20:23
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 33fff52 to 75fdc10 Compare August 26, 2026 21:03
@VLukiantsev
VLukiantsev force-pushed the feat/tools-local-kind-deployment branch from 75fdc10 to 19af 8000 380 Compare August 26, 2026 21:44
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a local KinD development environment orchestrator, adding the LocalRunner and HelmDeployer modules along with corresponding CLI subcommands (up and down) in dev_env.py, updated documentation in README.md, and comprehensive unit tests. The feedback highlights a potential permission conflict in the temporary directory path on shared machines, recommends adding the --create-namespace flag to the Helm deployment command to support custom namespaces, and points out several discrepancies between the implemented CLI arguments and the documentation.

Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/dev_env.py Resolved
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a local development environment orchestrator (LocalRunner) and a Helm deployment manager (HelmDeployer) to bootstrap and tear down the local KinD developer stack, along with corresponding Bazel targets, CLI subcommands (up and down), tests, and updated documentation. The review feedback suggests making the rollout check more robust by verifying deployment existence before checking status, replacing direct print() statements with log_info() to respect logging configurations, correcting the Dex OIDC Provider URL, and updating the unit tests accordingly.

Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/local_runner.py Resolved
Comment thread tools/dev_env/local_runner_test.py Resolved
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a local development environment orchestrator (LocalRunner) and a Helm deployment manager (HelmDeployer) to automate bootstrapping (up) and tearing down (down) local KinD environments. It also updates the CLI, Bazel build configurations, tests, and documentation. The feedback highlights a potential issue in helm_deployer.py where getpass.getuser() could raise a KeyError in minimal environments (like Docker or CI/CD), and suggests implementing a safer fallback mechanism.

Comment thread tools/dev_env/helm_deployer.py Resolved
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a local KinD development environment lifecycle orchestrator (LocalRunner) and a Helm deployment manager (HelmDeployer), along with CLI subcommands up and down to automate local environment bootstrapping and teardown. The feedback highlights a critical bug in helm_deployer.py where res.stdout is treated as a string instead of bytes, which would cause rollout checks to fail. Additionally, several Windows compatibility issues were identified, including the use of os.getuid in fallback logic and the patching of os.getuid in unit tests without create=True.

Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/helm_deployer_test.py Resolved
Comment thread tools/dev_env/helm_deployer_test.py Resolved
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a local KinD development environment lifecycle orchestrator (LocalRunner) and a Helm deployment manager (HelmDeployer) to automate the bootstrapping (up) and teardown (down) of the local development stack, alongside CLI updates, unit tests, and documentation. The review feedback highlights several critical improvements for HelmDeployer, including securing temporary file paths against symlink attacks, using a standard YAML library instead of manual string formatting to prevent syntax errors, handling command execution failures robustly when querying deployments, and validating the existence of custom values files before deployment.

Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/helm_deployer.py Resolved
@VLukiantsev
Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces automated bootstrap (up) and teardown (down) capabilities for the local KinD development environment, including a new LocalRunner orchestrator, a HelmDeployer utility, and associated unit tests and documentation. The review feedback is highly constructive and identifies three key improvements: optimizing the recursive _dump_yaml function to avoid redundant imports, handling potential RuntimeError exceptions gracefully in the CLI entry point, and ensuring that the --no-build-images flag correctly skips both the compilation and side-loading of OCI images.

Comment thread tools/dev_env/helm_deployer.py Resolved
Comment thread tools/dev_env/dev_env.py Resolved
Comment thread tools/dev_env/local_runner.py Resolved
janzak-dev
janzak-dev previously approved these changes Sep 1, 2026
@janzak-dev janzak-dev left a comment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A screenshot of a terminal that shows the output of this would be great :)

Introduces LocalRunner orchestrator connecting SpannerManager, KindManager,
ImageBuilder, and HelmDeployer into a unified pipeline. Exposes 'dev_env up'
and 'dev_env down' CLI subcommands and updates documentation.

TAG=agy
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.

2 participants

0