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.9] 🤖 Sync from open-cluster-management-io/governance-policy-propagator: #127 #460

Conversation

openshift-cherrypick-robot

This is an automated cherry-pick of #435

/assign JustinKuli

The new `IsForPolicyOrPolicySet` may be very slightly faster than the
previous implementation.

The `GetPoliciesInPlacementBinding` function is from duplicated code.

The removal of a `DeepCopy()` call may improve performance.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit fdc3118)
Previously, the `common` package had separate functions to get the
decisions from a PlacementBinding depending on whether it was bound to
a Placement or a PlacementRule. But every caller would need to use both,
so that was unnecessary. Now, there is a unified `GetDecisions` func.

Similarly, the `propagator` had separate functions to find the policy
placements (not to be confused with Placements...), and the de-
duplicated logic was brought to the `getPolicyPlacementDecisions` func
more directly.

Signed-off-by: Justin Kulikauskas <[email protected]>
(cherry picked from commit 4178f22)
@openshift-ci openshift-ci bot added the lgtm label Oct 11, 2023
@openshift-ci
Copy link

openshift-ci bot commented Oct 11, 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

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability C 4 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

91.2% 91.2% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

}
}
}
result = append(result, common.GetPoliciesInPlacementBinding(ctx, c, &pb)...)

Check warning

Code scanning / SonarCloud

Implicit memory aliasing in for loop. See more on SonarCloud Warning

Implicit memory aliasing in for loop. See more on SonarCloud
continue
}

plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, pb)
plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, &pb)

Check warning

Code scanning / SonarCloud

Implicit memory aliasing in for loop. See more on SonarCloud Warning

Implicit memory aliasing in for loop. See more on SonarCloud
foundInDecisions := false

plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, pb)
plcDecisions, plcPlacements, err := r.getPolicyPlacementDecisions(instance, &pb)

Check warning

Code scanning / SonarCloud

Implicit memory aliasing in for loop. See more on SonarCloud Warning

Implicit memory aliasing in for loop. See more on SonarCloud
}

result = append(result, common.GetPoliciesInPlacementBinding(ctx, c, &pb)...)

Check warning

Code scanning / SonarCloud

Implicit memory aliasing in for loop. See more on SonarCloud Warning

Implicit memory aliasing in for loop. See more on SonarCloud
@JustinKuli
Copy link
Contributor

/override "SonarCloud Code Analysis"

@openshift-ci
Copy link

openshift-ci bot commented Oct 11, 2023

@JustinKuli: Overrode contexts on behalf of JustinKuli: SonarCloud Code Analysis

In response to this:

/override "SonarCloud Code Analysis"

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 openshift-ci bot merged commit 8e083fd into stolostron:release-2.9 Oct 11, 2023
10 of 11 checks passed
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.

2 participants