-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
default resolution rule policy to the imagepolicy default #19766
Conversation
/hold @smarterclayton i'm sure you had a good reason for doing this as you did but since the godoc says:
there seems to a a conflict between what as implemented (resolutionrule inherits the global default only if an execution rule covers it) and what the doc claims (resolutionrule inherits the global default). So either we need to fix the doc or fix the behavior, can you help me understand the intent here? |
actually there are two issues/questions w/ the original code:
this PR changes both of those (defaults all resolution rules, does not look at execution rule coverage), but perhaps the right solution is to just fix (1) (apply defaulting to all resolution rules, but only if an execution rule covers them). @smarterclayton I need the reasoning behind the covering logic. |
@GrahamDumpleton fyi |
I think the current behavior stemmed from this: #15868 (comment) |
This was to preserve back compat with 3.6. It is *very* possible any
changes here could break running applications.
I’m tempted to say we put a hold on changes to the api until we move this
to an operator logic and then migrate all existing config to an api object,
dropping support for the old config (or letting it be left in legacy mode).
On May 19, 2018, at 11:39 AM, Ben Parees <[email protected]> wrote:
actually there are two issues/questions w/ the original code:
1. the policy defaulting was only being applied if no resolution rules
were explicitly defined by the user
2. the policy defaulting is only being applied to resolution rules that
are covered by an execution rule
this PR changes both of those (defaults all resolution rules, does not look
at execution rule coverage), but perhaps the right solution is to just fix
(1) (apply defaulting to all resolution rules, but only if an execution
rule covers them). @smarterclayton <https://github.com/smarterclayton> I
need the reasoning behind the covering logic.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19766 (comment)>,
or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p_hRACRNAvFlWAACRJtk6BU5wXfGks5t0DycgaJpZM4UEzC8>
.
|
Can we agree that if, after applying the existing defaulting logic (which is only applied to the default resolution rules), there is a resolution rule w/ no policy set(that would be one explicitly defined by the user), we should set that resolution rule's policy to the global default? If we do not do that, the configuration is invalid and the cluster fails to start, so there should be no risk of changing existing behavior for a working cluster, it just ensures that someone who, in the future, writes a configuration that relies on the documented defaulting behavior, will get a working cluster and not a validation error. |
(i've updated the PR to reflect that proposal) |
@smarterclayton bump |
I can't see anything wrong with this but all of this is in a tape backup in my mind. Are you confident this can't accidentally regress deployed 3.9 clusters when they upgrade? |
From what i understand (which is worth sanity checking), if someone manually defined a resolution rule and did not define a policy for it, it will fail validation (policy is a required field). So any configurations this would affect are already invalid/failing to start. The intent here is just to help people who write a new config going forward. |
@smarterclayton beginning of 3.11 feels like a good time to merge this... |
/hold cancel @smarterclayton @liggitt i'm feeling pretty good about this, have i convinced you? |
/refresh |
/retest all |
/test all |
and we want to default the half they didn't specify? is that going to cause us problems if those defaults change in the future, and the changes don't mesh with the resolution rule they provided? |
The api docs indicate that if the rule itself doesn't specify a value, the default value is pulled from the global policy setting(which is set by them). However the implementation didn't actually do that. The sole purpose of this PR is to bring the behavior in line w/ the api doc. If we think the api doc behavior is not what we want, we can change the api docs and require that you always specify a policy for every rule, instead of allowing there to be a global policy that the rules inherit, but the global policy that is inherited by the rules by default seemed like a reasonable behavior to me. I wouldn't think we'd be allowed to change the defaults (which in this case would be the default global policy, I guess). |
Ok.
Clayton will have to refresh my memory… I thought new types could get default rules added for them |
for reference this is the current api doc: origin/pkg/image/admission/apis/imagepolicy/types.go Lines 60 to 62 in dd68e3f
|
technically i guess it doesn't say it inherits the global default if not specified, but the claim that it "overrides it" would imply that it's optional/uses the global value normally. |
@liggitt new types of what? this change only affects resolutionrules (e.g. not executionrules and not necessarily a new type of rule if we introduced one). |
I misread the defaulting... if they specify any resolution rules, we don't contribute any of the default ones, which might expand to include rules for new resource types in the future.
does that mean that someone that doesn't specify any resolution rules gets an error? the defaults here don't set a policy value: origin/pkg/image/admission/apis/imagepolicy/v1/defaults.go Lines 24 to 34 in dab335c
|
yes they do: origin/pkg/image/admission/apis/imagepolicy/v1/defaults.go Lines 35 to 47 in dab335c
|
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
fixes #19775