-
Notifications
You must be signed in to change notification settings - Fork 12
Implemented feature to add new attributes to existing Openshift allocations #202
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
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.
looks like a good feature to have. Just a question inline
expected_value = self.set_default_quota_on_allocation(allocation, allocator, attr) | ||
logger.warning(f"Added default quota for {attr} to allocation {allocation_str} to {expected_value}") | ||
|
||
if not (current_value == expected_value): |
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.
why did you have to make it an if
inside of an else and move it down? why couldn't we have done this?
elif not (current_value == expected_value):
# do the thing for this condition
elif (current_value is None and expected_value is None):
# do the new thing of setting default quota
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.
Funny enough. It seems you already asked something similar to this before.
I take it that this means these if statements are very confusing, and I've added the comment block below. @naved001 Should I make an issue to refactor this in the future?
# We just checked the case where the quota value is set in the cluster
# but not in coldfront. This is the only case the cluster value is the
# "source of truth" for the quota value
# If the coldfront value is set, it is always the source of truth.
# But first, we need to check if the quota value is set anywhere at all.
# TODO (Quan): Refactor these if statements so that we can remove this comment block?
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.
@QuanMPhm LMAO. yes, please add a brief comment to explain this otherwise I will, without fail, ask the same question again in a few months.
when determining what attributes an allocation should have This is done by a function `get_expected_attributes` in `tasks.py` to fetch the list of expected attributes
…ations `validate_allocations` will now check if an Openshift allocation does not have a quota value set on either the Coldfront or Openshift side. In this case, it will set the default quota value for the allocation. Due to the complexity of Openstack quotas, this feature is only implemented for Openshift allocations for now.
Closes #200. Built on top of #201. This PR consists of the last commit.
validate_allocations
will now check if an Openshift allocation does not have a quota value set on either the Coldfront or Openshift side. In this case, it will set the default quota value for the allocation.Due to the complexity of Openstack quotas, this feature is only
implemented for Openshift allocations for now.