Skip to content
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

Selective policy enforcement #57

Conversation

imiller0
Copy link
Contributor

@imiller0 imiller0 commented Jun 6, 2022

Proposal to create a mechanism through which an inform policy can be selectively enforced on a subset of the clusters it is bound to.

Initial draft for review

Signed-off-by: Ian Miller <imiller@redhat.com>
Signed-off-by: Ian Miller <imiller@redhat.com>
@openshift-ci openshift-ci bot requested review from dhaiducek and mprahl June 6, 2022 12:37
Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I like the idea of using an annotation on the replicated policy in order to determine whether to update that policy's enforcement. That, and possibly having a separate controller to manage those annotations, seems like a good solution that can be adjusted based on users' needs.

But I feel like this proposal asserts that the only field that should ever be selectively rolled out is the remediationAction. What if users want to selectively roll out changes to policies, while keeping them in "enforce" mode?

Along those lines, is the new remediationAction value of "controlled" required? Or could this just be implemented via an annotation on replicated policies, and by adding logic to the propagator so that any updates to the parent policy are passed to the replicated policy only if the annotation allows it? The annotation might behave more like a "pause" feature in that case.

@imiller0
Copy link
Contributor Author

imiller0 commented Jun 7, 2022

@JustinKuli Thanks for the comments!

One of the thoughts in writing the proposal was to keep the child policies in sync with the parent policies at all times to reduce complexity in creating/maintaining the child policies. The only deviation would be adding the annotation to the child (hopefully easy to manage this difference). This way any changes in the parent policy are always reflected in the child but only the enforcement onto the cluster is affected.

I don't think the "controlled" remediation action is strictly required. This could be done with only the existing "inform" remediationAction and knowledge in the controller with respect to the annotation. Having the "controlled" value makes it more explicit that this behavior is an "opt-in", but has a couple downsides:

  • An additional state that has to be understood/displayed/reported in various UIs
  • Existing users of policy cannot begin making use of this feature without updating the remediationAction of their policy. If we allow the annotation to work with any "inform" policy then any existing installation could benefit from it.

You also make a good point that this could be reversed and implemented as a "pause" on an enforce policy. In our use case the inform with selective enforcement seemed to fit a bit closer.

Signed-off-by: Ian Miller <imiller@redhat.com>
@imiller0
Copy link
Contributor Author

Summarizing an enforcement approach discussed with @mprahl @gparvin @JustinKuli @serngawy @jc-rh and @imiller0.
Enforcement is by creation of additional PlacementRule/PlacementBinding:

  • remediationActionOverride in PlacementBinding – can only be set to enforce
  • By default the override PB/PR selects from the full set of managed clusters
  • Optional field in PlacementBinding allows sub-filtering to select from only managed clusters bound via non-sub-filtered placement rules

An update to the enhancment for review will be posted shortly

Based on feedback and discussion update the mechanism for selecting
clusters for enforcement to use existing Placement APIs with optional
remediationActionOverride directives.

Signed-off-by: Ian Miller <imiller@redhat.com>
Signed-off-by: Ian Miller <imiller@redhat.com>
Copy link
Member

@gparvin gparvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had one minor comment to mention this should work with PolicySet also. I don't think it really changes anything in the proposal.

Signed-off-by: Ian Miller <imiller@redhat.com>
Clarify behavior when there are multiple PlacementBindings.

Signed-off-by: Ian Miller <imiller@redhat.com>
Copy link
Member

@mprahl mprahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! This is a great and well thought out feature.

/hold for others to review

The subFilter is a generic concept, not necessarily limited to the
remediationActionOverride. Moving it to the top level allows future
extensions of this functionality to other overrides/transforms which can
also make use of the subFilter.

Signed-off-by: Ian Miller <imiller@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm label Aug 5, 2022
Copy link
Member

@mprahl mprahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@openshift-ci openshift-ci bot added the lgtm label Aug 5, 2022
@jc-rh
Copy link

jc-rh commented Aug 5, 2022

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Aug 5, 2022

@jc-rh: changing LGTM is restricted to collaborators

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link

openshift-ci bot commented Aug 5, 2022

@jc-rh: changing LGTM is restricted to collaborators

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Very well-written! I feel good about this.

supporting this as a feature users, or higher level
controllers/orchestrators, do not have to implement a procedural
pattern of copying policies and manipulating bindings/labels to
progressivly enforce the policy on clusters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
progressivly enforce the policy on clusters.
progressively enforce the policy on clusters.

Adding diagram depicting the selection logic for multiple
PlacementBindings with various subFilter and remediationActionOverride
settings. Courtesy of @JustinKuli

Signed-off-by: Ian Miller <imiller@redhat.com>
Copy link
Member

@mprahl mprahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@openshift-ci openshift-ci bot added the lgtm label Aug 10, 2022
@openshift-ci
Copy link

openshift-ci bot commented Aug 10, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: imiller0, jc-rh, JustinKuli, mprahl

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@imiller0
Copy link
Contributor Author

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Aug 10, 2022

@imiller0: you cannot LGTM your own PR.

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mprahl
Copy link
Member

mprahl commented Aug 10, 2022

/unhold

@openshift-merge-robot openshift-merge-robot merged commit 31ba6f4 into open-cluster-management-io:main Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants