-
Notifications
You must be signed in to change notification settings - Fork 897
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
Add ContainerQuotaScope model, save them in save_inventory #16655
Conversation
LGTM, travis sais you have to create a factory class for this though |
@@ -0,0 +1,3 @@ | |||
class ContainerQuotaScope < ApplicationRecord | |||
belongs_to :container_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.
what does this class do ?
why we need this class ?
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.
from discussion in ManageIQ/manageiq-providers-kubernetes#190 is sounds like this class only hold one string field (:scope
[string] the name of the scope ) that can currently hold only 4 possible strings ...
Do we need a class to hold a list of pre defined strings, shouldn't we use a text field here ?
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.
This is a model class. We need it to access the table, because Rails ;-)
As we're discussing on that PR:
- schema might be suboptimal, but gaprindashvili schema is frozen and we need this feature there.
- since we're going to retain full quotas history by archiving instead of in-place updates, there is a case where this schema may be more effecient to refresh.
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.
@cben does a quata has only 4 possible set of scopes ?
a. terminating and best effort
b. terminating and not best effort
c. not terminating and best effort
d not terminating and not best effort
Checked commits cben/manageiq@6b525f4~...70d840b with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Thanks, Travis :) Added factory, PTAL. |
@@ -2,5 +2,6 @@ class ContainerQuota < ApplicationRecord | |||
belongs_to :ext_management_system, :foreign_key => "ems_id" | |||
belongs_to :container_project | |||
|
|||
has_many :container_quota_scopes, :dependent => :destroy |
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.
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.
see answer below #16655 (comment)
you mention in the BZ "keep history instead of overwriting in refresh". is that something that you want to accomplish in this PR?
No, I'm not dealing with history yet. This PR should update in place / destroy.
This PR just adds something to refresh that we haven't stored before.
Added links to PR description about what scopes are.
|
Scopes are optional, e.g. quota with no scopes cover all resources.
So I think there are 9:
{terminating, not terminating, either} X {best effort, not best effort,
either}
|
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.
LGTM,
@cben I think it is worth mentioning here the PR with VCR tests for this.
Don't have it yet :-) Need to finish ManageIQ/manageiq-providers-openshift#75 first, then copy new cassettes to this repo. |
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.
👍 LGTM
Gaprindashvili backport details:
|
Add ContainerQuotaScope model, save them in save_inventory (cherry picked from commit 56c179d)
Kubernetes namespaces (aka openshift projects) may have quotas.
Each quota may have one or more scopes, which we didn't store before but should:
https://kubernetes.io/docs/concepts/policy/resource-quotas/#quota-scopes
https://docs.openshift.com/container-platform/3.7/admin_guide/quota.html#quota-scopes
Schema was added in ManageIQ/manageiq-schema#111
Core side, followed by ManageIQ/manageiq-providers-kubernetes#190.
I think this PR is safe to merge first.
https://bugzilla.redhat.com/show_bug.cgi?id=1504560