Skip to content

feat(agentstack-cli): switch to microshift#2098

Draft
JanPokorny wants to merge 5 commits intomainfrom
janpokorny/feat-switch-to-microshift
Draft

feat(agentstack-cli): switch to microshift#2098
JanPokorny wants to merge 5 commits intomainfrom
janpokorny/feat-switch-to-microshift

Conversation

@JanPokorny
Copy link
Collaborator

Signed-off-by: Jan Pokorný JenomPokorny@gmail.com

Summary

Linked Issues

Documentation

  • No Docs Needed:

If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why.

Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
@JanPokorny JanPokorny changed the title Janpokorny/feat-switch-to-microshift feat(agentstack-cli): switch to microshift Feb 13, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JanPokorny, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the local Agent Stack platform management within the CLI. It transitions from a driver-based architecture with separate files to a unified platform.py module that handles VM creation, Kubernetes tool installation (now including MicroShift), image import, and deployment. This change aims to simplify the codebase, improve maintainability, and introduce support for MicroShift as a Kubernetes runtime, enhancing the local development environment setup.

Highlights

  • Refactored Platform Management: The VM driver logic (Lima, WSL) and Kubernetes platform (k3s, MicroShift) management have been consolidated into a single platform.py file, removing the previous driver-specific files for a more unified approach.
  • MicroShift Integration: The platform now explicitly supports and installs MicroShift as a Kubernetes runtime, including a detailed installation script within the platform.py file to streamline setup.
  • Simplified Image Import: The build.py command for importing images has been updated to use the new consolidated platform functions, improving the clarity and maintainability of the image import process.
  • UI Build Source Definition: The tasks.toml file for the UI build now explicitly defines source files, which was previously commented out, ensuring better dependency tracking for the build system.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • apps/agentstack-cli/src/agentstack_cli/commands/build.py
    • Updated image import logic to use new get_vm_status and import_image_to_internal_registry functions from the refactored platform module.
    • Removed direct get_driver calls and driver.status() / driver.import_image_to_internal_registry() methods.
  • apps/agentstack-cli/src/agentstack_cli/commands/platform.py
    • Added a new file consolidating all VM driver (Lima, WSL) and Kubernetes platform (k3s, MicroShift) management logic.
    • Included a comprehensive INSTALL_MICROSHIFT_SCRIPT for setting up MicroShift, CRI-O, and related tools.
    • Implemented functions for detecting VM driver, getting VM status, stopping/deleting VMs, executing commands in VMs, creating VMs, detecting Kubernetes platform, installing tools, importing images, and deploying the Agent Stack platform with Helm.
    • Integrated ImagePullMode enum for flexible image pulling strategies.
  • apps/agentstack-cli/src/agentstack_cli/commands/platform/init.py
    • Removed the file, as its functionality was merged into platform.py.
  • apps/agentstack-cli/src/agentstack_cli/commands/platform/base_driver.py
    • Removed the file, as its functionality was merged into platform.py.
  • apps/agentstack-cli/src/agentstack_cli/commands/platform/lima_driver.py
    • Removed the file, as its functionality was merged into platform.py.
  • apps/agentstack-cli/src/agentstack_cli/commands/platform/wsl_driver.py
    • Removed the file, as its functionality was merged into platform.py.
  • apps/agentstack-cli/src/agentstack_cli/data/.gitignore
    • Modified the .gitignore file.
  • apps/agentstack-ui/tasks.toml
    • Uncommented and refined the sources list for the build task, explicitly listing package.json, next.config.ts, tsconfig.json, public/**/*, and src/**/*.
Activity
  • The pull request was created by JanPokorny.
  • The description indicates this is a feature branch related to switching to MicroShift.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 refactors the platform management logic, replacing the driver-based architecture with a unified module to introduce MicroShift support, consolidating VM and Kubernetes management. A critical security concern has been identified: several hardcoded secrets and default credentials are present in the platform deployment logic, which must be addressed to improve the security posture of the local development environment. Furthermore, while the new platform.py is generally sound, it is quite large and could benefit from future modularization, and there are areas for improvement related to error handling, resource management, and robustness.

if total_memory_gib < 8:
console.warning("Less than 8 GB of RAM detected. Performance may be degraded.")

with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete_on_close=False) as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The temporary file created using tempfile.NamedTemporaryFile with delete_on_close=False is never deleted after use. This will lead to an accumulation of temporary YAML files on the user's system. The file should be deleted after it's no longer needed by the limactl start command. Using a try...finally block would be a good way to ensure the file is always cleaned up, even if errors occur.

Comment on lines 807 to 815
await run_in_vm(
vm_name,
[
"bash",
"-c",
f"kubectl --kubeconfig={kubeconfig} get configmap -n openshift-dns dns-default -o yaml | sed '/^ Corefile: |/a\\ host.docker.internal:53 {{\\n hosts {{\\n {host_ip} host.docker.internal\\n fallthrough\\n }}\\n }}' | kubectl --kubeconfig={kubeconfig} apply -f -",
],
"Setting up internal networking",
)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Using sed to modify the CoreDNS ConfigMap by piping kubectl output is fragile. The command relies on the exact YAML output format of kubectl, which could change in future versions and break this logic. A more robust approach would be to fetch the ConfigMap, parse the YAML in Python, modify the data structure, and then apply the updated ConfigMap object. This would make the code more resilient to formatting changes.

Comment on lines 703 to 709
"encryptionKey": "Ovx8qImylfooq4-HNwOzKKDcXLZCB3c_m0JlB9eJBxc=",
"trustProxyHeaders": True,
"keycloak": {
"uiClientSecret": "agentstack-ui-secret",
"serverClientSecret": "agentstack-server-secret",
"service": {"type": "LoadBalancer"},
"auth": {"adminPassword": "admin"},
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

Several hardcoded secrets and credentials are used in the deploy function to configure the Agent Stack platform. These include the encryptionKey, uiClientSecret, serverClientSecret, and the Keycloak adminPassword (set to "admin"). Hardcoding secrets in the source code is a security risk as they are known to anyone with access to the code. If the platform is deployed without overriding these values, it could be vulnerable to unauthorized access.

Severity: Medium
Vulnerability Type: Hardcoded Secrets

Comment on lines +276 to +277
except Exception:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The broad except Exception: pass can hide important errors during VM status detection, such as issues with limactl or wsl.exe commands. This might lead to unexpected behavior, for example, attempting to create a VM that already exists but was not detected due to an error. It would be more robust to log the exception, especially in verbose/debug mode, to aid in debugging potential environment issues.

Comment on lines 966 to 967
if values_file and not pathlib.Path(values_file).is_file():
raise FileNotFoundError(f"Values file {values_file} not found.")
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The values_file parameter is already annotated as pathlib.Path | None. Calling pathlib.Path(values_file) is redundant. You can directly use the is_file() method on values_file.

Suggested change
if values_file and not pathlib.Path(values_file).is_file():
raise FileNotFoundError(f"Values file {values_file} not found.")
if values_file and not values_file.is_file():
raise FileNotFoundError(f"Values file {values_file} not found.")

Signed-off-by: Jan Pokorný <JenomPokorny@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant