-
Notifications
You must be signed in to change notification settings - Fork 13
Allow validation of Openshift allocations when changing quotas #208
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,3 +191,27 @@ def remove_user_from_allocation(allocation_user_pk): | |
| allocator.remove_role_from_user(username, project_id) | ||
| else: | ||
| logger.warning("No project has been created. Nothing to disable.") | ||
|
|
||
|
|
||
| def get_allocation_cloud_usage(allocation_pk): | ||
| """ | ||
| Obtains the current quota usage for the allocation. | ||
|
|
||
| For example, the output for an Openshift quota would be: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make more sense for the allocator to return usage with the attribute names rather than the internal names?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no preference. Either way some translation will have to be done so that the requested quota dict and the usage dict use the same keys for quota attributes. Do you think one option is better than the other?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes more sense for the allocator to abstract away internal implementation details. In this way the interface between ColdFront and the Allocator is the attribute name. However, I do see that |
||
|
|
||
| { | ||
| "limits.cpu": "1", | ||
| "limits.memory": "2Gi", | ||
| "limits.ephemeral-storage": "10Gi", | ||
| } | ||
| """ | ||
| allocation = Allocation.objects.get(pk=allocation_pk) | ||
| if allocator := find_allocator(allocation): | ||
| if project_id := allocation.get_attribute(attributes.ALLOCATION_PROJECT_ID): | ||
| try: | ||
| return allocator.get_usage(project_id) | ||
| except NotImplemented: | ||
| return | ||
| else: | ||
| logger.warning("No project has been created. No quota to check.") | ||
| return | ||
Uh oh!
There was an error while loading. Please reload this page.