Skip to content

Conversation

bernielomax
Copy link
Contributor

No description provided.

@bernielomax bernielomax requested a review from a team as a code owner September 2, 2025 01:20
@bernielomax bernielomax force-pushed the bernielomax/feat/dataplane-management branch from f5d9dc5 to 082b5a5 Compare September 2, 2025 03:38
Comment on lines +21 to +22
# 3. Install a dataplane on your Kubernetes cluster
airbox install dataplane
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should flip this to airbox dataplane install as that would mimic abctl more in the abctl local install order of operations.

# Configure for dataplane mode
edition: "%s"
# Storage configuration (using default Minio for now)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is fine but needs reviewing.

@@ -0,0 +1,13 @@
package k8s
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This didn't actually get used. I'm pretty sure.

@bernielomax bernielomax marked this pull request as draft September 2, 2025 16:59
@bernielomax bernielomax force-pushed the bernielomax/feat/dataplane-management branch 5 times, most recently from f90fd4c to 05748bd Compare September 11, 2025 00:01
@bernielomax bernielomax force-pushed the bernielomax/feat/dataplane-management branch 10 times, most recently from 3031546 to 49e8daa Compare September 11, 2025 19:27
@bernielomax bernielomax changed the title feat: dataplane management commands feat: airbox Sep 11, 2025
@bernielomax bernielomax force-pushed the bernielomax/feat/dataplane-management branch 3 times, most recently from 4f8735f to 0f43192 Compare September 11, 2025 23:08
Adds comprehensive UI package for interactive terminal commands:

- Select component for choosing from options
- FilterableSelect with real-time search filtering
- TextInput with validation and placeholder support
- Spinner for long-running operations
- JSON/YAML output formatters with proper indentation
- Provider interface with thread-safe implementation

All components support consistent keyboard navigation (arrow keys, enter, esc)
and follow unified styling with purple accent color for Airbyte branding.

Includes comprehensive test coverage with table-driven tests and gomock mocks.
Improves HTTP client package with better URL handling and comprehensive testing:

- Simplified baseURL handling using url.JoinPath for proper path resolution
- Added nil pointer protection for HTTPDoer interface
- Enhanced error handling with descriptive messages
- Preserves request context and query parameters
- Comprehensive test coverage with table-driven tests and gomock mocks
- Fixed staticcheck warning for context key type

All HTTP methods (GET, POST, PUT, DELETE) are tested with various scenarios
including error cases and edge conditions.
Major restructuring of authentication system with provider-based design:

**Core Architecture:**
- Provider interface for pluggable auth methods (OAuth2, OIDC)
- Consolidated credential management with thread-safe operations
- OAuth2 client credentials and OIDC authorization code flows
- Automatic token refresh and 401 retry handling

**New Components:**
- OIDCProvider: Browser-based PKCE flow with discovery
- OAuth2Provider: Client credentials flow for service accounts
- Flow: Manages OAuth callback server and browser integration
- CredentialsStore interface for token persistence

**Security Improvements:**
- PKCE (Proof Key for Code Exchange) for OIDC flows
- State parameter validation for CSRF protection
- Mutex-protected token operations
- Clock skew tolerance for token expiration

**Removed Legacy Code:**
- Deprecated client.go and refresh.go modules
- Simplified error handling with proper context
- Made internal helpers private (OAuth2ErrorResponse → oAuth2ErrorResponse)

Comprehensive test coverage with gomock for all flows and edge cases.
Adds comprehensive API client support for organizations and regions:

**Organizations API:**
- Get organization by ID
- List all organizations for authenticated user

**Regions API:**
- Get region by ID
- List regions with optional organization filtering
- Create new regions

**Enhanced API Client:**
- Factory pattern for dependency injection
- Service interface defining all operations
- Structured request/response types
- Comprehensive test coverage with gomock

All endpoints follow RESTful conventions with proper JSON handling
and HTTP status code validation.
Adds comprehensive support for Airbyte dataplane Helm chart operations:

**Dataplane Chart Support:**
- InstallDataplaneChart function for automated dataplane deployment
- Dynamic values generation based on configuration and credentials
- Support for enterprise, cloud, and community editions
- Proper chart repository management with Airbyte v1 repo

**Factory Pattern:**
- NewClient factory function for dependency injection
- Configurable Helm client creation with proper defaults
- Thread-safe client initialization

**Configuration Management:**
- YAML values builder with credential injection
- Environment-specific configuration (enterprise vs cloud)
- Kubernetes namespace and storage configuration
- Chart version pinning to stable release (1.8.1)

Includes comprehensive test coverage with gomock for all chart operations
and edge cases. Constants properly scoped as unexported package internals.
Introduces comprehensive configuration management for airbox CLI:

**Configuration System:**
- Context-based config with multiple environment support
- YAML/JSON serialization with validation
- File-based config store with XDG compliance
- Environment variable overrides for OAuth credentials

**Authentication Framework:**
- Pluggable auth providers (OAuth2, OIDC)
- Credential management with automatic token handling
- Provider discovery and validation
- Thread-safe credential operations

**Factory Pattern:**
- Dependency injection for API services
- Configurable HTTP clients and auth providers
- Mock interfaces for comprehensive testing

**Validation System:**
- URL validation for endpoints
- Dataplane name validation (Kubernetes-compatible)
- Company identifier validation
- Context and configuration validation

Includes extensive test coverage with gomock and proper error handling
throughout all configuration and authentication flows.
Adds centralized output handling for consistent data rendering:

**Output Formatting:**
- RenderOutput function for consistent data display
- Support for JSON and YAML formats with format validation
- Default JSON format when no format specified
- Extensible handler map for adding new formats

**Features:**
- Format validation with helpful error messages
- Integration with UI provider for consistent rendering
- Simple handler function pattern for format extensions
- Error handling for unsupported formats and rendering failures

**Testing:**
- Comprehensive table-driven tests covering all scenarios
- Mock UI provider integration for isolated testing
- Error case validation and format handling verification

Foundation utility for command output consistency across
get/list operations and other data display commands.
Introduces Kubernetes cluster management with factory pattern:

**Cluster Factory:**
- ClusterFactory interface for dependency injection
- Default implementation with configurable options
- Mock interface for comprehensive testing

**Features:**
- Kind cluster creation and management
- Kubeconfig context switching
- Clean factory pattern for testability
- Thread-safe cluster operations

**Cleanup:**
- Removes legacy config.go and config_test.go
- Replaces with modern factory-based approach
- Supports both real and mock implementations

Ready for integration with install commands and Kubernetes operations.
Adds interactive configuration initialization for airbox CLI:

**Config Init Command:**
- Interactive deployment type selection (Cloud vs Enterprise)
- Dynamic URL input for Enterprise deployments
- OAuth credential discovery and validation
- Context creation with environment-specific defaults
- Force flag support for config overwriting

**Features:**
- Cloud: Pre-configured with official Airbyte Cloud endpoints
- Enterprise: Custom URL input with validation
- OAuth environment variable integration
- User-friendly error handling and validation
- Comprehensive test coverage with UI mocking

Establishes foundation for all subsequent airbox operations
by ensuring proper configuration is in place.
Adds comprehensive authentication management for airbox CLI:

**Authentication Commands:**
- `airbox auth login`: Interactive OAuth2/OIDC login with organization selection
- `airbox auth logout`: Complete credential cleanup and session termination
- `airbox auth switch-organization`: Switch between available organizations

**Login Features:**
- Automatic auth method detection (OAuth2 vs OIDC)
- Organization discovery and selection (single org auto-select)
- Filterable organization list for multi-org environments
- Credential persistence with proper token management

**Organization Management:**
- Smart organization switching with validation
- Support for large organization lists with filtering
- Current organization context preservation

**Security:**
- Proper credential cleanup on logout (sets credentials to nil)
- Secure token storage and retrieval
- Auth state validation throughout all operations

Includes comprehensive test coverage with gomock for all auth flows
and UI interactions.
Adds comprehensive dataplane installation with Kubernetes integration:

**Install Dataplane Command:**
- Interactive dataplane creation with region/organization selection
- Automatic Kubernetes cluster setup (Kind cluster support)
- Helm chart deployment with dynamic values generation
- Namespace resolution and management

**Installation Flow:**
- Organization and region discovery from API
- Dataplane registration with Airbyte control plane
- Kubernetes cluster creation (optional Kind cluster)
- Helm chart installation with proper credentials injection
- Post-installation validation and success reporting

**Kubernetes Integration:**
- Smart namespace resolution (default vs custom)
- Kind cluster creation with proper context switching
- Helm client factory pattern for dependency injection
- Cluster factory for Kubernetes operations

**Error Handling:**
- Comprehensive validation at each step
- Proper cleanup on installation failures
- User-friendly error messages with actionable guidance

Includes extensive test coverage with gomock for all installation
scenarios and error conditions.
Adds comprehensive dataplane retrieval and listing functionality:

**Get Dataplane Commands:**
- `airbox get dataplane [name]`: Get specific dataplane by name
- `airbox get dataplane`: List all dataplanes (when no name provided)
- JSON output with proper formatting and structure

**Features:**
- Name-based dataplane lookup with API integration
- Comprehensive error handling for not found cases
- Factory pattern integration for dependency injection
- Clean JSON output for both single and list operations

**API Integration:**
- Uses airbox API service factory for authenticated requests
- Proper organization context resolution
- Error handling for authentication and authorization

Ready for integration into main command structure when get operations
are enabled. Includes comprehensive test coverage with gomock for
all scenarios and error conditions.
Adds dataplane deletion functionality with proper confirmation:

**Delete Dataplane Command:**
- `airbox delete dataplane <name>`: Delete specific dataplane by name
- Interactive confirmation with resource details
- Proper success messaging with deleted resource ID

**Features:**
- Name-based dataplane lookup and deletion
- UI integration with confirmation prompts
- Error handling for not found and deletion failures
- Factory pattern integration for dependency injection
- Clean success reporting with resource identification

**User Experience:**
- Uses UI provider for consistent interactive experience
- Title, confirmation, and success messaging
- Proper error handling with actionable feedback

Ready for integration into main command structure when delete operations
are enabled. Includes comprehensive test coverage with properly grouped
imports following Go conventions.
Introduces complete airbox CLI application with command routing:

**Main Application:**
- Kong-based CLI framework with dependency injection
- Comprehensive command structure with subcommands
- Factory pattern integration for all dependencies
- Global configuration and authentication management

**Command Structure:**
- config: init (active)
- auth: login, logout, switch-organization (active)
- install: dataplane (active)
- get: dataplane (ready, commented out)
- delete: dataplane (ready, commented out)

**Dependency Injection:**
- HTTP client factory with timeout configuration
- API service factory with authentication
- Helm client factory for chart operations
- K8s cluster factory for Kubernetes operations
- UI provider factory for consistent user interface

**Features:**
- Environment-based configuration
- Proper error handling and exit codes
- Help and version information
- Modular command registration ready for expansion

Foundation for complete airbox CLI functionality with clean
architecture supporting both active and future commands.
Complete user documentation for airbox CLI including:
- Quick start guide and installation
- Environment variables (AIRBOXCONFIG, OAuth2 credentials)
- Configuration and authentication workflows
- Command reference with examples
- Kubernetes integration and deployment guide
- Notes about temporarily disabled get/delete commands
@bernielomax bernielomax force-pushed the bernielomax/feat/dataplane-management branch from 0f43192 to bac3176 Compare September 17, 2025 21:46
@bernielomax bernielomax marked this pull request as ready for review September 17, 2025 22:03
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