Skip to content

✨ Add support for references to secrets or configmaps in env variables import - #350

Merged
pdettori merged 5 commits into
rossoctl:mainfrom
pdettori:issue-336
Oct 28, 2025
Merged

pdettori merged 5 commits into
rossoctl:mainfrom
pdettori:issue-336

Conversation

@pdettori

@pdettori pdettori commented Oct 28, 2025 •

Copy link
Copy Markdown
Member

Summary

This PR adds support for importing environment variables from .env files that reference Kubernetes Secrets or ConfigMaps instead of containing plaintext values. The implementation allows JSON-encoded references (e.g., {"secretKeyRef": {...}}) in .env files to be parsed and included as valueFrom entries in generated manifests.

Key changes:

  • New parse_env_file() function that handles JSON-encoded secret/configmap references alongside plain string values
  • UI enhancements to support "Structured" vs "Plain" mode for environment variables with JSON validation
  • Comprehensive test coverage for the new parsing logic and integration with resource body construction

Related issue(s)

Fixes #336

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for importing environment variables from .env files that reference Kubernetes Secrets or ConfigMaps instead of containing plaintext values. The implementation allows JSON-encoded references (e.g., {"secretKeyRef": {...}}) in .env files to be parsed and included as valueFrom entries in generated manifests.

Key changes:

  • New parse_env_file() function that handles JSON-encoded secret/configmap references alongside plain string values
  • UI enhancements to support "Structured" vs "Plain" mode for environment variables with JSON validation
  • Comprehensive test coverage for the new parsing logic and integration with resource body construction

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
kagenti/ui/lib/build_utils.py Implements JSON-aware env parsing, refactors inline parser to module-level function, adds UI controls for structured/plain env modes, and updates validation logic to handle both value types
kagenti/ui/tests/test_env_parser.py Unit tests covering plain values, valueFrom JSON, shorthand secretKeyRef, and invalid JSON fallback behavior
kagenti/ui/tests/test_integration_resource_body.py Integration test verifying structured env entries flow correctly into Kubernetes resource body
docs/new-agent.md Documents the new feature with usage examples, migration notes, and quick-start guide for creating referenced Secrets
.github/workflows/ci.yaml Enables pytest execution in CI pipeline
Comments suppressed due to low confidence (1)

kagenti/ui/lib/build_utils.py:1

  • Syntax error: env_var[\"name\".strip()...] attempts to use a string literal as a dictionary key. This should be env_var[\"name\"].strip() to access the 'name' key and strip it.
# Assisted by watsonx Code Assistant

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Signed-off-by: Paolo Dettori <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Comment thread kagenti/ui/lib/build_utils.py Resolved
Signed-off-by: Paolo Dettori <[email protected]>

@cwiklik cwiklik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@pdettori
pdettori merged commit 1e9392b into rossoctl:main Oct 28, 2025
@pdettori
pdettori deleted the issue-336 branch October 28, 2025 16:40
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.

feature: UI should support Secrets / ConfigMaps when leading an .env file from filesystem or remote URL

3 participants