-
Notifications
You must be signed in to change notification settings - Fork 115
feat: implement unified options system #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
weinong
commented
Jul 21, 2025
- Introduce unified options architecture for both convert and token commands aiming to simplify options-to-cli flag mapping, validation, and conversion
- The unified options are enabled by default. Set environment variable KUBELOGIN_USE_LEGACY_OPTIONS=true to fallback to previous implementation
- Add comprehensive validation with strict/lenient modes for different contexts
- Implement reflection-based argument building for kubeconfig conversion
- Add extensive test coverage for unified options and validation
- Establish breadcrumb documentation system for development decisions
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #689 +/- ##
==========================================
- Coverage 63.43% 56.71% -6.73%
==========================================
Files 37 47 +10
Lines 2210 3269 +1059
==========================================
+ Hits 1402 1854 +452
- Misses 733 1280 +547
- Partials 75 135 +60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements a unified options system for both convert and token commands aiming to simplify options-to-cli flag mapping, validation, and conversion. The unified options are enabled by default with environment variable KUBELOGIN_USE_LEGACY_OPTIONS=true to fallback to previous implementation.
Key changes include:
- Introduction of unified options architecture with automatic flag registration using reflection and struct tags
- Implementation of comprehensive validation with strict/lenient modes for different contexts
- Addition of reflection-based argument building for kubeconfig conversion with field extraction from existing configurations
Reviewed Changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| test/integration/test_helpers.go | New integration test framework with environment isolation and helper utilities |
| test/integration/kubeconfig_flag_test.go | Tests for --kubeconfig flag support in unified mode |
| test/integration/go.mod | Go module configuration for integration tests |
| test/integration/fixtures/sample_kubeconfig.yaml | Sample kubeconfig fixture for testing conversion scenarios |
| test/integration/fixtures/empty_kubeconfig.yaml | Basic kubeconfig fixture for testing minimal configurations |
| test/integration/converter_integration_test.go | Comprehensive integration tests for all login methods and conversion scenarios |
| test/integration/cli_integration_test.go | CLI argument parsing and environment variable integration tests |
| pkg/internal/options/validation_test.go | Unit tests for validation rules and login method validation |
| pkg/internal/options/validation.go | Validation logic with strict and lenient modes for different command contexts |
| pkg/internal/options/utils.go | Utility functions including ToString() with sensitive field masking |
| pkg/internal/options/unified_test.go | Unit tests for unified options core functionality |
| pkg/internal/options/unified.go | Core unified options struct with automatic flag registration and environment loading |
| pkg/internal/options/kubeconfig_test.go | Tests for kubeconfig flag registration and parsing |
| pkg/internal/options/field_extraction_diagnostic_test.go | Diagnostic tests demonstrating field extraction validation issues |
| pkg/internal/options/execution_test.go | Tests for command execution and options conversion |
| pkg/internal/options/execution.go | Command execution logic with field extraction and kubeconfig conversion |
| pkg/internal/options/description_consistency_test.go | Tests ensuring consistent flag descriptions between legacy and unified modes |
| pkg/internal/options/convert_test.go | Unit tests for conversion logic and exec config building |
| pkg/internal/options/command_test.go | Tests for unified command creation and feature flag behavior |
| pkg/internal/options/command.go | Command creation utilities and feature flag management |
| pkg/cmd/token.go | Integration of unified options in token command with legacy fallback |
| pkg/cmd/convert.go | Integration of unified options in convert command with legacy fallback |
| Makefile | Added integration test targets and output management |
| .github/instructions/options-and-conversion.instructions.md | Comprehensive documentation for unified options system usage |
| .github/instructions/go.instructions.md | Go development best practices and coding standards |
| .github/copilot-instructions.md | Development workflow instructions and breadcrumb protocol |
| .github/.copilot/breadcrumbs/2025-07-20-1430-flag-description-consistency.md | Documentation of flag description consistency improvements |
| .github/.copilot/breadcrumbs/2025-07-20-1405-extract-login-constants.md | Documentation of login constants consolidation refactoring |
b9f2902 to
87032d7
Compare
- Introduce unified options architecture for both convert and token commands aiming to simplify options-to-cli flag mapping, validation, and conversion - The unified options are enabled by default. Set environment variable KUBELOGIN_USE_LEGACY_OPTIONS=true to fallback to previous implementation - Add comprehensive validation with strict/lenient modes for different contexts - Implement reflection-based argument building for kubeconfig conversion - Add extensive test coverage for unified options and validation - Establish breadcrumb documentation system for development decisions
87032d7 to
72e90f5
Compare