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

[release-2.7] 🤖 Sync from open-cluster-management-io/config-policy-controller: #96 #400

Conversation

openshift-cherrypick-robot

This is an automated cherry-pick of #397

/assign JustinKuli

Previously, when the controller is removed, it could leave a mess behind
in the form of ConfigurationPolicy objects with finalizers on them. That
would also result in the CRD being stuck.

Now, the controller will put a finalizer on its own deployment when at
least one ConfigurationPolicy has a finalizer. Also, while the
deployment is being deleted, the finalizers on ConfigurationPolicies
will be removed immediately, in the same way they would be when the CRD
was being deleted.

Note: in this implementation, related objects might *never* be pruned
when the controller is removed.

Since the controller deployment is in a different namespace than the
ConfigutaionPolicies it watches, the controller's cache cannot be
limited to a single namespace the way it was before. Instead, this uses
additional cache selectors to limit watches on ConfigurationPolicies
and Deployments to the relevant namespaces.

Refs:
 - https://issues.redhat.com/browse/ACM-2923

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
(cherry picked from commit e60e939)
@sonarcloud
Copy link

sonarcloud bot commented Jan 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 1 Vulnerability
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

52.6% 52.6% Coverage
0.0% 0.0% Duplication

needDeploymentFinalizer := false

for _, plc := range policiesList.Items {
if objHasFinalizer(&plc, pruneObjectFinalizer) {

Check warning

Code scanning / SonarCloud

<!--SONAR_ISSUE_KEY:AYXRXj2WWApvY56FffA--->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_config-policy-controller&issues=AYXRXj2WWApvY56FffA-&open=AYXRXj2WWApvY56FffA-&pullRequest=400">SonarCloud</a></p>

<!--SONAR_ISSUE_KEY:AYXRXj2WWApvY56FffA--->Implicit memory aliasing in for loop. <p>See more on <a href="https://sonarcloud.io/project/issues?id=open-cluster-management_config-policy-controller&issues=AYXRXj2WWApvY56FffA-&open=AYXRXj2WWApvY56FffA-&pullRequest=400">SonarCloud</a></p>
Copy link
Contributor

@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.

/approve

@openshift-ci
Copy link

openshift-ci bot commented Jan 20, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, openshift-cherrypick-robot

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

@openshift-merge-robot openshift-merge-robot merged commit f385cbd into stolostron:release-2.7 Jan 20, 2023
@JustinKuli
Copy link
Contributor

Approving a cherrypick of my own PR

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.

3 participants