Croit S3 Storage Plugin for Waldur Site Agent
This plugin provides integration between Waldur Mastermind and Croit S3 storage systems via RadosGW API. Each marketplace resource automatically creates one S3 user with configurable safety limits.
Features
- Automatic S3 User Creation: One S3 user per marketplace resource with slug-based naming
- Usage-Based Billing: Track actual storage and object consumption
- Safety Quota Enforcement: Optional bucket quotas based on user-specified limits
- Usage Reporting: Real-time storage and object count metrics
- Credential Management: S3 access keys exposed via resource metadata
- Bearer Token Authentication: Secure API access with configurable SSL verification
Installation
Add the plugin to your UV workspace:
1 2 | |
Configuration
Basic Configuration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Configuration Options
Backend Settings
api_url(required): Croit API base URL (will be appended with /api)token(optional): Bearer token for API authenticationusername(optional): API username (alternative to token)password(optional): API password (alternative to token)verify_ssl(optional, default:true): Enable/disable SSL certificate verificationtimeout(optional, default:30): Request timeout in secondsuser_prefix(optional, default:"waldur_"): Prefix for generated usernamesslug_separator(optional, default:"_"): Separator for slug componentsmax_username_length(optional, default:64): Maximum username lengthdefault_tenant(optional): Default RadosGW tenantdefault_placement(optional): Default placement ruledefault_storage_class(optional): Default storage class
Component Types
Usage-Based Storage (s3_storage)
Tracks actual storage consumption with optional safety quota enforcement:
1 2 3 4 5 | |
Usage-Based Objects (s3_objects)
Tracks object count with optional safety quota enforcement:
1 2 3 4 | |
Note: The plugin automatically creates one S3 user per marketplace resource. No separate user component is needed.
Username Generation
Usernames are automatically generated from Waldur resource metadata:
Format: {prefix}{org_slug}_{project_slug}_{resource_uuid_short}
Example: waldur_myorg_myproject_12345678
Slug Cleaning Rules
- Convert to lowercase
- Replace non-alphanumeric characters with underscores
- Remove consecutive underscores
- Truncate if exceeds maximum length
- Preserve prefix and resource UUID
Usage Reporting
The plugin collects usage metrics for all user buckets:
Storage Usage
- Sums
usageSum.sizeacross all user buckets - Converts bytes to configured units (e.g., GB)
- Reports actual storage consumption
Object Usage
- Sums
usageSum.numObjectsacross all user buckets - Reports total object count
Report Format
1 2 3 4 5 6 | |
Resource Metadata
Each S3 user resource exposes comprehensive metadata:
S3 Credentials
1 2 3 4 5 6 7 8 | |
Storage Summary
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Quota Information
1 2 3 4 5 6 7 8 9 | |
Safety Quota Enforcement
When enforce_limits: true is set for usage-based components, the plugin automatically applies safety limits from
resource options as RadosGW bucket quotas:
- Create Resource: Apply initial quotas based on user-specified safety limits (storage_limit, object_limit)
- Prevent Overages: Quotas act as safety nets to prevent unexpected usage charges
- Monitor Usage: Include quota utilization in usage reports
Quota Types
- Storage Quota:
maxSizein bytes (converted from storage_limit in GB) - Object Quota:
maxObjectsas integer count (from object_limit)
How Safety Limits Work
- User Configuration: Users set
storage_limitandobject_limitvia Waldur marketplace form - Resource Options: Waldur passes these as resource attributes to the site agent
- Quota Application: Plugin applies these as bucket quotas during S3 user creation
- Usage Billing: Actual consumption is tracked and billed separately from quotas
Waldur Marketplace Integration
Creating the Matching Offering
To create a matching offering in Waldur Mastermind, run the setup script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
Alternative: Save the above code as setup_croit_s3_offering.py and run:
1 | |
Offering Configuration
The created Waldur offering will have:
- Type:
SITE_AGENT_OFFERING("Marketplace.Slurm") - Components:
s3_storageands3_objects(both usage-based billing) - Options:
storage_limitandobject_limitfor user input (safety limits) - Plugin Options:
create_orders_on_resource_option_change: true - Pricing: €0.02/GB/month for storage, €0.0001/object/month for objects
Order Payload Example
1 2 3 4 5 6 7 8 9 10 11 12 | |
Testing
Run the test suite:
1 2 | |
Development
Adding New Components
- Define component in site agent configuration:
1 2 3 4 5 | |
- Add usage collection logic in
_get_usage_report() - Add safety limit handling in
_apply_bucket_quotas()if needed - Add corresponding field in Waldur offering options for user input
Error Handling
The plugin includes comprehensive error handling:
CroitS3AuthenticationError: API authentication failuresCroitS3UserNotFoundError: User doesn't existCroitS3UserExistsError: User already existsCroitS3APIError: General API errorsCroitS3Error: Base exception class
Troubleshooting
SSL Certificate Issues
1 2 | |
Connection Timeouts
1 2 | |
Username Length Issues
1 2 3 | |
Debug Logging
Use standard Python logging configuration or waldur-site-agent logging settings to enable debug output for the plugin modules:
waldur_site_agent_croit_s3.client- HTTP API interactionswaldur_site_agent_croit_s3.backend- Backend operations
Resource Lifecycle
- Order Creation: User submits order with
storage_limitandobject_limit - User Creation: Plugin creates S3 user with slug-based username
- Quota Application: Safety limits applied as bucket quotas
- Credential Exposure: Access keys returned via resource metadata
- Usage Tracking: Real-time storage and object consumption reporting
- Limit Updates: Users can modify safety limits (creates new orders)
- Resource Deletion: S3 user and all buckets are removed
Related Plugins
Compute & HPC Plugins
- SLURM Plugin - SLURM cluster management
- MOAB Plugin - MOAB cluster management
- MUP Plugin - MUP portal integration
Container & Cloud Plugins
- OpenShift/OKD Plugin - OpenShift and OKD container platform management
- Harbor Plugin - Harbor container registry management
Storage Plugins
- CSCS HPC Storage Plugin - CSCS HPC storage management
Accounting Plugins
- CSCS DWDI Plugin - CSCS DWDI accounting integration
Utility Plugins
- Basic Username Management Plugin - Username generation and management