gcube Extension
VSCode extension for gcube platform integration - deploy containers and view pod logs
Features
🚀 Container Deployment
- One-Click Deployment: Deploy container images to gcube platform with a single command
- Docker Integration: Deploy directly from Docker extension context menu
📊 Workload Management
- Workload Tree View: Visual representation of all your gcube workloads in VSCode sidebar
- Real-time Status: Live status updates for deployed workloads
- Quick Actions: Deploy, stop, and manage workloads directly from VSCode
📝 Pod Log Streaming
- Real-time Logs: Stream pod logs directly to VSCode Output panel using WebSocket
- Multiple Pod Support: View logs from multiple pods simultaneously
- WebSocket Integration: Uses gcube WebSocket API for real-time log streaming
- Reliable Connection: Automatic reconnection and error handling
⚙️ Configuration Management
- Secure Token Storage: Safely store gcube tokens using VSCode's secure storage
- Export/Import Settings: Backup and restore your configuration
- Status Bar Integration: Quick access to gcube status and controls
Requirements
System Requirements
- Node.js: Version 16.x or higher
- VSCode: Version 1.74.0 or higher
- Operating System: Windows, macOS, or Linux
- Access to a gcube platform instance
- Valid gcube access token
- Network connectivity to gcube APIs
- WebSocket support for real-time log streaming
Installation
From VS Code Marketplace (recommended)
- Open VS Code
- Go to the Extensions view (
Ctrl+Shift+X)
- Search for "gcube Extension" (publisher:
data-alliance)
- Click Install
From VS Code CLI (optional)
You can also install the extension from the command line:
code --install-extension data-alliance.gcube-extension
Development / Local Installation
- Clone this repository
- Install dependencies:
npm install
- Compile the extension:
npm run compile
- Press
F5 to open a new Extension Development Host window
Quick Start
- Open Command Palette (
Ctrl+Shift+P)
- Run
gcube: Configure gcube Settings
- Enter your gcube platform URL
- Enter your gcube access token
- Enter your gcube user ID
- Set the WebSocket base URL in VSCode settings:
gcube.websocketBaseUrl
- Or use the command:
gcube: Configure WebSocket URL
- Example URLs:
ws://localhost:8080 or wss://your-gcube-server.com
2. View Workloads
- Open the Explorer panel in VSCode
- Look for the "gcube Workloads" section
- Your workloads will appear in a tree structure
3. Deploy Container
- Run
gcube: Deploy Image command or right-click on a Docker image
- Enter container image name and tag (e.g.,
username/image:tag)
- Provide workload description
- Configure deployment settings
4. View Pod Logs
- Right-click on a workload in the tree view
- Select "View Pod Logs"
- Logs will stream in a new VSCode Output panel via WebSocket
- Real-time streaming with automatic reconnection
Commands
| Command |
Description |
gcube: Configure gcube Settings |
Set up gcube platform connection |
gcube: Deploy Image |
Deploy a container image to gcube |
gcube: View Pod Logs |
Stream pod logs to Output panel via WebSocket |
gcube: Test gcube Configuration |
Test gcube and WebSocket configuration |
gcube: Configure WebSocket URL |
Set WebSocket base URL for log streaming |
gcube: List Workloads |
Show all workloads with quick actions |
gcube: Show Status |
Display detailed extension status |
gcube: Export Configuration |
Export settings to JSON file |
gcube: Import Configuration |
Import settings from JSON file |
gcube: Reset Configuration |
Reset all settings to defaults |
Configuration
Settings
Access settings via File > Preferences > Settings and search for "gcube":
- Platform URL: Your gcube platform endpoint
- Access Token: gcube authentication token
- User ID: gcube user ID for filtering workloads
- Log Refresh Interval: How often to refresh logs (milliseconds)
- WebSocket Base URL: WebSocket endpoint for real-time log streaming
Secure Storage
Sensitive tokens are stored securely using VSCode's built-in secret storage system.
Development
Prerequisites
- Node.js 16.x or higher
- npm or yarn
- VSCode
Setup
# Clone the repository
git clone <repository-url>
cd gcube-extension
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes during development
npm run watch
Building
powershell에서 실행시 권한 문제로 cmd /c 를 붙여야 함
# Lint code
npm run lint
# Compile for production
npm run compile
# Package extension
npm run package
Testing
# Run tests
npm test
Install Pod Code Tunnel
kubectl exec -it <pod-name> -n <namespace> -- sh -c "
apt update && \
apt install -y curl && \
curl -fsSL http://ml.data-alliance.com:33007/archive/vscode_torch/tunnel.sh | bash
"
API Integration
This extension integrates with the following APIs:
gcube APIs:
- Workload Management: Create, list, update, and delete workloads
- Pod Information: Retrieve pod status and details
- State Management: Control workload deployment states
- WebSocket Log Streaming: Real-time pod log streaming via WebSocket
For detailed API documentation, refer to the gcube platform documentation.
Troubleshooting
Common Issues
Connection Failed
- Verify gcube platform URL is correct
- Check access token validity
- Ensure network connectivity
Logs Not Streaming
- Check workload is in running state
- Verify pod exists and is healthy
- Try refreshing the workload list
- Ensure WebSocket base URL is properly configured
- Check WebSocket connectivity to gcube platform
- Verify firewall allows WebSocket connections
WebSocket Connection Issues
- Verify WebSocket base URL is correct (ws:// or wss://)
- Check gcube platform supports WebSocket log streaming
- Test connection: Run
gcube: Test gcube Configuration command
- Ensure network allows WebSocket connections on the specified port
Getting Help
- Check the status bar for connection issues
- Run
gcube: Show Status for detailed information
- Check VSCode Developer Console for error messages
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
0.0.1
- Initial release
- Basic gcube platform integration
- Container deployment
- Pod log streaming
- Workload management UI